Skip to contentSkip to conversation

dt-bindings: phy: convert phy-rockchip-inno-usb2 bindings to yaml

RFC PATCH Superseded Johan Jonker 3 participants 6 messages Mar 18, 2020 – Mar 19, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 dt-bindings: phy: convert phy-rockchip-inno-usb2 bindings to yaml

Current dts files for Rockchip with 'usb2-phy' subnodes are manually verified. In order to automate this process phy-rockchip-inno-usb2.txt has to be converted to yaml.

Changed:
Removed unused "rockchip,rk3366-usb2phy" support. Replaced example with something that has SoC support in the kernel.

---
 .../bindings/phy/phy-rockchip-inno-usb2.txt        |  81 -----------
 .../bindings/phy/phy-rockchip-inno-usb2.yaml       | 149 +++++++++++++++++++++
 2 files changed, 149 insertions(+), 81 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt deleted +0 -81
deleted file mode 100644
index 541f52988..000000000
@@ -1,81 +0,0 @@
-ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
-
-Required properties (phy (parent) node):
- - compatible : should be one of the listed compatibles:
-	* "rockchip,px30-usb2phy"
-	* "rockchip,rk3228-usb2phy"
-	* "rockchip,rk3328-usb2phy"
-	* "rockchip,rk3366-usb2phy"
-	* "rockchip,rk3399-usb2phy"
-	* "rockchip,rv1108-usb2phy"
- - reg : the address offset of grf for usb-phy configuration.
- - #clock-cells : should be 0.
- - clock-output-names : specify the 480m output clock name.
-
-Optional properties:
- - clocks : phandle + phy specifier pair, for the input clock of phy.
- - clock-names : input clock name of phy, must be "phyclk".
- - assigned-clocks : phandle of usb 480m clock.
- - assigned-clock-parents : parent of usb 480m clock, select between
-		 usb-phy output 480m and xin24m.
-		 Refer to clk/clock-bindings.txt for generic clock
-		 consumer properties.
- - rockchip,usbgrf : phandle to the syscon managing the "usb general
-		 register files". When set driver will request its
-		 phandle as one companion-grf for some special SoCs
-		 (e.g RV1108).
- - extcon : phandle to the extcon device providing the cable state for
-		 the otg phy.
-
-Required nodes : a sub-node is required for each port the phy provides.
-		 The sub-node name is used to identify host or otg port,
-		 and shall be the following entries:
-	* "otg-port" : the name of otg port.
-	* "host-port" : the name of host port.
-
-Required properties (port (child) node):
- - #phy-cells : must be 0. See ./phy-bindings.txt for details.
- - interrupts : specify an interrupt for each entry in interrupt-names.
- - interrupt-names : a list which should be one of the following cases:
-	Regular case:
-	* "otg-id" : for the otg id interrupt.
-	* "otg-bvalid" : for the otg vbus interrupt.
-	* "linestate" : for the host/otg linestate interrupt.
-	Some SoCs use one interrupt with the above muxed together, so for these
-	* "otg-mux" : otg-port interrupt, which mux otg-id/otg-bvalid/linestate
-		to one.
-
-Optional properties:
- - phy-supply : phandle to a regulator that provides power to VBUS.
-		See ./phy-bindings.txt for details.
-
-Example:
-
-grf: syscon@ff770000 {
-	compatible = "rockchip,rk3366-grf", "syscon", "simple-mfd";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-...
-
-	u2phy: usb2-phy@700 {
-		compatible = "rockchip,rk3366-usb2phy";
-		reg = <0x700 0x2c>;
-		#clock-cells = <0>;
-		clock-output-names = "sclk_otgphy0_480m";
-
-		u2phy_otg: otg-port {
-			#phy-cells = <0>;
-			interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "otg-id", "otg-bvalid", "linestate";
-		};
-
-		u2phy_host: host-port {
-			#phy-cells = <0>;
-			interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "linestate";
-		};
-	};
-};
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml new file +149 -0

149 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

RFC PATCH 2/2 phy: phy-rockchip-inno-usb2: remove support for rockchip,rk3366-usb2phy

'phy-rockchip-inno-usb2.txt' is updated to yaml, whereby the compatible string 'rockchip,rk3366-usb2phy' was removed, because it's not in use by a dts file, so remove support in the code as well.

