Skip to contentSkip to conversation

Remove unused bits from dts and add support for remaining pinctrl macros

PATCH Superseded Akashdeep Kaur 3 participants 13 messages Sep 5, 2025 – Sep 9, 2025

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Remove unused bits from dts and add support for remaining pinctrl macros

This patch series cleans up the dts files to remove the pin control DeepSleep configuration that does not take effect in hardware. This series also adds the remaining macros in the pin control file supported by SoC so that any configuration can be used as per requirement in dts files.

Link to Previous Versions:
-V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/
-V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
-V3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
-V4: https://lore.kernel.org/linux-arm-kernel/[email protected]/

Change Log:
V1-> V2:
-Added the macros that were removed earlier for backward compatibility -Fixed the indentation
-Added documentation references in commit message

V2-> V3:
-Updated the commit message to be more descriptive and Clear -Fixed errors introduced in previous version

V3-> V4:
-Rearranged pinctrl macros so that all macros of same type are at same place -Removed any redundant macros added in previous versions of the series -Added new commit to fix the missing existing macro definition

V4-> V5:
-Updated documentation reference in commit message

Akashdeep Kaur (4):
arm64: dts: ti: k3-am62p5-sk: Remove the unused cfg in USB1_DRVVBUS
arm64: dts: ti: k3-am62x-sk-common: Remove the unused cfg in
USB1_DRVVBUS
arm64: dts: ti: k3-pinctrl: Add the remaining macros
arm64: dts: ti: k3-pinctrl: Fix the bug in existing macros

 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts       |  2 +-
 .../arm64/boot/dts/ti/k3-am62x-sk-common.dtsi |  2 +-
 arch/arm64/boot/dts/ti/k3-pinctrl.h           | 51 +++++++++++++++++--
 3 files changed, 50 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/4 arm64: dts: ti: k3-am62p5-sk: Remove the unused cfg in USB1_DRVVBUS

After the SoC has entered the DeepSleep low power mode, USB1 can be used to wakeup the SoC based on USB events triggered by USB devices. This requires that the pin corresponding to the Type-A connector remains pulled up even after the SoC has entered the DeepSleep low power mode. For that, either DeepSleep pullup configuration can be selected or the pin can have the same configuration that it had when SoC was in active mode. But, in order for DeepSleep configuration to take effect, the DeepSleep control bit has to be enabled.
Remove the unnecessary DeepSleep state configuration from USB1_DRVBUS pin, as the DeepSleep control bit is not set and the active configuration is sufficient to keep the pin pulled up. This simplifies the setup and removes redundant configuration.

This reverts commit 115290c112952db27009668aa7ae2f29920704f0.

---
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +1 -1
index 899da7896563..e8f0ac2c55e2 100644
@@ -360,7 +360,7 @@ AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) MCASP0_ACLKR.UART1_TXD */
 
 	main_usb1_pins_default: main-usb1-default-pins {
 		pinctrl-single,pins = <
-			AM62PX_IOPAD(0x0258, PIN_INPUT | PIN_DS_PULLUD_ENABLE | PIN_DS_PULL_UP, 0) /* (G21) USB1_DRVVBUS */
+			AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */
 		>;
 	};
 
Signature · 1 line
2.34.1
Tested-by on v5 1/4
#2 lore raw

Re: [PATCH v5 1/4] arm64: dts: ti: k3-am62p5-sk: Remove the unused cfg in USB1_DRVVBUS

Quoted 8 lines · Akashdeep Kaur

After the SoC has entered the DeepSleep low power mode, USB1 can be used to wakeup the SoC based on USB events triggered by USB devices. This requires that the pin corresponding to the Type-A connector remains pulled up even after the SoC has entered the DeepSleep low power mode. For that, either DeepSleep pullup configuration can be selected or the pin can have the same configuration that it had when SoC was in active mode. But, in order for DeepSleep configuration to take effect, the DeepSleep control bit has to be enabled.

The last sentence wording is confusing because it sounds like a DeepSleep control bit still needs to be enabled which is not seen in the patch. If possible, drop this sentence and do the same for the other similar patch in this series.

Quoted 9 lines

Remove the unnecessary DeepSleep state configuration from USB1_DRVBUS pin, as the DeepSleep control bit is not set and the active configuration is sufficient to keep the pin pulled up. This simplifies the setup and removes redundant configuration.

This reverts commit 115290c112952db27009668aa7ae2f29920704f0.

Verified USB disconnect, USB connect, and USB remote wakeup on AM62P SKEVM.

Quoted 17 lines
---
  arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +1 -1
index 899da7896563..e8f0ac2c55e2 100644
@@ -360,7 +360,7 @@ AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) MCASP0_ACLKR.UART1_TXD */
 
  	main_usb1_pins_default: main-usb1-default-pins {
  		pinctrl-single,pins = <
-			AM62PX_IOPAD(0x0258, PIN_INPUT | PIN_DS_PULLUD_ENABLE | PIN_DS_PULL_UP, 0) /* (G21) USB1_DRVVBUS */
+			AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */
  		>;
  	};
 
#3 lore raw

Re: [PATCH v5 1/4] arm64: dts: ti: k3-am62p5-sk: Remove the unused cfg in USB1_DRVVBUS

Hi Kendall,

Quoted 11 lines · Kendall Willis
Quoted 8 lines · Akashdeep Kaur

After the SoC has entered the DeepSleep low power mode, USB1 can be used to wakeup the SoC based on USB events triggered by USB devices. This requires that the pin corresponding to the Type-A connector remains pulled up even after the SoC has entered the DeepSleep low power mode. For that, either DeepSleep pullup configuration can be selected or the pin can have the same configuration that it had when SoC was in active mode. But, in order for DeepSleep configuration to take effect, the DeepSleep control bit has to be enabled.

The last sentence wording is confusing because it sounds like a DeepSleep control bit still needs to be enabled which is not seen in the patch. If possible, drop this sentence and do the same for the other similar patch in this series.

Sounds good! Removed.

Regards,
Akashdeep Kaur

Quoted 33 lines
Quoted 10 lines

Remove the unnecessary DeepSleep state configuration from USB1_DRVBUS pin, as the DeepSleep control bit is not set and the active configuration is sufficient to keep the pin pulled up. This simplifies the setup and removes redundant configuration.

This reverts commit 115290c112952db27009668aa7ae2f29920704f0.

Verified USB disconnect, USB connect, and USB remote wakeup on AM62P SKEVM.

Quoted 17 lines

---
  arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +0 -0
index 899da7896563..e8f0ac2c55e2 100644
@@ -360,7 +360,7 @@ AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) 

MCASP0_ACLKR.UART1_TXD */
      main_usb1_pins_default: main-usb1-default-pins { pinctrl-single,pins = <
-            AM62PX_IOPAD(0x0258, PIN_INPUT | PIN_DS_PULLUD_ENABLE | PIN_DS_PULL_UP, 0) /* (G21) USB1_DRVVBUS */
+            AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */ >;
      };

#4 lore raw

PATCH v5 2/4 arm64: dts: ti: k3-am62x-sk-common: Remove the unused cfg in USB1_DRVVBUS

In reply to Akashdeep Kaur

After the SoC has entered the DeepSleep low power mode, USB1 can be used to wakeup the SoC based on USB events triggered by USB devices. This requires that the pin corresponding to the Type-A connector remains pulled up even after the SoC has entered the DeepSleep low power mode.
For that, either DeepSleep pullup configuration can be selected or the pin can have the same configuration that it had when SoC was in active mode. But, in order for DeepSleep configuration to take effect, the DeepSleep control bit has to be enabled.
Remove the unnecessary DeepSleep state configuration from USB1_DRVBUS pin, as the DeepSleep control bit is not set and the active configuration is sufficient to keep the pin pulled up. This simplifies the setup and removes redundant configuration.

This reverts commit 527f884d2d94981016e181dcbd4c4b5bf597c0ad.

---
 arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi +1 -1
index 13e1d36123d5..d3bed23134ca 100644
@@ -249,7 +249,7 @@ AM62X_IOPAD(0x12c, PIN_OUTPUT, 0) /* (AD19/V15) RGMII1_TX_CTL */
 
 	main_usb1_pins_default: main-usb1-default-pins {
 		pinctrl-single,pins = <
-			AM62X_IOPAD(0x0258, PIN_OUTPUT | PIN_DS_PULLUD_ENABLE | PIN_DS_PULL_UP, 0) /* (F18/E16) USB1_DRVVBUS */
+			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18/E16) USB1_DRVVBUS */
 		>;
 	};
 
Signature · 1 line
2.34.1
Tested-by on v5 2/4
#5 lore raw

Re: [PATCH v5 2/4] arm64: dts: ti: k3-am62x-sk-common: Remove the unused cfg in USB1_DRVVBUS

Quoted 14 lines · Akashdeep Kaur

After the SoC has entered the DeepSleep low power mode, USB1 can be used to wakeup the SoC based on USB events triggered by USB devices. This requires that the pin corresponding to the Type-A connector remains pulled up even after the SoC has entered the DeepSleep low power mode.
For that, either DeepSleep pullup configuration can be selected or the pin can have the same configuration that it had when SoC was in active mode. But, in order for DeepSleep configuration to take effect, the DeepSleep control bit has to be enabled.
Remove the unnecessary DeepSleep state configuration from USB1_DRVBUS pin, as the DeepSleep control bit is not set and the active configuration is sufficient to keep the pin pulled up. This simplifies the setup and removes redundant configuration.

Quoted 4 lines

This reverts commit 527f884d2d94981016e181dcbd4c4b5bf597c0ad.

Verified USB disconnect, USB connect, and USB remote wakeup on SK-AM62B-P1.

Quoted 17 lines
---
  arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am62x-sk-common.dtsi +1 -1
index 13e1d36123d5..d3bed23134ca 100644
@@ -249,7 +249,7 @@ AM62X_IOPAD(0x12c, PIN_OUTPUT, 0) /* (AD19/V15) RGMII1_TX_CTL */
 
  	main_usb1_pins_default: main-usb1-default-pins {
  		pinctrl-single,pins = <
-			AM62X_IOPAD(0x0258, PIN_OUTPUT | PIN_DS_PULLUD_ENABLE | PIN_DS_PULL_UP, 0) /* (F18/E16) USB1_DRVVBUS */
+			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18/E16) USB1_DRVVBUS */
  		>;
  	};
 
#6 lore raw

PATCH v5 3/4 arm64: dts: ti: k3-pinctrl: Add the remaining macros

In reply to Akashdeep Kaur

Add the drive strength, schmitt trigger enable macros to pinctrl file. Add the missing macros for DeepSleep configuration control referenced from "Table 14-6172. Description Of The Pad Configuration Register Bits" in AM625 TRM[0].
Add some DeepSleep macros to provide combinations that can be used directly in device tree files example PIN_DS_OUTPUT_LOW that configures pin to be output and also sets its value to 0.

[0] https://www.ti.com/lit/pdf/SPRUJ83

---
 arch/arm64/boot/dts/ti/k3-pinctrl.h | 47 ++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +46 -1
index c0f09be8d3f9..8ce37ace94c9 100644
@@ -3,15 +3,20 @@
  * This header provides constants for pinctrl bindings for TI's K3 SoC
  * family.
  *
- * Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2018-2025 Texas Instruments Incorporated - https://www.ti.com/
  */
 #ifndef DTS_ARM64_TI_K3_PINCTRL_H
 #define DTS_ARM64_TI_K3_PINCTRL_H
 
+#define WKUP_LVL_EN_SHIFT       (7)
+#define WKUP_LVL_POL_SHIFT      (8)
 #define ST_EN_SHIFT		(14)
 #define PULLUDEN_SHIFT		(16)
 #define PULLTYPESEL_SHIFT	(17)
 #define RXACTIVE_SHIFT		(18)
+#define DRV_STR_SHIFT           (19)
+#define ISO_OVERRIDE_EN_SHIFT   (22)
+#define ISO_BYPASS_EN_SHIFT     (23)
 #define DEBOUNCE_SHIFT		(11)
 #define FORCE_DS_EN_SHIFT	(15)
 #define DS_EN_SHIFT		(24)
@@ -19,6 +24,7 @@
 #define DS_OUT_VAL_SHIFT	(26)
 #define DS_PULLUD_EN_SHIFT	(27)
 #define DS_PULLTYPE_SEL_SHIFT	(28)
+#define WKUP_EN_SHIFT           (29)
 
 /* Schmitt trigger configuration */
 #define ST_DISABLE		(0 << ST_EN_SHIFT)
@@ -33,6 +39,29 @@
 #define INPUT_EN		(1 << RXACTIVE_SHIFT)
 #define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
 
+#define DS_PULL_DISABLE         (1 << DS_PULLUD_EN_SHIFT)
+#define DS_PULL_ENABLE          (0 << DS_PULLUD_EN_SHIFT)
+
+#define DS_PULL_UP              (1 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+#define DS_PULL_DOWN            (0 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+
+#define DS_STATE_EN             (1 << DS_EN_SHIFT)
+#define DS_STATE_DISABLE        (0 << DS_EN_SHIFT)
+
+#define DS_INPUT_EN             (1 << DS_OUT_DIS_SHIFT | DS_STATE_EN)
+#define DS_INPUT_DISABLE        (0 << DS_OUT_DIS_SHIFT | DS_STATE_EN)
+
+#define DS_OUT_VALUE_ZERO       (0 << DS_OUT_VAL_SHIFT)
+#define DS_OUT_VALUE_ONE        (1 << DS_OUT_VAL_SHIFT)
+
+/* Configuration to enable wake-up on pin activity */
+#define WKUP_ENABLE             (1 << WKUP_EN_SHIFT)
+#define WKUP_DISABLE            (0 << WKUP_EN_SHIFT)
+#define WKUP_ON_LEVEL           (1 << WKUP_LVL_EN_SHIFT)
+#define WKUP_ON_EDGE            (0 << WKUP_LVL_EN_SHIFT)
+#define WKUP_LEVEL_LOW          (0 << WKUP_LVL_POL_SHIFT)
+#define WKUP_LEVEL_HIGH         (1 << WKUP_LVL_POL_SHIFT)
+
 /* Only these macros are expected be used directly in device tree files */
 #define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
 #define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
@@ -53,6 +82,10 @@
 #define PIN_DEBOUNCE_CONF5	(5 << DEBOUNCE_SHIFT)
 #define PIN_DEBOUNCE_CONF6	(6 << DEBOUNCE_SHIFT)
 
+#define PIN_DRIVE_STRENGTH_NOMINAL      (0 << DRV_STR_SHIFT)
+#define PIN_DRIVE_STRENGTH_SLOW         (1 << DRV_STR_SHIFT)
+#define PIN_DRIVE_STRENGTH_FAST         (2 << DRV_STR_SHIFT)
+
 #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
 #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
 #define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
@@ -65,6 +98,18 @@
 #define PIN_DS_PULLUD_DISABLE		(1 << DS_PULLUD_EN_SHIFT)
 #define PIN_DS_PULL_DOWN		(0 << DS_PULLTYPE_SEL_SHIFT)
 #define PIN_DS_PULL_UP			(1 << DS_PULLTYPE_SEL_SHIFT)
+#define PIN_DS_ISO_BYPASS               (1 << ISO_BYPASS_EN_SHIFT)
+#define PIN_DS_ISO_BYPASS_DISABLE       (0 << ISO_BYPASS_EN_SHIFT)
+
+#define PIN_DS_OUTPUT_LOW               (DS_INPUT_DISABLE | DS_OUT_VALUE_ZERO)
+#define PIN_DS_OUTPUT_HIGH              (DS_INPUT_DISABLE | DS_OUT_VALUE_ONE)
+#define PIN_DS_INPUT                    (DS_INPUT_EN | DS_PULL_DISABLE)
+#define PIN_DS_INPUT_PULLUP             (DS_INPUT_EN | DS_PULL_UP)
+#define PIN_DS_INPUT_PULLDOWN           (DS_INPUT_EN | DS_PULL_DOWN)
+
+#define PIN_WKUP_EN_LEVEL_LOW           (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_LOW)
+#define PIN_WKUP_EN_LEVEL_HIGH          (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_HIGH)
+#define PIN_WKUP_EN                     (WKUP_ENABLE | WKUP_ON_EDGE)
 
 /* Default mux configuration for gpio-ranges to use with pinctrl */
 #define PIN_GPIO_RANGE_IOPAD	(PIN_INPUT | 7)
Signature · 1 line
2.34.1
Reviewed-by on v5 3/4
#7 lore raw

Re: [PATCH v5 3/4] arm64: dts: ti: k3-pinctrl: Add the remaining macros

Hi Akash,

Quoted 4 lines · Akashdeep Kaur

Add the drive strength, schmitt trigger enable macros to pinctrl file. Add the missing macros for DeepSleep configuration control referenced from "Table 14-6172. Description Of The Pad Configuration Register Bits" in AM625 TRM[0].

Isn't what you're really referencing the AM62P TRM ? Small correction, perhaps it can be fixed up while applying?

Quoted 8 lines

Add some DeepSleep macros to provide combinations that can be used directly in device tree files example PIN_DS_OUTPUT_LOW that configures pin to be output and also sets its value to 0.

[0] https://www.ti.com/lit/pdf/SPRUJ83

---

[...]

Signature · 3 lines
Best regards,
Dhruva Gole
Texas Instruments Incorporated
#8 lore raw

Re: [PATCH v5 3/4] arm64: dts: ti: k3-pinctrl: Add the remaining macros

In reply to Akashdeep Kaur
Quoted 3 lines · Akashdeep Kaur

Add the drive strength, schmitt trigger enable macros to pinctrl file. Add the missing macros for DeepSleep configuration control referenced from "Table 14-6172. Description Of The Pad Configuration Register Bits"

The Table number should be 14-8769 for the AM62P TRM.

Quoted 1 line

in AM625 TRM[0].

You should reference both the AM62X and AM62P TRMs because in the AM62P TRM the ISO_OVERRIDE_EN bit is reserved, whereas in the AM62X TRM it is defined.

Quoted 46 lines

Add some DeepSleep macros to provide combinations that can be used directly in device tree files example PIN_DS_OUTPUT_LOW that configures pin to be output and also sets its value to 0.

[0] https://www.ti.com/lit/pdf/SPRUJ83

---
  arch/arm64/boot/dts/ti/k3-pinctrl.h | 47 ++++++++++++++++++++++++++++-
  1 file changed, 46 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +7 -1
index c0f09be8d3f9..8ce37ace94c9 100644
@@ -3,15 +3,20 @@
   * This header provides constants for pinctrl bindings for TI's K3 SoC
   * family.
   *
- * Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2018-2025 Texas Instruments Incorporated - https://www.ti.com/
   */
  #ifndef DTS_ARM64_TI_K3_PINCTRL_H
  #define DTS_ARM64_TI_K3_PINCTRL_H
 
+#define WKUP_LVL_EN_SHIFT       (7)
+#define WKUP_LVL_POL_SHIFT      (8)
  #define ST_EN_SHIFT		(14)
  #define PULLUDEN_SHIFT		(16)
  #define PULLTYPESEL_SHIFT	(17)
  #define RXACTIVE_SHIFT		(18)
+#define DRV_STR_SHIFT           (19)
+#define ISO_OVERRIDE_EN_SHIFT   (22)
+#define ISO_BYPASS_EN_SHIFT     (23)
  #define DEBOUNCE_SHIFT		(11)
  #define FORCE_DS_EN_SHIFT	(15)
  #define DS_EN_SHIFT		(24)
@@ -19,6 +24,7 @@
  #define DS_OUT_VAL_SHIFT	(26)
  #define DS_PULLUD_EN_SHIFT	(27)
  #define DS_PULLTYPE_SEL_SHIFT	(28)
+#define WKUP_EN_SHIFT           (29)
 
  /* Schmitt trigger configuration */
  #define ST_DISABLE		(0 << ST_EN_SHIFT)

arch/arm64/boot/dts/ti/k3-pinctrl.h line 43

Quoted 5 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -0
@@ -33,6 +39,29 @@
  #define INPUT_EN		(1 << RXACTIVE_SHIFT)
  #define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
 
+#define DS_PULL_DISABLE         (1 << DS_PULLUD_EN_SHIFT)
+#define DS_PULL_ENABLE          (0 << DS_PULLUD_EN_SHIFT)

nit: IMO either keep the format of these macros to ENABLE or EN unless there is a good reason to change the format.

arch/arm64/boot/dts/ti/k3-pinctrl.h line 49

Quoted 6 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +6 -0
+
+#define DS_PULL_UP              (1 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+#define DS_PULL_DOWN            (0 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+
+#define DS_STATE_EN             (1 << DS_EN_SHIFT)
+#define DS_STATE_DISABLE        (0 << DS_EN_SHIFT)

nit: Is there anyway this could be more descriptive? Like DS_IO_OVERRIDE_EN or DS_OVERRIDE_CTRL. It is hard to tell what these bits do unless you look at the TRM, whereas the other macros are easier to deduce their function.

arch/arm64/boot/dts/ti/k3-pinctrl.h line 52

Quoted 3 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +3 -0
+
+#define DS_INPUT_EN             (1 << DS_OUT_DIS_SHIFT | DS_STATE_EN)
+#define DS_INPUT_DISABLE        (0 << DS_OUT_DIS_SHIFT | DS_STATE_EN)

By looking at the TRM it looks like this disables or enables output, not input. Shifting a 1 to DS_OUT_DIS_SHIFT should disable output.

Quoted 16 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +12 -0
+
+#define DS_OUT_VALUE_ZERO       (0 << DS_OUT_VAL_SHIFT)
+#define DS_OUT_VALUE_ONE        (1 << DS_OUT_VAL_SHIFT)
+
+/* Configuration to enable wake-up on pin activity */
+#define WKUP_ENABLE             (1 << WKUP_EN_SHIFT)
+#define WKUP_DISABLE            (0 << WKUP_EN_SHIFT)
+#define WKUP_ON_LEVEL           (1 << WKUP_LVL_EN_SHIFT)
+#define WKUP_ON_EDGE            (0 << WKUP_LVL_EN_SHIFT)
+#define WKUP_LEVEL_LOW          (0 << WKUP_LVL_POL_SHIFT)
+#define WKUP_LEVEL_HIGH         (1 << WKUP_LVL_POL_SHIFT)
+
  /* Only these macros are expected be used directly in device tree files */
  #define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
  #define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)

arch/arm64/boot/dts/ti/k3-pinctrl.h line 86

Quoted 5 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -0
@@ -53,6 +82,10 @@
  #define PIN_DEBOUNCE_CONF5	(5 << DEBOUNCE_SHIFT)
  #define PIN_DEBOUNCE_CONF6	(6 << DEBOUNCE_SHIFT)
 
+#define PIN_DRIVE_STRENGTH_NOMINAL      (0 << DRV_STR_SHIFT)
+#define PIN_DRIVE_STRENGTH_SLOW         (1 << DRV_STR_SHIFT)

DRV_STR value of 1 is reserved in both AM62X and AM62P TRMs

Quoted 14 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +7 -0
+#define PIN_DRIVE_STRENGTH_FAST         (2 << DRV_STR_SHIFT)
+
  #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
  #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
  #define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
@@ -65,6 +98,18 @@
  #define PIN_DS_PULLUD_DISABLE		(1 << DS_PULLUD_EN_SHIFT)
  #define PIN_DS_PULL_DOWN		(0 << DS_PULLTYPE_SEL_SHIFT)
  #define PIN_DS_PULL_UP			(1 << DS_PULLTYPE_SEL_SHIFT)
+#define PIN_DS_ISO_BYPASS               (1 << ISO_BYPASS_EN_SHIFT)
+#define PIN_DS_ISO_BYPASS_DISABLE       (0 << ISO_BYPASS_EN_SHIFT)
+
+#define PIN_DS_OUTPUT_LOW               (DS_INPUT_DISABLE | DS_OUT_VALUE_ZERO)
+#define PIN_DS_OUTPUT_HIGH              (DS_INPUT_DISABLE | DS_OUT_VALUE_ONE)

arch/arm64/boot/dts/ti/k3-pinctrl.h line 115

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +7 -0
+#define PIN_DS_INPUT                    (DS_INPUT_EN | DS_PULL_DISABLE)
+#define PIN_DS_INPUT_PULLUP             (DS_INPUT_EN | DS_PULL_UP)
+#define PIN_DS_INPUT_PULLDOWN           (DS_INPUT_EN | DS_PULL_DOWN)
+
+#define PIN_WKUP_EN_LEVEL_LOW           (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_LOW)
+#define PIN_WKUP_EN_LEVEL_HIGH          (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_HIGH)
+#define PIN_WKUP_EN                     (WKUP_ENABLE | WKUP_ON_EDGE)
 
  /* Default mux configuration for gpio-ranges to use with pinctrl */
  #define PIN_GPIO_RANGE_IOPAD	(PIN_INPUT | 7)

Best,
Kendall

#9 lore raw

Re: [PATCH v5 3/4] arm64: dts: ti: k3-pinctrl: Add the remaining macros

Hi Kendall.

Quoted 6 lines · Kendall
Quoted 3 lines · Akashdeep Kaur

Add the drive strength, schmitt trigger enable macros to pinctrl file. Add the missing macros for DeepSleep configuration control referenced from "Table 14-6172. Description Of The Pad Configuration Register Bits"

The Table number should be 14-8769 for the AM62P TRM.

Yes, already updating that.

Quoted 6 lines
Quoted 2 lines

in AM625 TRM[0].

You should reference both the AM62X and AM62P TRMs because in the AM62P TRM the ISO_OVERRIDE_EN bit is reserved, whereas in the AM62X TRM it is defined.

That is TRM documentation bug. The functionality is same for both the SoCs

Quoted 50 lines
Quoted 50 lines

Add some DeepSleep macros to provide combinations that can be used directly in device tree files example PIN_DS_OUTPUT_LOW that configures pin to be output and also sets its value to 0.

[0] https://www.ti.com/lit/pdf/SPRUJ83

---
   arch/arm64/boot/dts/ti/k3-pinctrl.h | 47 ++++++++++++++++++++++++++++-
   1 file changed, 46 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +7 -1
index c0f09be8d3f9..8ce37ace94c9 100644
@@ -3,15 +3,20 @@
    * This header provides constants for pinctrl bindings for TI's K3 SoC
    * family.
    *
- * Copyright (C) 2018-2024 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2018-2025 Texas Instruments Incorporated - https://www.ti.com/
    */
   #ifndef DTS_ARM64_TI_K3_PINCTRL_H
   #define DTS_ARM64_TI_K3_PINCTRL_H
 
+#define WKUP_LVL_EN_SHIFT       (7)
+#define WKUP_LVL_POL_SHIFT      (8)
   #define ST_EN_SHIFT		(14)
   #define PULLUDEN_SHIFT		(16)
   #define PULLTYPESEL_SHIFT	(17)
   #define RXACTIVE_SHIFT		(18)
+#define DRV_STR_SHIFT           (19)
+#define ISO_OVERRIDE_EN_SHIFT   (22)
+#define ISO_BYPASS_EN_SHIFT     (23)
   #define DEBOUNCE_SHIFT		(11)
   #define FORCE_DS_EN_SHIFT	(15)
   #define DS_EN_SHIFT		(24)
@@ -19,6 +24,7 @@
   #define DS_OUT_VAL_SHIFT	(26)
   #define DS_PULLUD_EN_SHIFT	(27)
   #define DS_PULLTYPE_SEL_SHIFT	(28)
+#define WKUP_EN_SHIFT           (29)
 
   /* Schmitt trigger configuration */
   #define ST_DISABLE		(0 << ST_EN_SHIFT)
@@ -33,6 +39,29 @@
   #define INPUT_EN		(1 << RXACTIVE_SHIFT)
   #define INPUT_DISABLE		(0 << RXACTIVE_SHIFT)
 
Quoted 5 lines

arch/arm64/boot/dts/ti/k3-pinctrl.h line 43

Quoted 2 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -0
+#define DS_PULL_DISABLE         (1 << DS_PULLUD_EN_SHIFT)
+#define DS_PULL_ENABLE          (0 << DS_PULLUD_EN_SHIFT)

nit: IMO either keep the format of these macros to ENABLE or EN unless there is a good reason to change the format.

In the entire file, both _EN and _ENABLE are used. It should be okay. Thanks!

Quoted 13 lines

arch/arm64/boot/dts/ti/k3-pinctrl.h line 49

Quoted 7 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +6 -0
+
+#define DS_PULL_UP              (1 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+#define DS_PULL_DOWN            (0 << DS_PULLTYPE_SEL_SHIFT | DS_PULL_ENABLE)
+
+#define DS_STATE_EN             (1 << DS_EN_SHIFT)
+#define DS_STATE_DISABLE        (0 << DS_EN_SHIFT)

nit: Is there anyway this could be more descriptive? Like DS_IO_OVERRIDE_EN or DS_OVERRIDE_CTRL. It is hard to tell what these bits do unless you look at the TRM, whereas the other macros are easier to deduce their function.

Quoted 6 lines

arch/arm64/boot/dts/ti/k3-pinctrl.h line 52

Quoted 3 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +3 -0
+
+#define DS_INPUT_EN             (1 << DS_OUT_DIS_SHIFT | DS_STATE_EN)
+#define DS_INPUT_DISABLE        (0 << DS_OUT_DIS_SHIFT | DS_STATE_EN)

By looking at the TRM it looks like this disables or enables output, not input. Shifting a 1 to DS_OUT_DIS_SHIFT should disable output.

Yes, shifting to one should disable the output, hence enable the input. (A pin can only act as output or input and this bit is used to control that)

Quoted 20 lines
Quoted 20 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +12 -0
+
+#define DS_OUT_VALUE_ZERO       (0 << DS_OUT_VAL_SHIFT)
+#define DS_OUT_VALUE_ONE        (1 << DS_OUT_VAL_SHIFT)
+
+/* Configuration to enable wake-up on pin activity */
+#define WKUP_ENABLE             (1 << WKUP_EN_SHIFT)
+#define WKUP_DISABLE            (0 << WKUP_EN_SHIFT)
+#define WKUP_ON_LEVEL           (1 << WKUP_LVL_EN_SHIFT)
+#define WKUP_ON_EDGE            (0 << WKUP_LVL_EN_SHIFT)
+#define WKUP_LEVEL_LOW          (0 << WKUP_LVL_POL_SHIFT)
+#define WKUP_LEVEL_HIGH         (1 << WKUP_LVL_POL_SHIFT)
+
   /* Only these macros are expected be used directly in device tree files */
   #define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
   #define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
@@ -53,6 +82,10 @@
   #define PIN_DEBOUNCE_CONF5	(5 << DEBOUNCE_SHIFT)
   #define PIN_DEBOUNCE_CONF6	(6 << DEBOUNCE_SHIFT)
 
Quoted 4 lines

arch/arm64/boot/dts/ti/k3-pinctrl.h line 86

Quoted 2 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -0
+#define PIN_DRIVE_STRENGTH_NOMINAL      (0 << DRV_STR_SHIFT)
+#define PIN_DRIVE_STRENGTH_SLOW         (1 << DRV_STR_SHIFT)

DRV_STR value of 1 is reserved in both AM62X and AM62P TRMs

This is a common file. We need to define macros that can be used by all SoCs.

Quoted 23 lines
Quoted 23 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +14 -0
+#define PIN_DRIVE_STRENGTH_FAST         (2 << DRV_STR_SHIFT)
+
   #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
   #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
   #define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
@@ -65,6 +98,18 @@
   #define PIN_DS_PULLUD_DISABLE		(1 << DS_PULLUD_EN_SHIFT)
   #define PIN_DS_PULL_DOWN		(0 << DS_PULLTYPE_SEL_SHIFT)
   #define PIN_DS_PULL_UP			(1 << DS_PULLTYPE_SEL_SHIFT)
+#define PIN_DS_ISO_BYPASS               (1 << ISO_BYPASS_EN_SHIFT)
+#define PIN_DS_ISO_BYPASS_DISABLE       (0 << ISO_BYPASS_EN_SHIFT)
+
+#define PIN_DS_OUTPUT_LOW               (DS_INPUT_DISABLE | DS_OUT_VALUE_ZERO)
+#define PIN_DS_OUTPUT_HIGH              (DS_INPUT_DISABLE | DS_OUT_VALUE_ONE)
+#define PIN_DS_INPUT                    (DS_INPUT_EN | DS_PULL_DISABLE)
+#define PIN_DS_INPUT_PULLUP             (DS_INPUT_EN | DS_PULL_UP)
+#define PIN_DS_INPUT_PULLDOWN           (DS_INPUT_EN | DS_PULL_DOWN)
+
+#define PIN_WKUP_EN_LEVEL_LOW           (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_LOW)
+#define PIN_WKUP_EN_LEVEL_HIGH          (WKUP_ENABLE | WKUP_ON_LEVEL | WKUP_LEVEL_HIGH)
+#define PIN_WKUP_EN                     (WKUP_ENABLE | WKUP_ON_EDGE)
 
Quoted 6 lines

arch/arm64/boot/dts/ti/k3-pinctrl.h line 115

Quoted 2 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +0 -0
   /* Default mux configuration for gpio-ranges to use with pinctrl */
   #define PIN_GPIO_RANGE_IOPAD	(PIN_INPUT | 7)

Best,
Kendall

Regards,
Akashdeep Kaur

#10 lore raw

PATCH v5 4/4 arm64: dts: ti: k3-pinctrl: Fix the bug in existing macros

In reply to Akashdeep Kaur

Currently, DS_IO_OVERRIDE_EN_SHIFT macro is not defined anywhere but used for defining other macro.
Replace this undefined macro with valid macro. Rename the existing macro to reflect the actual behavior.

---
 arch/arm64/boot/dts/ti/k3-pinctrl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -2
index 8ce37ace94c9..e46f7bf52701 100644
@@ -88,8 +88,8 @@
 
 #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
 #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_ENABLE	(1 << DS_IO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_DISABLE     (0 << ISO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_ENABLE      (1 << ISO_OVERRIDE_EN_SHIFT)
 #define PIN_DS_OUT_ENABLE		(0 << DS_OUT_DIS_SHIFT)
 #define PIN_DS_OUT_DISABLE		(1 << DS_OUT_DIS_SHIFT)
 #define PIN_DS_OUT_VALUE_ZERO		(0 << DS_OUT_VAL_SHIFT)
Signature · 1 line
2.34.1
Reviewed-by on v5 4/4
#11 lore raw

Re: [PATCH v5 4/4] arm64: dts: ti: k3-pinctrl: Fix the bug in existing macros

Quoted 15 lines · Akashdeep Kaur

Currently, DS_IO_OVERRIDE_EN_SHIFT macro is not defined anywhere but used for defining other macro.
Replace this undefined macro with valid macro. Rename the existing macro to reflect the actual behavior.

---
 arch/arm64/boot/dts/ti/k3-pinctrl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +0 -0
index 8ce37ace94c9..e46f7bf52701 100644

arch/arm64/boot/dts/ti/k3-pinctrl.h line 92

Quoted 7 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -2
@@ -88,8 +88,8 @@
 
 #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
 #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_ENABLE	(1 << DS_IO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_DISABLE     (0 << ISO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_ENABLE      (1 << ISO_OVERRIDE_EN_SHIFT)
Signature · 3 lines
Best regards,
Dhruva Gole
Texas Instruments Incorporated
Reviewed-by on v5 4/4
#12 lore raw

Re: [PATCH v5 4/4] arm64: dts: ti: k3-pinctrl: Fix the bug in existing macros

In reply to Akashdeep Kaur
Quoted 15 lines · Akashdeep Kaur

Currently, DS_IO_OVERRIDE_EN_SHIFT macro is not defined anywhere but used for defining other macro.
Replace this undefined macro with valid macro. Rename the existing macro to reflect the actual behavior.

---
  arch/arm64/boot/dts/ti/k3-pinctrl.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-pinctrl.h +0 -0
index 8ce37ace94c9..e46f7bf52701 100644

arch/arm64/boot/dts/ti/k3-pinctrl.h line 95

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-pinctrl.h +2 -2
@@ -88,8 +88,8 @@
 
  #define PIN_DS_FORCE_DISABLE		(0 << FORCE_DS_EN_SHIFT)
  #define PIN_DS_FORCE_ENABLE		(1 << FORCE_DS_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_DISABLE	(0 << DS_IO_OVERRIDE_EN_SHIFT)
-#define PIN_DS_IO_OVERRIDE_ENABLE	(1 << DS_IO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_DISABLE     (0 << ISO_OVERRIDE_EN_SHIFT)
+#define PIN_DS_ISO_OVERRIDE_ENABLE      (1 << ISO_OVERRIDE_EN_SHIFT)
  #define PIN_DS_OUT_ENABLE		(0 << DS_OUT_DIS_SHIFT)
  #define PIN_DS_OUT_DISABLE		(1 << DS_OUT_DIS_SHIFT)
  #define PIN_DS_OUT_VALUE_ZERO		(0 << DS_OUT_VAL_SHIFT)