Skip to contentSkip to conversation

convert rockchip,dwc3.txt to yaml

PATCH In review Johan Jonker 3 participants 8 messages Apr 1, 2021 – Apr 5, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v6 cover convert rockchip,dwc3.txt to yaml

The conversion of rockchip,dwc3.txt to yaml was added to linux-next, but the necessary changes for rk3399 are still pending.

For rk3399 dwc3 usb the wrapper node for only clocks makes no sense, so that was removed in the YAML example.

Now dtbs_check still generates notifications for the compatibility string in the dts files that doesn't match, because it changed from "rockchip,rk3399-dwc3" to "rockchip,rk3399-dwc3", "snps,dwc3".

The problem is to keep compatible with old device trees. I.e. a device running an older device tree should still work with newer kernels.

Comment by Rob in version 3:
Presumably you are getting lucky here (with link order). The kernel has no logic to decide which driver to bind to if there are 2 matching drivers. If we did, it would probably be the opposite of what you want here as we'd pick the most specific match. This driver should probably bail probe if no dwc3 child node.

Please advise how to move forward with this serie.

Changed V6:
rebase
remove accepted patches from serie

Changed V5:
add select

Changed V4:
removed patch "of-simple: add compatible for rk3328" add patch "of-simple: bail probe if no dwc3 child node"

Changed V3:
remove aclk_usb3_rksoc_axi_perf
remove aclk_usb3

Changed V2:
remove node wrapper

Johan Jonker (3):
usb: dwc3: of-simple: bail probe if no dwc3 child node
arm64: dts: rockchip: restyle rk3399 usbdrd3_0 node
arm64: dts: rockchip: restyle rk3399 usbdrd3_1 node

Wu Liang feng (1):
arm64: dts: rockchip: optimize clks for rk3399 dwc3

 arch/arm64/boot/dts/rockchip/rk3399-ficus.dts      |  4 +-
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts    | 12 +--
 .../boot/dts/rockchip/rk3399-gru-chromebook.dtsi   |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi       |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts | 12 +--
 .../boot/dts/rockchip/rk3399-khadas-edge.dtsi      | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts  | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   |  8 --
 arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts   | 12 +--
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts      |  8 --
 .../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts |  4 -
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi      |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi    | 10 +--
 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dts    |  4 +-
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi   |  8 --
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi  | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           | 86 ++++++++--------------
 .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi     |  4 -
 drivers/usb/dwc3/dwc3-of-simple.c                  |  4 +
 22 files changed, 59 insertions(+), 197 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v6 1/4 usb: dwc3: of-simple: bail probe if no dwc3 child node

For some of the dwc3-of-simple compatible SoCs we don't want to bind this driver to a dwc3 node, but bind that node to the 'snps,dwc3' driver instead. The kernel has no logic to decide which driver to bind to if there are 2 matching drivers, so bail probe if no dwc3 child node.

---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-of-simple.c +4 -0
index 71fd620c5..8d3baa5df 100644
@@ -38,6 +38,10 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 
 	int			ret;
 
+	/* Bail probe if no dwc3 child node. */
+	if (!of_get_compatible_child(dev->of_node, "snps,dwc3"))
+		return -ENODEV;
+
 	simple = devm_kzalloc(dev, sizeof(*simple), GFP_KERNEL);
 	if (!simple)
 		return -ENOMEM;
Signature · 1 line
2.11.0
#4 lore raw

PATCH v6 2/4 arm64: dts: rockchip: optimize clks for rk3399 dwc3

In reply to Johan Jonker

From: Wu Liang feng <[email protected]>

Remove unnecessary clocks, refer to rk3399 TRM, aclk_usb3 is the parent of aclk_usb3otg0/1 and aclk_usb3_grf, and we will enable aclk_usb3otg0/1 and aclk_usb3_grf, so don't need to enable aclk_usb3 again. In addition, the aclk_usb3_rksoc_axi_perf clk is used for usb3 performance monitor module which we don't use now, so don't need to enable it.

---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +4 -8
index e93a5f320..186a7c483 100644
@@ -370,11 +370,9 @@
 		#size-cells = <2>;
 		ranges;
 		clocks = <&cru SCLK_USB3OTG0_REF>, <&cru SCLK_USB3OTG0_SUSPEND>,
