drivers: cc13xx_cc26xx: pinctrl: support edge detection

Introduces support for SoC-specific input-edge-detect configuration to
the CC13/26xx pinctrl driver.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This commit is contained in:
Florian Grandel 2023-07-25 12:49:08 +02:00 committed by Carles Cufí
commit d34709121f
3 changed files with 30 additions and 1 deletions

View file

@ -29,6 +29,7 @@ description: |
- drive-strength: Minimum current that can be sourced from the pin. - drive-strength: Minimum current that can be sourced from the pin.
- input-enable: enable input. - input-enable: enable input.
- input-schmitt-enable: enable input schmitt circuit. - 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 An example for CC13XX family, include the chip level pinctrl
DTSI file in the board level DTS: 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 = <IOC_RISING_EDGE>;
};
};
To configure an output pin (e.g. for PWM output): To configure an output pin (e.g. for PWM output):
&pinctrl { &pinctrl {
@ -112,3 +124,13 @@ child-binding:
2: min 2 mA (SoC default) 2: min 2 mA (SoC default)
4: min 4 mA 4: min 4 mA
8: min 8 mA for for double drive strength IOs, min 4 mA for normal IOs 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

View file

@ -57,4 +57,10 @@
#define IOC_PORT_RFC_SMI_CL_OUT 0x00000037 /* RF Core SMI Command Link Out */ #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 */ #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_ */ #endif /* CC13XX_CC26XX_PINCTRL_COMMON_H_ */

View file

@ -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_open_source) * IOC_IOMODE_OPEN_SRC_NORMAL | \
(DT_PROP(node_id, drive_strength) >> 2) << IOC_IOCFG0_IOCURR_S | \ (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_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) \ #define CC13XX_CC26XX_DT_PIN(node_id) \
{ \ { \