Skip to contentSkip to conversation

align rk356x drivers as preparation for mainline dts

PATCH Applied Michael Riesch 3 participants 5 messages May 9, 2022 – May 11, 2022

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

cover align rk356x drivers as preparation for mainline dts

Hi all,

These patches align the barebox drivers for the Naneng Combo PHY and the dwc3 with the current device tree bindings in mainline Linux. Thereby, the migration from the initial device tree files related to the RK3568 EVB1 and the BananaPi R2Pro to their equivalents in mainline Linux is facilitated.

In order to ensure compatibility, the initial device tree files in arch/arm/dts are adjusted accordingly.

The changes are tested exclusively on the RK3568 EVB1 -- Frank, if you could give this a test on the BananaPi it would be great.

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (2):
phy: rockchip: align naneng-combphy clocks and resets with binding
usb: dwc3: align dwc3 clocks with binding

 arch/arm/dts/rk3568-bpi-r2-pro.dts            |  7 +-
 arch/arm/dts/rk3568-evb1-v10.dts              | 14 ++--
 arch/arm/dts/rk3568.dtsi                      | 82 +++++++------------
 .../rockchip/phy-rockchip-naneng-combphy.c    | 19 +----
 drivers/usb/dwc3/core.c                       | 50 ++++++++---
 5 files changed, 79 insertions(+), 93 deletions(-)
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/2 phy: rockchip: align naneng-combphy clocks and resets with binding

There was no device tree binding in mainline Linux when this driver was introduced in barebox. This has changed in the mean time, hence we need to align the clocks and resets in this driver.

This step is a prerequisite for replacing the initial rk3568.dtsi in arch/arm/dts with the mainline Linux version. For compatibility, the former is updated accordingly.

---
 arch/arm/dts/rk3568.dtsi                      | 10 ++++------
 .../rockchip/phy-rockchip-naneng-combphy.c    | 19 ++++---------------
 2 files changed, 8 insertions(+), 21 deletions(-)
arch/arm/dts/rk3568.dtsi +4 -6
index 0f19d3f0c0..28121dbdf3 100644
@@ -367,11 +367,10 @@
 		#phy-cells = <1>;
 		clocks = <&pmucru CLK_PCIEPHY0_REF>, <&cru PCLK_PIPEPHY0>,
 			 <&cru PCLK_PIPE>;
-		clock-names = "refclk", "apbclk", "pipe_clk";
+		clock-names = "ref", "apb", "pipe";
 		assigned-clocks = <&pmucru CLK_PCIEPHY0_REF>;
 		assigned-clock-rates = <24000000>;
-		resets = <&cru SRST_P_PIPEPHY0>, <&cru SRST_PIPEPHY0>;
-		reset-names = "combphy-apb", "combphy";
+		resets = <&cru SRST_PIPEPHY0>;
 		rockchip,pipe-grf = <&pipegrf>;
 		rockchip,pipe-phy-grf = <&pipe_phy_grf0>;
 		status = "disabled";
@@ -383,11 +382,10 @@
 		#phy-cells = <1>;
 		clocks = <&pmucru CLK_PCIEPHY1_REF>, <&cru PCLK_PIPEPHY1>,
 			 <&cru PCLK_PIPE>;
-		clock-names = "refclk", "apbclk", "pipe_clk";
+		clock-names = "ref", "apb", "pipe";
 		assigned-clocks = <&pmucru CLK_PCIEPHY1_REF>;
 		assigned-clock-rates = <24000000>;
-		resets = <&cru SRST_P_PIPEPHY1>, <&cru SRST_PIPEPHY1>;
-		reset-names = "combphy-apb", "combphy";
+		resets = <&cru SRST_PIPEPHY1>;
 		rockchip,pipe-grf = <&pipegrf>;
 		rockchip,pipe-phy-grf = <&pipe_phy_grf1>;
 		status = "disabled";
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +4 -15
index 445703ecd8..2d86d86334 100644
@@ -83,7 +83,6 @@ struct rockchip_combphy_priv {
 	struct regmap *pipe_grf;
 	struct regmap *phy_grf;
 	struct phy *phy;
-	struct reset_control *apb_rst;
 	struct reset_control *phy_rst;
 	const struct rockchip_combphy_cfg *cfg;
 };