---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 20 --------------------
 1 file changed, 20 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +0 -20
index 680cc0c88..dcdb5589b 100644
@@ -1299,25 +1299,6 @@ static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
 	{ /* sentinel */ }
 };
 
-static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
-	{
-		.reg = 0x700,
-		.num_ports	= 2,
-		.clkout_ctl	= { 0x0724, 15, 15, 1, 0 },
-		.port_cfgs	= {
-			[USB2PHY_PORT_HOST] = {
-				.phy_sus	= { 0x0728, 15, 0, 0, 0x1d1 },
-				.ls_det_en	= { 0x0680, 4, 4, 0, 1 },
-				.ls_det_st	= { 0x0690, 4, 4, 0, 1 },
-				.ls_det_clr	= { 0x06a0, 4, 4, 0, 1 },
-				.utmi_ls	= { 0x049c, 14, 13, 0, 1 },
-				.utmi_hstdet	= { 0x049c, 12, 12, 0, 1 }
-			}
-		},
-	},
-	{ /* sentinel */ }
-};
-
 static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
 	{
 		.reg		= 0xe450,
@@ -1426,7 +1407,6 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
 	{ .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs },
 	{ .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs },
 	{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
-	{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
 	{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },
 	{ .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs },
 	{}
Signature · 1 line
2.11.0
#4 lore raw
In reply to Johan Jonker

Hi,

A test with the command below gives this error:

DTC Documentation/devicetree/bindings/phy/
phy-rockchip-inno-usb2.example.dt.yaml
CHECK Documentation/devicetree/bindings/phy/
phy-rockchip-inno-usb2.example.dt.yaml Documentation/devicetree/bindings/phy/ phy-rockchip-inno-usb2.example.dt.yaml: usb2-phy@e450:
'#phy-cells' is a required property

'phy-provider.yaml' uses regex pattern:

"^(|usb-|usb2-|usb3-|pci-|pcie-|sata-)phy(@[0-9a-f,]+)*$"

in combination with nodename 'usb2-phy' gives a full match. '#phy-cells' is only for subnodes I think.

Question:
Should we:
1: rename all 'usb2-phy' nodes in dtsi, then please advise what name should be used.

Or:
2: add '#phy-cells' to 'usb2-phy' nodes? Please advice.

make -k ARCH=arm dt_binding_check

Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml line 128

Quoted 7 lines
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml new file +6 -0
+examples:
+  - |
+    #include <dt-bindings/clock/rk3399-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
 
+    u2phy0: usb2-phy@e450 {

Regex gives a full match.

Quoted 21 lines
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml new file +21 -0
+      compatible = "rockchip,rk3399-usb2phy";
+      reg = <0xe450 0x10>;
+      clocks = <&cru SCLK_USB2PHY0_REF>;
+      clock-names = "phyclk";
+      clock-output-names = "clk_usbphy0_480m";
+      #clock-cells = <0>;
+
+      u2phy0_host: host-port {
+        #phy-cells = <0>;
+        interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH 0>;
+        interrupt-names = "linestate";
+      };
+
+      u2phy0_otg: otg-port {
+        #phy-cells = <0>;
+        interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH 0>,
+                     <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH 0>,
+                     <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH 0>;
+        interrupt-names = "otg-bvalid", "otg-id", "linestate";
+      };
+    };
#2 lore raw

Re: [RFC PATCH 2/2] phy: phy-rockchip-inno-usb2: remove support for rockchip, rk3366-usb2phy

In reply to Johan Jonker

Hi Johan,

Quoted 4 lines · Johan Jonker

'phy-rockchip-inno-usb2.txt' is updated to yaml, whereby the compatible string 'rockchip,rk3366-usb2phy' was removed, because it's not in use by a dts file, so remove support in the code as well.

Here's a DT using it:

https://github.com/rockchip-linux/kernel/blob/develop-4.4/arch/arm64/boot/dts/rockchip/rk3366.dtsi#L820

Please note that although DT bindings happen to be primarily maintained in the upstream kernel tree at the moment, it is mostly as a consequence of Linux being the source of most active development. Bindings should not be considered to be "owned" by upstream Linux since there are many other consumers, both downstream, and in completely different projects like the BSDs. As far as I'm aware there is still a long-term plan to eventually flip the switch and move maintenance to a standalone repo:

https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git

Things like PCI Device IDs and ACPI HIDs aren't even documented as formally as DT bindings, so by the reasoning here we could arguably delete the majority of drivers from the kernel...

Robin.

Quoted 44 lines
---
  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 20 --------------------
  1 file changed, 20 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +0 -20
index 680cc0c88..dcdb5589b 100644
@@ -1299,25 +1299,6 @@ static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
  	{ /* sentinel */ }
  };
 
-static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
-	{
-		.reg = 0x700,
-		.num_ports	= 2,
-		.clkout_ctl	= { 0x0724, 15, 15, 1, 0 },
-		.port_cfgs	= {
-			[USB2PHY_PORT_HOST] = {
-				.phy_sus	= { 0x0728, 15, 0, 0, 0x1d1 },
-				.ls_det_en	= { 0x0680, 4, 4, 0, 1 },
-				.ls_det_st	= { 0x0690, 4, 4, 0, 1 },
-				.ls_det_clr	= { 0x06a0, 4, 4, 0, 1 },
-				.utmi_ls	= { 0x049c, 14, 13, 0, 1 },
-				.utmi_hstdet	= { 0x049c, 12, 12, 0, 1 }
-			}
-		},
-	},
-	{ /* sentinel */ }
-};
-
  static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = {
  	{
  		.reg		= 0xe450,
@@ -1426,7 +1407,6 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = {
  	{ .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs },
  	{ .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs },
  	{ .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },
-	{ .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs },
  	{ .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs },
  	{ .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs },
  	{}
#3 lore raw

Re: [RFC PATCH 2/2] phy: phy-rockchip-inno-usb2: remove support for rockchip, rk3366-usb2phy

Hi,

Some questions.
Can Rockchip or Heiko explain why we have half finished support in the upstream kernel for rk3366? What happened?
Are any plans to add a rk3366.dtsi?
How wide spread was the use of rk3366? Products?
ie. When does support stop?

There's also a rk3368. Is there a need for "rockchip,rk3368-usb2phy"?

We'll keep "rockchip,rk3366-usb2phy" aboard for v2.

Thanks

Quoted 29 lines · Robin Murphy

Hi Johan,

Quoted 4 lines · Johan Jonker

'phy-rockchip-inno-usb2.txt' is updated to yaml, whereby the compatible string 'rockchip,rk3366-usb2phy' was removed, because it's not in use by a dts file, so remove support in the code as well.

Here's a DT using it:

https://github.com/rockchip-linux/kernel/blob/develop-4.4/arch/arm64/boot/dts/rockchip/rk3366.dtsi#L820

Please note that although DT bindings happen to be primarily maintained in the upstream kernel tree at the moment, it is mostly as a consequence of Linux being the source of most active development. Bindings should not be considered to be "owned" by upstream Linux since there are many other consumers, both downstream, and in completely different projects like the BSDs. As far as I'm aware there is still a long-term plan to eventually flip the switch and move maintenance to a standalone repo:

https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git

Things like PCI Device IDs and ACPI HIDs aren't even documented as formally as DT bindings, so by the reasoning here we could arguably delete the majority of drivers from the kernel...

Robin.

maintainer
#5 lore raw
In reply to Johan Jonker
Quoted 9 lines · Johan Jonker

Current dts files for Rockchip with 'usb2-phy' subnodes are manually verified. In order to automate this process phy-rockchip-inno-usb2.txt has to be converted to yaml.

Changed:
Removed unused "rockchip,rk3366-usb2phy" support. Replaced example with something that has SoC support in the kernel.

Quoted 8 lines
---
 .../bindings/phy/phy-rockchip-inno-usb2.txt        |  81 -----------
 .../bindings/phy/phy-rockchip-inno-usb2.yaml       | 149 +++++++++++++++++++++
 2 files changed, 149 insertions(+), 81 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml

My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.example.dt.yaml: usb2-phy@e450: '#phy-cells' is a required property

See https://patchwork.ozlabs.org/patch/1257721
Please check and re-submit.