-			 <&cru ACLK_USB3OTG0>, <&cru ACLK_USB3_RKSOC_AXI_PERF>,
-			 <&cru ACLK_USB3>, <&cru ACLK_USB3_GRF>;
+			 <&cru ACLK_USB3OTG0>, <&cru ACLK_USB3_GRF>;
 		clock-names = "ref_clk", "suspend_clk",
-			      "bus_clk", "aclk_usb3_rksoc_axi_perf",
-			      "aclk_usb3", "grf_clk";
+			      "bus_clk", "grf_clk";
 		resets = <&cru SRST_A_USB3_OTG0>;
 		reset-names = "usb3-otg";
 		status = "disabled";
@@ -406,11 +404,9 @@
 		#size-cells = <2>;
 		ranges;
 		clocks = <&cru SCLK_USB3OTG1_REF>, <&cru SCLK_USB3OTG1_SUSPEND>,
-			 <&cru ACLK_USB3OTG1>, <&cru ACLK_USB3_RKSOC_AXI_PERF>,
-			 <&cru ACLK_USB3>, <&cru ACLK_USB3_GRF>;
+			 <&cru ACLK_USB3OTG1>, <&cru ACLK_USB3_GRF>;
 		clock-names = "ref_clk", "suspend_clk",
-			      "bus_clk", "aclk_usb3_rksoc_axi_perf",
-			      "aclk_usb3", "grf_clk";
+			      "bus_clk", "grf_clk";
 		resets = <&cru SRST_A_USB3_OTG1>;
 		reset-names = "usb3-otg";
 		status = "disabled";
Signature · 1 line
2.11.0
#5 lore raw

PATCH v6 3/4 arm64: dts: rockchip: restyle rk3399 usbdrd3_0 node

In reply to Johan Jonker

For rk3399 dwc3 usb the wrapper node for only clocks makes no sense, so restyle the rk3399 usbdrd3_0 node before more new SoC types are added with the same IP.

---
Changed V6:
rebase

Changed V3:
remove aclk_usb3_rksoc_axi_perf
remove aclk_usb3

---
 arch/arm64/boot/dts/rockchip/rk3399-ficus.dts      |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts    |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi       |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts |  6 +---
 .../boot/dts/rockchip/rk3399-khadas-edge.dtsi      |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts  |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts   |  6 +---
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts      |  4 ---
 .../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi    |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dts    |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi   |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi  |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           | 37 ++++++++--------------
 .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi     |  4 ---
 19 files changed, 25 insertions(+), 96 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-ficus.dts +1 -1
index 1ce85a581..95110d065 100644
@@ -153,7 +153,7 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
+&usbdrd3_0 {
 	dr_mode = "host";
 };
 
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +1 -5
index 6db18808b..4017b0e8c 100644
@@ -773,12 +773,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "otg";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +1 -5
index 32dcaf210..e42783cb7 100644
@@ -618,13 +618,9 @@ ap_i2c_audio: &i2c8 {
 };
 
 &usbdrd3_0 {
-	status = "okay";
+	dr_mode = "host";
 	extcon = <&usbc_extcon0>;
-};
-
-&usbdrd_dwc3_0 {
 	status = "okay";
-	dr_mode = "host";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts +1 -5
index 341d074ed..daf14f732 100644
@@ -731,12 +731,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +1 -5
index 635afdd99..d028285fb 100644
@@ -797,12 +797,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "otg";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts +1 -5
index 1fa80ac15..1c0b48a71 100644
@@ -611,12 +611,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "otg";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts +1 -1
index fa5809887..33730b3c5 100644
@@ -124,7 +124,7 @@
 	status = "disabled";
 };
 
