diff --git a/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml b/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml index 9feeb11fc2..fcc24e8928 100644 --- a/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml +++ b/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml @@ -29,6 +29,7 @@ description: | - drive-strength: Minimum current that can be sourced from the pin. - input-enable: enable input. - input-schmitt-enable: enable input schmitt circuit. + - ti,input-edge-detect: enable and configure edge detection interrupts An example for CC13XX family, include the chip level pinctrl DTSI file in the board level DTS: @@ -58,6 +59,17 @@ description: | }; }; + To configure an input pin with edge detection (e.g. to count pulses): + + &pinctrl { + gpt0_edge_counter: gpt0_edge_counter { + pinmux = <15 IOC_PORT_MCU_PORT_EVENT0>; + input-enable; + bias-pull-up; + ti,input-edge-detect = ; + }; + }; + To configure an output pin (e.g. for PWM output): &pinctrl { @@ -112,3 +124,13 @@ child-binding: 2: min 2 mA (SoC default) 4: min 4 mA 8: min 8 mA for for double drive strength IOs, min 4 mA for normal IOs + + ti,input-edge-detect: + type: int + default: 0 # no edge detection + description: | + Enables or disables the edge detection interrupt and configures it: + IOC_NO_EDGE: No edge detection (SoC default) + IOC_FALLING_EDGE: Edge detection on falling edge + IOC_RISING_EDGE: Edge detection on rising edge + IOC_BOTH_EDGES: Edge detection on both edges diff --git a/include/zephyr/dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h b/include/zephyr/dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h index 72586136fc..042fb9df7a 100644 --- a/include/zephyr/dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h +++ b/include/zephyr/dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h @@ -57,4 +57,10 @@ #define IOC_PORT_RFC_SMI_CL_OUT 0x00000037 /* RF Core SMI Command Link Out */ #define IOC_PORT_RFC_SMI_CL_IN 0x00000038 /* RF Core SMI Command Link In */ +/* Edge Detection */ +#define IOC_NO_EDGE 0x00000000 /* No edge detection */ +#define IOC_FALLING_EDGE 0x00010000 /* Edge detection on falling edge */ +#define IOC_RISING_EDGE 0x00020000 /* Edge detection on rising edge */ +#define IOC_BOTH_EDGES 0x00030000 /* Edge detection on both edges */ + #endif /* CC13XX_CC26XX_PINCTRL_COMMON_H_ */ diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h b/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h index 6dd2c6ac76..94d71f51f6 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h @@ -26,7 +26,8 @@ typedef struct pinctrl_soc_pin { DT_PROP(node_id, drive_open_source) * IOC_IOMODE_OPEN_SRC_NORMAL | \ (DT_PROP(node_id, drive_strength) >> 2) << IOC_IOCFG0_IOCURR_S | \ DT_PROP(node_id, input_enable) * IOC_INPUT_ENABLE | \ - DT_PROP(node_id, input_schmitt_enable) * IOC_HYST_ENABLE) + DT_PROP(node_id, input_schmitt_enable) * IOC_HYST_ENABLE | \ + DT_PROP(node_id, ti_input_edge_detect)) #define CC13XX_CC26XX_DT_PIN(node_id) \ { \