From 0dcbb22265257aee3bec04d545cd5c058e2a0c9f Mon Sep 17 00:00:00 2001 From: Florian Grandel Date: Tue, 25 Jul 2023 12:45:24 +0200 Subject: [PATCH] drivers: cc13xx_cc26xx: pinctrl: support drive strength Introduces support for drive-strength configuration to the CC13/26xx pinctrl driver. Signed-off-by: Florian Grandel --- .../pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml | 25 +++++++++++++++++++ .../ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h | 1 + 2 files changed, 26 insertions(+) diff --git a/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml b/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml index 5c78d9c561e..9feeb11fc29 100644 --- a/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml +++ b/dts/bindings/pinctrl/ti,cc13xx-cc26xx-pinctrl.yaml @@ -26,6 +26,7 @@ description: | - bias-pull-up: Enable pull-up resistor. - drive-open-drain: Output driver is open-drain. - drive-open-drain: Output driver is open-source. + - drive-strength: Minimum current that can be sourced from the pin. - input-enable: enable input. - input-schmitt-enable: enable input schmitt circuit. @@ -57,6 +58,16 @@ description: | }; }; + To configure an output pin (e.g. for PWM output): + + &pinctrl { + gpt0_pwm: gpt0_pwm { + pinmux = <16 IOC_PORT_MCU_PORT_EVENT1>; + bias-disable; + drive-strength = <8>; /* in mA */ + }; + }; + compatible: "ti,cc13xx-cc26xx-pinctrl" include: base.yaml @@ -78,6 +89,7 @@ child-binding: - bias-pull-up - drive-open-drain - drive-open-source + - drive-strength - input-enable - input-schmitt-enable @@ -87,3 +99,16 @@ child-binding: type: array description: | CC13XX/CC26XX pin's configuration (IO pin, IO function). + + drive-strength: + enum: + - 2 + - 4 + - 8 + default: 2 + description: | + The drive strength controls the minimum output driver strength of an I/O pin + configured as an output. + 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 diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h b/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h index e4536c46872..6dd2c6ac768 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/pinctrl_soc.h @@ -24,6 +24,7 @@ typedef struct pinctrl_soc_pin { DT_PROP(node_id, bias_disable) * IOC_NO_IOPULL | \ DT_PROP(node_id, drive_open_drain) * IOC_IOMODE_OPEN_DRAIN_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, input_enable) * IOC_INPUT_ENABLE | \ DT_PROP(node_id, input_schmitt_enable) * IOC_HYST_ENABLE)