@@ -317,17 +316,7 @@ static int rockchip_combphy_parse_dt(struct device_d *dev,
 		param_write(priv->pipe_grf, &phy_cfg->grfcfg->pipe_sgmii_mac_sel,
 			    true);
 
-	priv->apb_rst = reset_control_get(dev, "combphy-apb");
-	if (IS_ERR(priv->apb_rst)) {
-		ret = PTR_ERR(priv->apb_rst);
-
-		if (ret != -EPROBE_DEFER)
-			dev_warn(dev, "failed to get apb reset\n");
-
-		return ret;
-	}
-
-	priv->phy_rst = reset_control_get(dev, "combphy");
+	priv->phy_rst = reset_control_get(dev, NULL);
 	if (IS_ERR(priv->phy_rst)) {
 		ret = PTR_ERR(priv->phy_rst);
 
@@ -579,9 +568,9 @@ static const struct rockchip_combphy_grfcfg rk3568_combphy_grfcfgs = {
 };
 
 static const struct clk_bulk_data rk3568_clks[] = {
-	{ .id = "refclk" },
-	{ .id = "apbclk" },
-	{ .id = "pipe_clk" },
+	{ .id = "ref" },
+	{ .id = "apb" },
+	{ .id = "pipe" },
 };
 
 static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = {
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/2 usb: dwc3: align dwc3 clocks with binding

In reply to Michael Riesch

The device tree bindings snps,dwc3.yaml and rockchip,dwc3.yaml specify different clock names. This inconsistency did not matter in the past as the snps,dwc3 used to be a subnode of the rockchip,rk3xyz-dwc3 glue node. For the RK356x, however, a different approach is used and the two nodes are merged. Therefore, the dwc3 driver must accept both groups of clock names.

This step is a prerequisite for replacing the initial rk3568.dtsi in arch/arm/dts with the mainline Linux version. For compatibility, the former is updated accordingly. This also illustrates the migration from glue node and subnode to a single device tree node.

---
 arch/arm/dts/rk3568-bpi-r2-pro.dts |  7 +--
 arch/arm/dts/rk3568-evb1-v10.dts   | 14 +++---
 arch/arm/dts/rk3568.dtsi           | 72 ++++++++++--------------------
 drivers/usb/dwc3/core.c            | 50 ++++++++++++++++-----
 4 files changed, 71 insertions(+), 72 deletions(-)
arch/arm/dts/rk3568-bpi-r2-pro.dts +2 -5
index db13f00cd0..da76ab64c1 100644
@@ -560,16 +560,13 @@
 	status = "okay";
 };
 
-&usbdrd_dwc3 {
+&usb_host0_xhci {
 	dr_mode = "host";
 	extcon = <&usb2phy0>;
-};
-
-&usbdrd30 {
 	status = "okay";
 };
 
-&usbhost30 {
+&usb_host1_xhci {
 	status = "okay";
 };
 
arch/arm/dts/rk3568-evb1-v10.dts +5 -9
index 4ded9b1735..df5633978d 100644
@@ -547,24 +547,20 @@
 	status = "okay";
 };
 
-&usb_host1_ehci {
+&usb_host0_xhci {
+	extcon = <&usb2phy0>;
 	status = "okay";
 };
 
-&usb_host1_ohci {
+&usb_host1_ehci {
 	status = "okay";
 };
 
-&usbdrd_dwc3 {
-	dr_mode = "otg";
-	extcon = <&usb2phy0>;
-};
-
-&usbdrd30 {
+&usb_host1_ohci {
 	status = "okay";
 };
 
-&usbhost30 {
+&usb_host1_xhci {
 	status = "okay";
 };
 
arch/arm/dts/rk3568.dtsi +24 -48

86 lines not on this page · raw message

drivers/usb/dwc3/core.c +40 -10

90 lines not on this page · raw message

Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Michael Riesch

Hi,

Quoted 5 lines

Gesendet: Montag, 09. Mai 2022 um 13:36 Uhr
Von: "Michael Riesch" <[email protected]>

The changes are tested exclusively on the RK3568 EVB1 -- Frank, if you could give this a test on the BananaPi it would be great.

currently usb on r2pro v1 is broken in barebox. Have got it working for upper port and then applied this series. It does not seem to break anything, upper port still working in my local repo (based on master).

Quoted 4 lines

Looking forward to your comments!

Best regards,
Michael

regards Frank

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Applied
#4 lore raw
In reply to Michael Riesch
Quoted 13 lines · Michael Riesch

Hi all,

These patches align the barebox drivers for the Naneng Combo PHY and the dwc3 with the current device tree bindings in mainline Linux. Thereby, the migration from the initial device tree files related to the RK3568 EVB1 and the BananaPi R2Pro to their equivalents in mainline Linux is facilitated.

In order to ensure compatibility, the initial device tree files in arch/arm/dts are adjusted accordingly.

The changes are tested exclusively on the RK3568 EVB1 -- Frank, if you could give this a test on the BananaPi it would be great.

Quoted 8 lines

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (2):
phy: rockchip: align naneng-combphy clocks and resets with binding
usb: dwc3: align dwc3 clocks with binding

Applied, thanks

Sascha

Quoted 17 lines
 arch/arm/dts/rk3568-bpi-r2-pro.dts            |  7 +-
 arch/arm/dts/rk3568-evb1-v10.dts              | 14 ++--
 arch/arm/dts/rk3568.dtsi                      | 82 +++++++------------
 .../rockchip/phy-rockchip-naneng-combphy.c    | 19 +----
 drivers/usb/dwc3/core.c                       | 50 ++++++++---
 5 files changed, 79 insertions(+), 93 deletions(-)
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox