Skip to contentSkip to conversation

arm64: dts: ti: Cleanup mix of "okay" and "disabled"

PATCH Applied Nishanth Menon 2 participants 8 messages Nov 13, 2020 – Nov 17, 2020

Subsystems (2)
lore
Share & tools
lore

Nishanth Menon

author maintainer
#0 lore raw

v4 cover arm64: dts: ti: Cleanup mix of "okay" and "disabled"

Hi,

V4 changes:
- drops the fixes tags (as this is not strictly a stable fix)

Repost. older versions v3[3] v2[2] v1[1]

Summarising the blurb of the discussion[4] we have had, there are few options one could take when dealing with SoC dtsi and board dts:

a. SoC dtsi provide nodes as a super-set default (aka enabled) state and
to prevent messy board files, when more boards are added per SoC, we optimize and disable commonly un-used nodes in board-common.dtsi
b. SoC dtsi disables all hardware dependent nodes by default and board
dts files enable nodes based on a need basis.
c. Subjectively pick and choose which nodes we will disable by default
in SoC dtsi and over the years we can optimize things and change default state depending on the need.

While there are pros and cons on each of these approaches, the right thing to do will be to stick with device tree default standards and work within those established rules. So, we choose to go with option (a).

NOTE: There is a known risk of "omission" that new board dts developers might miss reviewing both the board schematics in addition to all the dt nodes of the SoC when setting appropriate nodes status to "disable" or "reserved" in the board dts. This can expose issues in drivers which may not anticipate an incomplete node(example: missing appropriate board properties) being in "okay" state. These cases are considered as bugs and need to be fixed in the drivers as and when identified.

Nishanth Menon (5):
arm64: dts: ti: k3-am65*: Cleanup disabled nodes at SoC dtsi level
arm64: dts: ti: k3-j721e*: Cleanup disabled nodes at SoC dtsi level
arm64: dts: ti: am65/j721e: Fix up un-necessary status set to "okay"
for crypto
arm64: dts: ti: k3-am654-base-board: Fix up un-necessary status set to
"okay" for USB
arm64: dts: ti: am65/j721e/j7200: Mark firmware used uart as
"reserved"

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi      |  9 ----
 .../arm64/boot/dts/ti/k3-am654-base-board.dts | 26 ++++++----
 .../dts/ti/k3-j7200-common-proc-board.dts     |  4 +-
 .../dts/ti/k3-j721e-common-proc-board.dts     | 50 ++++++++++++++++++-
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi     | 28 -----------
 5 files changed, 67 insertions(+), 50 deletions(-)

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[4] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Signature · 1 line
2.29.2
author maintainer
#1 lore raw

PATCH v4 1/5 arm64: dts: ti: k3-am65*: Cleanup disabled nodes at SoC dtsi level

The device tree standard states that when the status property is not present under a node, the okay value is assumed. There are many reasons for doing the same, the number of strings in the device tree, default power management functionality, etc. are a few of the reasons.

In general, after a few rounds of discussions [1] there are few options one could take when dealing with SoC dtsi and board dts

a. SoC dtsi provide nodes as a super-set default (aka enabled) state and
to prevent messy board files, when more boards are added per SoC, we optimize and disable commonly un-used nodes in board-common.dtsi
b. SoC dtsi disables all hardware dependent nodes by default and board
dts files enable nodes based on a need basis.
c. Subjectively pick and choose which nodes we will disable by default
in SoC dtsi and over the years we can optimize things and change default state depending on the need.

While there are pros and cons on each of these approaches, the right thing to do will be to stick with device tree default standards and work within those established rules. So, we choose to go with option (a).

Lets cleanup defaults of am654 SoC dtsi before this gets more harder to cleanup later on and new SoCs are added.

The dtb generated is identical with the patch and it is just cleanup to ensure we have a clean usage model

NOTE: There is a known risk of omission that new board dts developers might miss reviewing both the board schematics in addition to all the DT nodes of the SoC when setting appropriate nodes status to disable or reserved in the board dts. This can expose issues in drivers that may not anticipate an incomplete node (example: missing appropriate board properties) being in an "okay" state. These cases are considered bugs and need to be fixed in the drivers as and when identified.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

---
Change in v4: Dropped Fixes

v3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi       |  8 --------
 arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -8
index a664c91675de..c842b9803f2d 100644
@@ -769,8 +769,6 @@ mcasp0: mcasp@2b00000 {
 		clocks = <&k3_clks 104 0>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 104 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp1: mcasp@2b10000 {
@@ -788,8 +786,6 @@ mcasp1: mcasp@2b10000 {
 		clocks = <&k3_clks 105 0>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 105 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp2: mcasp@2b20000 {
@@ -807,8 +803,6 @@ mcasp2: mcasp@2b20000 {
 		clocks = <&k3_clks 106 0>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 106 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	cal: cal@6f03000 {
@@ -864,8 +858,6 @@ dss: dss@4a00000 {
 
 		interrupts = <GIC_SPI 166 IRQ_TYPE_EDGE_RISING>;
 
-		status = "disabled";
-
 		dma-coherent;
 
 		dss_ports: ports {
arch/arm64/boot/dts/ti/k3-am654-base-board.dts +16 -0
index 17f3a85360e6..0dec781982b1 100644
@@ -529,3 +529,19 @@ &cpsw_port1 {
 	phy-mode = "rgmii-rxid";
 	phy-handle = <&phy0>;
 };
+
+&mcasp0 {
+	status = "disabled";
+};
+
+&mcasp1 {
+	status = "disabled";
+};
+
+&mcasp2 {
+	status = "disabled";
+};
+
+&dss {
+	status = "disabled";
+};
Signature · 1 line
2.29.2
author maintainer
#2 lore raw

PATCH v4 2/5 arm64: dts: ti: k3-j721e*: Cleanup disabled nodes at SoC dtsi level

In reply to Nishanth Menon

The device tree standard states that when the status property is not present under a node, the okay value is assumed. There are many reasons for doing the same, the number of strings in the device tree, default power management functionality, etc. are a few of the reasons.

In general, after a few rounds of discussions [1] there are few options one could take when dealing with SoC dtsi and board dts

a. SoC dtsi provide nodes as a super-set default (aka enabled) state and
to prevent messy board files, when more boards are added per SoC, we optimize and disable commonly un-used nodes in board-common.dtsi
b. SoC dtsi disables all hardware dependent nodes by default and board
dts files enable nodes based on a need basis.
c. Subjectively pick and choose which nodes we will disable by default
in SoC dtsi and over the years we can optimize things and change default state depending on the need.

While there are pros and cons on each of these approaches, the right thing to do will be to stick with device tree default standards and work within those established rules. So, we choose to go with option (a).

Lets cleanup defaults of j721e SoC dtsi before this gets more harder to cleanup later on and new SoCs are added.

The only functional difference between the dtb generated is status='okay' is no longer necessary for mcasp10 and depends on the default state.

NOTE: There is a known risk of omission that new board dts developers might miss reviewing both the board schematics in addition to all the DT nodes of the SoC when setting appropriate nodes status to disable or reserved in the board dts. This can expose issues in drivers that may not anticipate an incomplete node (example: missing appropriate board properties) being in an "okay" state. These cases are considered bugs and need to be fixed in the drivers as and when identified.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

---
Change in v4: Dropped Fixes

v3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 .../dts/ti/k3-j721e-common-proc-board.dts     | 48 ++++++++++++++++++-
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi     | 26 ----------
 2 files changed, 47 insertions(+), 27 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +47 -1
index 52e121155563..9416528caa8a 100644
@@ -540,6 +540,46 @@ &dss {
 				 <&k3_clks 152 18>;	/* PLL23_HSDIV0 */
 };
 
+&mcasp0 {
+	status = "disabled";
+};
+
+&mcasp1 {
+	status = "disabled";
+};
+
+&mcasp2 {
+	status = "disabled";
+};
+
+&mcasp3 {
+	status = "disabled";
+};
+
+&mcasp4 {
+	status = "disabled";
+};
+
+&mcasp5 {
+	status = "disabled";
+};
+
+&mcasp6 {
+	status = "disabled";
+};
+
+&mcasp7 {
+	status = "disabled";
+};
+
+&mcasp8 {
+	status = "disabled";
+};
+
+&mcasp9 {
+	status = "disabled";
+};
+
 &mcasp10 {
 	#sound-dai-cells = <0>;
 
@@ -556,8 +596,10 @@ &mcasp10 {
 	>;
 	tx-num-evt = <0>;
 	rx-num-evt = <0>;
+};
 
-	status = "okay";
+&mcasp11 {
+	status = "disabled";
 };
 
 &serdes0 {
@@ -639,3 +681,7 @@ &pcie3_rc {
 &pcie3_ep {
 	status = "disabled";
 };
+
+&dss {
+	status = "disabled";
+};
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +0 -26
index 620e69e42974..137966c6be1f 100644
@@ -1327,8 +1327,6 @@ dss: dss@4a00000 {
 				  "common_s1",
 				  "common_s2";
 
-		status = "disabled";
-
 		dss_ports: ports {
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -1350,8 +1348,6 @@ mcasp0: mcasp@2b00000 {
 		clocks = <&k3_clks 174 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 174 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp1: mcasp@2b10000 {
@@ -1369,8 +1365,6 @@ mcasp1: mcasp@2b10000 {
 		clocks = <&k3_clks 175 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 175 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp2: mcasp@2b20000 {
@@ -1388,8 +1382,6 @@ mcasp2: mcasp@2b20000 {
 		clocks = <&k3_clks 176 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 176 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp3: mcasp@2b30000 {
@@ -1407,8 +1399,6 @@ mcasp3: mcasp@2b30000 {
 		clocks = <&k3_clks 177 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 177 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp4: mcasp@2b40000 {
@@ -1426,8 +1416,6 @@ mcasp4: mcasp@2b40000 {
 		clocks = <&k3_clks 178 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp5: mcasp@2b50000 {
@@ -1445,8 +1433,6 @@ mcasp5: mcasp@2b50000 {
 		clocks = <&k3_clks 179 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp6: mcasp@2b60000 {
@@ -1464,8 +1450,6 @@ mcasp6: mcasp@2b60000 {
 		clocks = <&k3_clks 180 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 180 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp7: mcasp@2b70000 {
@@ -1483,8 +1467,6 @@ mcasp7: mcasp@2b70000 {
 		clocks = <&k3_clks 181 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 181 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp8: mcasp@2b80000 {
@@ -1502,8 +1484,6 @@ mcasp8: mcasp@2b80000 {
 		clocks = <&k3_clks 182 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 182 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp9: mcasp@2b90000 {
@@ -1521,8 +1501,6 @@ mcasp9: mcasp@2b90000 {
 		clocks = <&k3_clks 183 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 183 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp10: mcasp@2ba0000 {
@@ -1540,8 +1518,6 @@ mcasp10: mcasp@2ba0000 {
 		clocks = <&k3_clks 184 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 184 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	mcasp11: mcasp@2bb0000 {
@@ -1559,8 +1535,6 @@ mcasp11: mcasp@2bb0000 {
 		clocks = <&k3_clks 185 1>;
 		clock-names = "fck";
 		power-domains = <&k3_pds 185 TI_SCI_PD_EXCLUSIVE>;
-
-		status = "disabled";
 	};
 
 	watchdog0: watchdog@2200000 {
Signature · 1 line
2.29.2
author maintainer
#3 lore raw

PATCH v4 3/5 arm64: dts: ti: am65/j721e: Fix up un-necessary status set to "okay" for crypto

In reply to Nishanth Menon

The default state of a device tree node is "okay". There is no specific use of explicitly adding status = "okay" in the SoC dtsi.

---
Change in v4: Dropped Fixes

V3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi  | 1 -
 arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 2 --
 2 files changed, 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -1
index c842b9803f2d..116818912ba2 100644
@@ -119,7 +119,6 @@ crypto: crypto@4e00000 {
 		#address-cells = <2>;
 		#size-cells = <2>;
 		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
-		status = "okay";
 
 		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
 				<&main_udmap 0x4001>;
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +0 -2
index 137966c6be1f..19e602afdb05 100644
@@ -345,8 +345,6 @@ main_crypto: crypto@4e00000 {
 		#size-cells = <2>;
 		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
 
-		status = "okay";
-
 		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
 				<&main_udmap 0x4001>;
 		dma-names = "tx", "rx1", "rx2";
Signature · 1 line
2.29.2
Reviewed-by on v4 3/5
#4 lore raw

Re: [PATCH V4 3/5] arm64: dts: ti: am65/j721e: Fix up un-necessary status set to "okay" for crypto

Quoted 2 lines · Nishanth Menon

The default state of a device tree node is "okay". There is no specific use of explicitly adding status = "okay" in the SoC dtsi.

Quoted 42 lines

---
Change in v4: Dropped Fixes

V3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

  arch/arm64/boot/dts/ti/k3-am65-main.dtsi  | 1 -
  arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 2 --
  2 files changed, 3 deletions(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -1
index c842b9803f2d..116818912ba2 100644
@@ -119,7 +119,6 @@ crypto: crypto@4e00000 {
  		#address-cells = <2>;
  		#size-cells = <2>;
  		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
-		status = "okay";
 
  		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
  				<&main_udmap 0x4001>;
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +0 -2
index 137966c6be1f..19e602afdb05 100644
@@ -345,8 +345,6 @@ main_crypto: crypto@4e00000 {
  		#size-cells = <2>;
  		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
 
-		status = "okay";
-
  		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
  				<&main_udmap 0x4001>;
  		dma-names = "tx", "rx1", "rx2";
author maintainer
#5 lore raw

PATCH v4 4/5 arm64: dts: ti: k3-am654-base-board: Fix up un-necessary status set to "okay" for USB

In reply to Nishanth Menon

The default state of a device tree node is "okay". There is no specific use of explicitly adding status = "okay" in the board dts.

---
Change in v4: Dropped Fixes

v3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
v2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
v1: https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm64/boot/dts/ti/k3-am654-base-board.dts | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/ti/k3-am654-base-board.dts +0 -8
index 0dec781982b1..c8c9aa98b561 100644
@@ -356,14 +356,6 @@ &sdhci1 {
 	disable-wp;
 };
 
-&dwc3_1 {
-	status = "okay";
-};
-
-&usb1_phy {
-	status = "okay";
-};
-
 &usb1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&usb1_pins_default>;
Signature · 1 line
2.29.2
author maintainer
#6 lore raw

PATCH v4 5/5 arm64: dts: ti: am65/j721e/j7200: Mark firmware used uart as "reserved"

In reply to Nishanth Menon

Follow the device tree standards that states to set the status="reserved" if an device is operational, but used by a non-linux firmware in the system.

---
v4: no change

v3: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V2: https://lore.kernel.org/linux-arm-kernel/[email protected]/
V1: didnot exist

 arch/arm64/boot/dts/ti/k3-am654-base-board.dts        | 2 +-
 arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts | 4 ++--
 arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-am654-base-board.dts +1 -1
index c8c9aa98b561..fe3043943906 100644
@@ -242,7 +242,7 @@ AM65X_IOPAD(0x0010, PIN_INPUT, 0) /* (D21) ECAP0_IN_APWM_OUT */
 
 &wkup_uart0 {
 	/* Wakeup UART is used by System firmware */
-	status = "disabled";
+	status = "reserved";
 };
 
 &main_uart0 {
arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts +2 -2
index 7d2ff1c3b50f..96fa26365248 100644
@@ -79,7 +79,7 @@ J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */
 
 &wkup_uart0 {
 	/* Wakeup UART is used by System firmware */
-	status = "disabled";
+	status = "reserved";
 };
 
 &main_uart0 {
@@ -89,7 +89,7 @@ &main_uart0 {
 
 &main_uart2 {
 	/* MAIN UART 2 is used by R5F firmware */
-	status = "disabled";
+	status = "reserved";
 };
 
 &main_uart3 {
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts +1 -1
index 9416528caa8a..5754892f8501 100644
@@ -221,7 +221,7 @@ J721E_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* MCU_MDIO0_MDIO */
 
 &wkup_uart0 {
 	/* Wakeup UART is used by System firmware */
-	status = "disabled";
+	status = "reserved";
 };
 
 &main_uart0 {
Signature · 1 line
2.29.2
author maintainer Applied
#7 lore raw
In reply to Nishanth Menon
Quoted 9 lines · Nishanth Menon

V4 changes:
- drops the fixes tags (as this is not strictly a stable fix)

Repost. older versions v3[3] v2[2] v1[1]

Summarising the blurb of the discussion[4] we have had, there are few options one could take when dealing with SoC dtsi and board dts:

[...]

I have applied this revision to branch ti-k3-dts-next on [1]. Thank you!

[1/5] arm64: dts: ti: k3-am65*: Cleanup disabled nodes at SoC dtsi level

      commit: af03de2b9b908e776c233744b84ce9dbb70dcafb
[2/5] arm64: dts: ti: k3-j721e*: Cleanup disabled nodes at SoC dtsi level
      commit: 5d1bedf252db3ec2becb9f43c55e0f33af1fd7fc
[3/5] arm64: dts: ti: am65/j721e: Fix up un-necessary status set to "okay" for crypto
      commit: bfbf9be725d8effdbb60eb2ece44c06ae87a54de
[4/5] arm64: dts: ti: k3-am654-base-board: Fix up un-necessary status set to "okay" for USB
      commit: 90e6c38848f8e86047e0e758c0725b155e2e349b
[5/5] arm64: dts: ti: am65/j721e/j7200: Mark firmware used uart as "reserved"
      commit: 4cc34aa8a208665aa0362a615deefc3db6a5d7bd

[1] git://git.kernel.org/pub/scm/linux/kernel/git/nmenon/linux.git

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D