-&usbdrd_dwc3_0 {
+&usbdrd3_0 {
 	dr_mode = "host";
 };
 
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +0 -4
index 48ed4aaa3..01c15c833 100644
@@ -714,10 +714,6 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
-	status = "okay";
-};
-
 &usbdrd_dwc3_1 {
 	dr_mode = "host";
 	status = "okay";
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +1 -5
index ad7c4d008..7b633622c 100644
@@ -854,12 +854,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +0 -4
index 219b7507a..f00e11075 100644
@@ -1086,10 +1086,6 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
 	dr_mode = "host";
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +0 -4
index a8d363568..35780506c 100644
@@ -223,10 +223,6 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
 	dr_mode = "otg";
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +0 -4
index 20309076d..4d30c1b32 100644
@@ -792,10 +792,6 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
-	status = "okay";
-};
-
 &usbdrd3_1 {
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +1 -5
index fb7599f07..69c067dd1 100644
@@ -668,12 +668,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +1 -1
index 1a23e8f3c..df4119441 100644
@@ -139,7 +139,7 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
+&usbdrd3_0 {
 	dr_mode = "otg";
 };
 
arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi +0 -4
index 5e3ac589b..3920dcbd1 100644
@@ -635,10 +635,6 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
-	status = "okay";
-};
-
 &usbdrd3_1 {
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +1 -5
index d42c75c6d..f119fc41f 100644
@@ -830,12 +830,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +1 -5
index 701a567d7..2e76f178e 100644
@@ -614,12 +614,8 @@
 };
 
 &usbdrd3_0 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_0 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399.dtsi +13 -24
index 186a7c483..deac8f8e5 100644
@@ -365,37 +365,26 @@
 	};
 
 	usbdrd3_0: usb@fe800000 {
-		compatible = "rockchip,rk3399-dwc3";
-		#address-cells = <2>;
-		#size-cells = <2>;
-		ranges;
+		compatible = "rockchip,rk3399-dwc3", "snps,dwc3";
+		reg = <0x0 0xfe800000 0x0 0x100000>;
+		interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
 		clocks = <&cru SCLK_USB3OTG0_REF>, <&cru SCLK_USB3OTG0_SUSPEND>,
 			 <&cru ACLK_USB3OTG0>, <&cru ACLK_USB3_GRF>;
 		clock-names = "ref_clk", "suspend_clk",
 			      "bus_clk", "grf_clk";
+		dr_mode = "otg";
+		phys = <&u2phy0_otg>, <&tcphy0_usb3>;
+		phy-names = "usb2-phy", "usb3-phy";
+		phy_type = "utmi_wide";
+		power-domains = <&power RK3399_PD_USB3>;
 		resets = <&cru SRST_A_USB3_OTG0>;
 		reset-names = "usb3-otg";
+		snps,dis-del-phy-power-chg-quirk;
+		snps,dis_enblslpm_quirk;
+		snps,dis-tx-ipgap-linecheck-quirk;
+		snps,dis-u2-freeclk-exists-quirk;
+		snps,dis_u2_susphy_quirk;
 		status = "disabled";
-
-		usbdrd_dwc3_0: usb@fe800000 {
-			compatible = "snps,dwc3";
-			reg = <0x0 0xfe800000 0x0 0x100000>;
-			interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
-			clocks = <&cru SCLK_USB3OTG0_REF>, <&cru ACLK_USB3OTG0>,
-				 <&cru SCLK_USB3OTG0_SUSPEND>;
-			clock-names = "ref", "bus_early", "suspend";
-			dr_mode = "otg";
-			phys = <&u2phy0_otg>, <&tcphy0_usb3>;
-			phy-names = "usb2-phy", "usb3-phy";
-			phy_type = "utmi_wide";
-			snps,dis_enblslpm_quirk;
-			snps,dis-u2-freeclk-exists-quirk;
-			snps,dis_u2_susphy_quirk;
-			snps,dis-del-phy-power-chg-quirk;
-			snps,dis-tx-ipgap-linecheck-quirk;
-			power-domains = <&power RK3399_PD_USB3>;
-			status = "disabled";
-		};
 	};
 
 	usbdrd3_1: usb@fe900000 {
arch/arm64/boot/dts/rockchip/rk3399pro-vmarc-som.dtsi +0 -4
index 7257494d2..810fb7880 100644
@@ -454,10 +454,6 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_0 {
-	status = "okay";
-};
-
 &vbus_host {
 	enable-active-high;
 	gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; /* USB1_EN_OC# */
Signature · 1 line
2.11.0
#6 lore raw

PATCH v6 4/4 arm64: dts: rockchip: restyle rk3399 usbdrd3_1 node

In reply to Johan Jonker

For rk3399 dwc3 usb the wrapper node for only clocks makes no sense, so restyle the rk3399 usbdrd3_1 node before more new SoC types are added with the same IP.

---
Changed V3:
remove aclk_usb3_rksoc_axi_perf
remove aclk_usb3

---
 arch/arm64/boot/dts/rockchip/rk3399-ficus.dts      |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts    |  6 +---
 .../boot/dts/rockchip/rk3399-gru-chromebook.dtsi   |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts |  6 +---
 .../boot/dts/rockchip/rk3399-khadas-edge.dtsi      |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts  |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts   |  6 +---
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts      |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi      |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi    |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dts    |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi   |  4 ---
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi  |  6 +---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           | 37 ++++++++--------------
 17 files changed, 26 insertions(+), 93 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-ficus.dts +1 -1
index 95110d065..4392780db 100644
@@ -157,7 +157,7 @@
 	dr_mode = "host";
 };
 
-&usbdrd_dwc3_1 {
+&usbdrd3_1 {
 	dr_mode = "host";
 };
 
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts +1 -5
index 4017b0e8c..28e5895de 100644
@@ -778,12 +778,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi +1 -5
index 1384dabbd..c996c688d 100644
@@ -351,13 +351,9 @@ ap_i2c_tp: &i2c5 {
 };
 
 &usbdrd3_1 {
-	status = "okay";
+	dr_mode = "host";
 	extcon = <&usbc_extcon1>;
-};
-
-&usbdrd_dwc3_1 {
 	status = "okay";
-	dr_mode = "host";
 };
 
 &pinctrl {
arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts +1 -5
index daf14f732..397050703 100644
@@ -736,12 +736,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi +1 -5
index d028285fb..30e6e3e41 100644
@@ -802,12 +802,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts +1 -5
index 1c0b48a71..a7092fda3 100644
@@ -616,12 +616,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +0 -4
index 01c15c833..6605d0bcb 100644
@@ -711,10 +711,6 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
 	dr_mode = "host";
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts +1 -5
index 7b633622c..fdc027ff3 100644
@@ -859,12 +859,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts +0 -4
index f00e11075..80ac8ab6a 100644
@@ -1091,10 +1091,6 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
 	dr_mode = "host";
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +1 -5
index 6ae9032d8..542980344 100644
@@ -466,12 +466,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &usb_host1_ehci {
arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +1 -5
index 4d30c1b32..f15f85162 100644
@@ -793,12 +793,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi +1 -5
index 69c067dd1..f07f49f45 100644
@@ -673,12 +673,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +1 -1
index df4119441..bb110c456 100644
@@ -143,7 +143,7 @@
 	dr_mode = "otg";
 };
 
-&usbdrd_dwc3_1 {
+&usbdrd3_1 {
 	dr_mode = "host";
 };
 
arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi +0 -4
index 3920dcbd1..b5f23661e 100644
@@ -639,10 +639,6 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3_1 {
-	status = "okay";
-};
-
 &vopb {
 	status = "okay";
 };
arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi +1 -5
index f119fc41f..a8e5d9e02 100644
@@ -835,12 +835,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +1 -5
index 2e76f178e..fe9d4b2f8 100644
@@ -619,12 +619,8 @@
 };
 
 &usbdrd3_1 {
-	status = "okay";
-};
-
-&usbdrd_dwc3_1 {
-	status = "okay";
 	dr_mode = "host";
+	status = "okay";
 };
 
 &vopb {
arch/arm64/boot/dts/rockchip/rk3399.dtsi +13 -24
index deac8f8e5..497df16cc 100644
@@ -388,37 +388,26 @@
 	};
 
 	usbdrd3_1: usb@fe900000 {
-		compatible = "rockchip,rk3399-dwc3";
-		#address-cells = <2>;
-		#size-cells = <2>;
-		ranges;
+		compatible = "rockchip,rk3399-dwc3", "snps,dwc3";
+		reg = <0x0 0xfe900000 0x0 0x100000>;
+		interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
 		clocks = <&cru SCLK_USB3OTG1_REF>, <&cru SCLK_USB3OTG1_SUSPEND>,
 			 <&cru ACLK_USB3OTG1>, <&cru ACLK_USB3_GRF>;
 		clock-names = "ref_clk", "suspend_clk",
 			      "bus_clk", "grf_clk";
+		dr_mode = "otg";
+		phys = <&u2phy1_otg>, <&tcphy1_usb3>;
+		phy-names = "usb2-phy", "usb3-phy";
+		phy_type = "utmi_wide";
+		power-domains = <&power RK3399_PD_USB3>;
 		resets = <&cru SRST_A_USB3_OTG1>;
 		reset-names = "usb3-otg";
+		snps,dis-del-phy-power-chg-quirk;
+		snps,dis_enblslpm_quirk;
+		snps,dis-tx-ipgap-linecheck-quirk;
+		snps,dis-u2-freeclk-exists-quirk;
+		snps,dis_u2_susphy_quirk;
 		status = "disabled";
-
-		usbdrd_dwc3_1: usb@fe900000 {
-			compatible = "snps,dwc3";
-			reg = <0x0 0xfe900000 0x0 0x100000>;
-			interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
-			clocks = <&cru SCLK_USB3OTG1_REF>, <&cru ACLK_USB3OTG1>,
-				 <&cru SCLK_USB3OTG1_SUSPEND>;
-			clock-names = "ref", "bus_early", "suspend";
-			dr_mode = "otg";
-			phys = <&u2phy1_otg>, <&tcphy1_usb3>;
-			phy-names = "usb2-phy", "usb3-phy";
-			phy_type = "utmi_wide";
-			snps,dis_enblslpm_quirk;
-			snps,dis-u2-freeclk-exists-quirk;
-			snps,dis_u2_susphy_quirk;
-			snps,dis-del-phy-power-chg-quirk;
-			snps,dis-tx-ipgap-linecheck-quirk;
-			power-domains = <&power RK3399_PD_USB3>;
-			status = "disabled";
-		};
 	};
 
 	cdn_dp: dp@fec00000 {
Signature · 1 line
2.11.0
#7 lore raw
In reply to Johan Jonker
Quoted 17 lines

From: Johan Jonker <[email protected]>
Date: Thu, 1 Apr 2021 23:36:48 +0200

The conversion of rockchip,dwc3.txt to yaml was added to linux-next, but the necessary changes for rk3399 are still pending.

For rk3399 dwc3 usb the wrapper node for only clocks makes no sense, so that was removed in the YAML example.

Now dtbs_check still generates notifications for the compatibility string in the dts files that doesn't match, because it changed from "rockchip,rk3399-dwc3" to "rockchip,rk3399-dwc3", "snps,dwc3".

The problem is to keep compatible with old device trees. I.e. a device running an older device tree should still work with newer kernels.

Quoted 8 lines

Comment by Rob in version 3:
Presumably you are getting lucky here (with link order). The kernel has no logic to decide which driver to bind to if there are 2 matching drivers. If we did, it would probably be the opposite of what you want here as we'd pick the most specific match. This driver should probably bail probe if no dwc3 child node.

Please advise how to move forward with this serie.

As I tried to point out earlier, this kind of binding change is unhelpful. Yes, you now have extra code in future Linux kernels that works around the problem. But other consumers of device trees (U-Boot, other OSes) will have to add similar code or keep using older device trees. And even then it will still cause frustration for users that want to run older kernels.

I do understand that it is sometimes necessary to change device tree bindings. But changes like this one just cause a lot of pain without a significant technical benefit.

Cheers,

Mark

Quoted 59 lines

Changed V6:
rebase
remove accepted patches from serie

Changed V5:
add select

Changed V4:
removed patch "of-simple: add compatible for rk3328" add patch "of-simple: bail probe if no dwc3 child node"

Changed V3:
remove aclk_usb3_rksoc_axi_perf
remove aclk_usb3

Changed V2:
remove node wrapper

Johan Jonker (3):
usb: dwc3: of-simple: bail probe if no dwc3 child node
arm64: dts: rockchip: restyle rk3399 usbdrd3_0 node
arm64: dts: rockchip: restyle rk3399 usbdrd3_1 node

Wu Liang feng (1):
arm64: dts: rockchip: optimize clks for rk3399 dwc3

 arch/arm64/boot/dts/rockchip/rk3399-ficus.dts      |  4 +-
 arch/arm64/boot/dts/rockchip/rk3399-firefly.dts    | 12 +--
 .../boot/dts/rockchip/rk3399-gru-chromebook.dtsi   |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi       |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts | 12 +--
 .../boot/dts/rockchip/rk3399-khadas-edge.dtsi      | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-leez-p710.dts  | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts |  2 +-
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   |  8 --
 arch/arm64/boot/dts/rockchip/rk3399-orangepi.dts   | 12 +--
 .../boot/dts/rockchip/rk3399-pinebook-pro.dts      |  8 --
 .../arm64/boot/dts/rockchip/rk3399-puma-haikou.dts |  4 -
 arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi      |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi    | 10 +--
 arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dts    |  4 +-
 arch/arm64/boot/dts/rockchip/rk3399-rock960.dtsi   |  8 --
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi  | 12 +--
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           | 86 ++++++++--------------
 .../boot/dts/rockchip/rk3399pro-vmarc-som.dtsi     |  4 -
 drivers/usb/dwc3/dwc3-of-simple.c                  |  4 +
 22 files changed, 59 insertions(+), 197 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#2 lore raw

Re: [PATCH v6 1/4] usb: dwc3: of-simple: bail probe if no dwc3 child node

In reply to Johan Jonker
Quoted 17 lines · Johan Jonker

For some of the dwc3-of-simple compatible SoCs we don't want to bind this driver to a dwc3 node, but bind that node to the 'snps,dwc3' driver instead. The kernel has no logic to decide which driver to bind to if there are 2 matching drivers, so bail probe if no dwc3 child node.

---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-of-simple.c +0 -0
index 71fd620c5..8d3baa5df 100644

drivers/usb/dwc3/dwc3-of-simple.c static int dwc3_of_simple_probe(struct platform_device *pdev) · line 43

Quoted 6 lines
drivers/usb/dwc3/dwc3-of-simple.c +3 -0
@@ -38,6 +38,10 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 
 	int			ret;
 
+	/* Bail probe if no dwc3 child node. */
+	if (!of_get_compatible_child(dev->of_node, "snps,dwc3"))
+		return -ENODEV;

Why is this part of the "convert to yaml" patch series? Shouldn't this be a separate, independant patch?

thanks,

greg k-h

#3 lore raw

Re: [PATCH v6 1/4] usb: dwc3: of-simple: bail probe if no dwc3 child node

Quoted 21 lines · Greg KH
Quoted 20 lines · Johan Jonker

For some of the dwc3-of-simple compatible SoCs we don't want to bind this driver to a dwc3 node, but bind that node to the 'snps,dwc3' driver instead. The kernel has no logic to decide which driver to bind to if there are 2 matching drivers, so bail probe if no dwc3 child node.

---
 drivers/usb/dwc3/dwc3-of-simple.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/dwc3/dwc3-of-simple.c +0 -0
index 71fd620c5..8d3baa5df 100644
@@ -38,6 +38,10 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 
 	int			ret;
 
Quoted 7 lines

drivers/usb/dwc3/dwc3-of-simple.c static int dwc3_of_simple_probe(struct platform_device *pdev) · line 43

Quoted 3 lines
drivers/usb/dwc3/dwc3-of-simple.c +3 -0
+	/* Bail probe if no dwc3 child node. */
+	if (!of_get_compatible_child(dev->of_node, "snps,dwc3"))
+		return -ENODEV;

Why is this part of the "convert to yaml" patch series? Shouldn't this be a separate, independant patch?

independent

Hi Greg,

As pointed out by Rob in the v3 review process the YAML conversion has some side effects for new dt files. A good habit is to fix things before they become in effect. That's why this patch is placed before the dtsi changes and why Heiko asked to have a look at it.

For the sake of completeness there are other less optimal options:
- remove rk3399 support from dwc3-of-simple.c
- unselect CONFIG_USB_DWC3_OF_SIMPLE for new rk3399 device trees

In that case at least have it on record why USB maintainers didn't apply it in case someone else start to complain about it later when Heiko goes ahead with it.

Johan Jonker

Quoted 5 lines

thanks,

greg k-h

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip