From: Chukun Pan Date: Thu, 4 Jun 2026 12:26:19 +0000 (+0800) Subject: rockchip: replace rk3528 usb patch with upstream X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c97b4da1a83c6943cf01b1073bc4adfe58ff862e;p=thirdparty%2Fopenwrt.git rockchip: replace rk3528 usb patch with upstream Replace the RK3528 USB driver and DT patch with the upstream version. Signed-off-by: Chukun Pan Link: https://github.com/openwrt/openwrt/pull/23770 Signed-off-by: Jonas Jelonek --- diff --git a/target/linux/rockchip/patches-6.18/160-01-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-handling.patch b/target/linux/rockchip/patches-6.18/039-1-v7.2-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-hand.patch similarity index 95% rename from target/linux/rockchip/patches-6.18/160-01-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-handling.patch rename to target/linux/rockchip/patches-6.18/039-1-v7.2-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-hand.patch index a16fedf8b52..281f3dd83e9 100644 --- a/target/linux/rockchip/patches-6.18/160-01-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-handling.patch +++ b/target/linux/rockchip/patches-6.18/039-1-v7.2-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-hand.patch @@ -1,7 +1,8 @@ -From 4e7d472b61625804f585035a54364a6620bf803a Mon Sep 17 00:00:00 2001 +From be29cd958f5393004a24cd7b5b1da88dd90a651b Mon Sep 17 00:00:00 2001 From: Jonas Karlman -Date: Wed, 23 Jul 2025 12:23:00 +0000 -Subject: [PATCH] phy: rockchip: inno-usb2: Simplify rockchip,usbgrf handling +Date: Tue, 5 May 2026 19:04:07 +0200 +Subject: [PATCH] phy: rockchip: inno-usb2: Simplify rockchip,usbgrf + handling The logic to decide if usbgrf or grf should be used is more complex than it needs to be. For RK3568, RV1108 and soon RK3528 we can assign the @@ -15,6 +16,10 @@ The only expected change from this is that RK3528 can be supported because of an addition of a of_property_present() check. Signed-off-by: Jonas Karlman +Signed-off-by: Heiko Stuebner +Reviewed-by: Neil Armstrong +Link: https://patch.msgid.link/20260505170410.3265305-3-heiko@sntech.de +Signed-off-by: Vinod Koul --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 68 +++++-------------- 1 file changed, 18 insertions(+), 50 deletions(-) diff --git a/target/linux/rockchip/patches-6.18/160-02-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch b/target/linux/rockchip/patches-6.18/039-2-v7.2-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch similarity index 92% rename from target/linux/rockchip/patches-6.18/160-02-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch rename to target/linux/rockchip/patches-6.18/039-2-v7.2-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch index b977ae1130c..f10df5409e3 100644 --- a/target/linux/rockchip/patches-6.18/160-02-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch +++ b/target/linux/rockchip/patches-6.18/039-2-v7.2-phy-rockchip-inno-usb2-Add-clkout_ctl_phy-support.patch @@ -1,6 +1,6 @@ -From 6b767459cf9295f10ee95b8ab78fbce5991132ed Mon Sep 17 00:00:00 2001 +From 2775541de0580ab1cd077dfef710e6316563d567 Mon Sep 17 00:00:00 2001 From: Jonas Karlman -Date: Wed, 23 Jul 2025 12:23:02 +0000 +Date: Tue, 5 May 2026 19:04:09 +0200 Subject: [PATCH] phy: rockchip: inno-usb2: Add clkout_ctl_phy support The 480m clk is controlled using regs in the PHY address space and not @@ -10,6 +10,10 @@ Add a clkout_ctl_phy usb2phy_reg to handle enable/disable of the 480m clk on these SoCs. Signed-off-by: Jonas Karlman +Signed-off-by: Heiko Stuebner +Reviewed-by: Neil Armstrong +Link: https://patch.msgid.link/20260505170410.3265305-5-heiko@sntech.de +Signed-off-by: Vinod Koul --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/target/linux/rockchip/patches-6.18/160-03-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch b/target/linux/rockchip/patches-6.18/039-3-v7.2-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch similarity index 75% rename from target/linux/rockchip/patches-6.18/160-03-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch rename to target/linux/rockchip/patches-6.18/039-3-v7.2-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch index bce862b9134..08bccd70ec3 100644 --- a/target/linux/rockchip/patches-6.18/160-03-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch +++ b/target/linux/rockchip/patches-6.18/039-3-v7.2-phy-rockchip-inno-usb2-Add-support-for-RK3528.patch @@ -1,6 +1,6 @@ -From 8faac4ef6206a1c771e1c016e205dcee8164d618 Mon Sep 17 00:00:00 2001 +From 864b3617df827865a95a06f06f09a8d57a795b91 Mon Sep 17 00:00:00 2001 From: Jianwei Zheng -Date: Wed, 23 Jul 2025 12:23:03 +0000 +Date: Tue, 5 May 2026 19:04:10 +0200 Subject: [PATCH] phy: rockchip: inno-usb2: Add support for RK3528 The RK3528 has a single USB2PHY with a otg and host port. @@ -18,46 +18,61 @@ PHY tuning for RK3528: which uses dwc3 controller to improve fs/ls devices compatibility with long cables. -This is based on vendor kernel linux-stan-6.1-rkr5 tag. +Undocumented magic-values are based on the linux-stan-6.1-rkr5 tag of +the vendor-kernel. Signed-off-by: Jianwei Zheng Signed-off-by: Jonas Karlman +Signed-off-by: Heiko Stuebner +Reviewed-by: Neil Armstrong +Link: https://patch.msgid.link/20260505170410.3265305-6-heiko@sntech.de +Signed-off-by: Vinod Koul --- - drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 74 +++++++++++++++++++ - 1 file changed, 74 insertions(+) + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 84 +++++++++++++++++++ + 1 file changed, 84 insertions(+) --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -@@ -1511,6 +1511,28 @@ static int rk3128_usb2phy_tuning(struct +@@ -1511,6 +1511,38 @@ static int rk3128_usb2phy_tuning(struct BIT(2) << BIT_WRITEABLE_SHIFT | 0); } +static int rk3528_usb2phy_tuning(struct rockchip_usb2phy *rphy) +{ -+ int ret = 0; ++ int ret; + + /* Turn off otg port differential receiver in suspend mode */ -+ ret |= regmap_write(rphy->phy_base, 0x30, BIT(18) | 0x0000); ++ ret = regmap_write(rphy->phy_base, 0x30, BIT(18) | 0x0000); ++ if (ret) ++ return ret; + + /* Turn off host port differential receiver in suspend mode */ -+ ret |= regmap_write(rphy->phy_base, 0x430, BIT(18) | 0x0000); ++ ret = regmap_write(rphy->phy_base, 0x430, BIT(18) | 0x0000); ++ if (ret) ++ return ret; + + /* Set otg port HS eye height to 400mv (default is 450mv) */ -+ ret |= regmap_write(rphy->phy_base, 0x30, GENMASK(22, 20) | 0x0000); ++ ret = regmap_write(rphy->phy_base, 0x30, GENMASK(22, 20) | 0x0000); ++ if (ret) ++ return ret; + + /* Set host port HS eye height to 400mv (default is 450mv) */ -+ ret |= regmap_write(rphy->phy_base, 0x430, GENMASK(22, 20) | 0x0000); ++ ret = regmap_write(rphy->phy_base, 0x430, GENMASK(22, 20) | 0x0000); ++ if (ret) ++ return ret; + + /* Choose the Tx fs/ls data as linestate from TX driver for otg port */ -+ ret |= regmap_write(rphy->phy_base, 0x94, GENMASK(22, 19) | 0x0018); ++ ret = regmap_write(rphy->phy_base, 0x94, GENMASK(22, 19) | 0x0018); ++ if (ret) ++ return ret; + -+ return ret; ++ return 0; +} + static int rk3576_usb2phy_tuning(struct rockchip_usb2phy *rphy) { int ret; -@@ -1924,6 +1946,57 @@ static const struct rockchip_usb2phy_cfg +@@ -1924,6 +1956,57 @@ static const struct rockchip_usb2phy_cfg { /* sentinel */ } }; @@ -115,7 +130,7 @@ Signed-off-by: Jonas Karlman static const struct rockchip_usb2phy_cfg rk3562_phy_cfgs[] = { { .reg = 0xff740000, -@@ -2291,6 +2364,7 @@ static const struct of_device_id rockchi +@@ -2291,6 +2374,7 @@ static const struct of_device_id rockchi { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs }, { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, diff --git a/target/linux/rockchip/patches-6.18/163-02-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch b/target/linux/rockchip/patches-6.18/073-1-v7.2-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch similarity index 78% rename from target/linux/rockchip/patches-6.18/163-02-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch rename to target/linux/rockchip/patches-6.18/073-1-v7.2-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch index 041cb4f3d1d..95972977f0d 100644 --- a/target/linux/rockchip/patches-6.18/163-02-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch +++ b/target/linux/rockchip/patches-6.18/073-1-v7.2-arm64-dts-rockchip-Add-USB-nodes-for-RK3528.patch @@ -1,23 +1,28 @@ -From a41519d8b438adc154debd433c3a1436ebb93a10 Mon Sep 17 00:00:00 2001 +From 5f3ae9b12a6c523992a7216bbc4420ac33450b79 Mon Sep 17 00:00:00 2001 From: Jonas Karlman -Date: Wed, 23 Jul 2025 12:23:05 +0000 +Date: Fri, 29 May 2026 21:03:51 +0200 Subject: [PATCH] arm64: dts: rockchip: Add USB nodes for RK3528 -Rockchip RK3528 has one USB 3.0 DWC3 controller, a USB 2.0 EHCI/OHCI -controller and uses a USB2PHY for USB 2.0. The DWC3 controller may also -use the Naneng Combo PHY for USB3. +Rockchip RK3528 has one USB 3.0 DWC3 controller and oneUSB 2.0 EHCI/OHCI +controller and uses an Innosilicon-USB2PHY for USB 2.0. The DWC3 +controller additionally uses the Naneng Combo PHY for USB3. Add device tree nodes to describe these USB controllers along with the USB 2.0 PHYs. +[moved snps,dis_u2_susphy_quirk here from individual boards, + describe both usb2+3 default phy connections, usb2 boards can override] + Signed-off-by: Jonas Karlman +Signed-off-by: Heiko Stuebner +Link: https://patch.msgid.link/20260529190355.4148175-2-heiko@sntech.de --- - arch/arm64/boot/dts/rockchip/rk3528.dtsi | 77 ++++++++++++++++++++++++ - 1 file changed, 77 insertions(+) + arch/arm64/boot/dts/rockchip/rk3528.dtsi | 80 ++++++++++++++++++++++++ + 1 file changed, 80 insertions(+) --- a/arch/arm64/boot/dts/rockchip/rk3528.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3528.dtsi -@@ -336,6 +336,30 @@ +@@ -336,6 +336,33 @@ }; }; @@ -32,6 +37,8 @@ Signed-off-by: Jonas Karlman + power-domains = <&power RK3528_PD_VPU>; + resets = <&cru SRST_A_USB3OTG>; + dr_mode = "otg"; ++ phys = <&usb2phy_otg>, <&combphy PHY_TYPE_USB3>; ++ phy-names = "usb2-phy", "usb3-phy"; + phy_type = "utmi_wide"; + snps,dis_enblslpm_quirk; + snps,dis_rxdet_inp3_quirk; @@ -40,6 +47,7 @@ Signed-off-by: Jonas Karlman + snps,dis-u1-entry-quirk; + snps,dis-u2-entry-quirk; + snps,dis-u2-freeclk-exists-quirk; ++ snps,dis_u2_susphy_quirk; + snps,parkmode-disable-hs-quirk; + snps,parkmode-disable-ss-quirk; + status = "disabled"; @@ -48,7 +56,7 @@ Signed-off-by: Jonas Karlman gic: interrupt-controller@fed01000 { compatible = "arm,gic-400"; reg = <0x0 0xfed01000 0 0x1000>, -@@ -349,6 +373,30 @@ +@@ -349,6 +376,30 @@ #interrupt-cells = <3>; }; @@ -79,7 +87,7 @@ Signed-off-by: Jonas Karlman qos_crypto_a: qos@ff200000 { compatible = "rockchip,rk3528-qos", "syscon"; reg = <0x0 0xff200000 0x0 0x20>; -@@ -1275,6 +1323,35 @@ +@@ -1273,6 +1324,35 @@ rockchip,pipe-phy-grf = <&pipe_phy_grf>; status = "disabled"; }; diff --git a/target/linux/rockchip/patches-6.18/164-arm64-dts-rockchip-Enable-USB-2-0-ports-on-Radxa-E20C.patch b/target/linux/rockchip/patches-6.18/073-2-v7.2-arm64-dts-rockchip-Enable-USB-2.0-ports-on-Radxa-E20.patch similarity index 61% rename from target/linux/rockchip/patches-6.18/164-arm64-dts-rockchip-Enable-USB-2-0-ports-on-Radxa-E20C.patch rename to target/linux/rockchip/patches-6.18/073-2-v7.2-arm64-dts-rockchip-Enable-USB-2.0-ports-on-Radxa-E20.patch index 24e690c7cd5..bb4ba5b7fb8 100644 --- a/target/linux/rockchip/patches-6.18/164-arm64-dts-rockchip-Enable-USB-2-0-ports-on-Radxa-E20C.patch +++ b/target/linux/rockchip/patches-6.18/073-2-v7.2-arm64-dts-rockchip-Enable-USB-2.0-ports-on-Radxa-E20.patch @@ -1,21 +1,28 @@ -From d78af3aa816344d6e76dd77fbaf410fcbfa58bef Mon Sep 17 00:00:00 2001 +From e897bcf81dd920bf80ace6d98ec6f9645c5b50f2 Mon Sep 17 00:00:00 2001 From: Jonas Karlman -Date: Wed, 23 Jul 2025 12:23:06 +0000 +Date: Fri, 29 May 2026 21:03:52 +0200 Subject: [PATCH] arm64: dts: rockchip: Enable USB 2.0 ports on Radxa E20C -The Radxa E20C has one USB2.0 Type-A HOST port and one USB2.0 Type-C OTG -port. +The Radxa E20C has one USB2.0 Type-A HOST port and one USB2.0 Type-C port. + +The Type-C port is conneced to a FE1.1s_QFN USB hub on the board, with its +ports being connected to the XHCI usb controller and an usb-uart bridge. + +This also means, the XHCI controller can only be used in device-mode. Add support for using the USB 2.0 ports on Radxa E20C. Signed-off-by: Jonas Karlman +[set xhci to peripheral and add comment about the outward-facing hub] +Signed-off-by: Heiko Stuebner +Link: https://patch.msgid.link/20260529190355.4148175-3-heiko@sntech.de --- - .../boot/dts/rockchip/rk3528-radxa-e20c.dts | 48 +++++++++++++++++++ - 1 file changed, 48 insertions(+) + .../boot/dts/rockchip/rk3528-radxa-e20c.dts | 60 +++++++++++++++++++ + 1 file changed, 60 insertions(+) --- a/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts +++ b/arch/arm64/boot/dts/rockchip/rk3528-radxa-e20c.dts -@@ -136,6 +136,18 @@ +@@ -134,6 +134,18 @@ regulator-max-microvolt = <5000000>; }; @@ -34,7 +41,7 @@ Signed-off-by: Jonas Karlman vccio_sd: regulator-vccio-sd { compatible = "regulator-gpio"; gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; -@@ -275,6 +287,12 @@ +@@ -273,6 +285,12 @@ rockchip,pins = <4 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>; }; }; @@ -47,7 +54,7 @@ Signed-off-by: Jonas Karlman }; &pwm1 { -@@ -322,3 +340,33 @@ +@@ -320,3 +338,45 @@ pinctrl-0 = <&uart0m0_xfer>; status = "okay"; }; @@ -60,12 +67,24 @@ Signed-off-by: Jonas Karlman + status = "okay"; +}; + ++/* ++ * The usb controller can only work in peripheral mode, as it is ++ * connected to one of the ports of an outward-facing usb hub. ++ * ++ * type_c-port (hub-input) ++ * | ++ * usb-hub ++ * | | ++ * uart-usb usb-host0 ++ * | ++ * uart0 ++ */ +&usb_host0_xhci { ++ dr_mode = "peripheral"; + extcon = <&usb2phy>; + maximum-speed = "high-speed"; + phys = <&usb2phy_otg>; + phy-names = "usb2-phy"; -+ snps,dis_u2_susphy_quirk; + status = "okay"; +}; + diff --git a/target/linux/rockchip/patches-6.18/163-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch b/target/linux/rockchip/patches-6.18/161-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch similarity index 98% rename from target/linux/rockchip/patches-6.18/163-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch rename to target/linux/rockchip/patches-6.18/161-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch index 21d609e2164..2d04e6c851f 100644 --- a/target/linux/rockchip/patches-6.18/163-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch +++ b/target/linux/rockchip/patches-6.18/161-03-arm64-dts-rockchip-Add-TSADC-controller-for-RK3528.patch @@ -102,7 +102,7 @@ Signed-off-by: Jonas Karlman timer { compatible = "arm,armv8-timer"; interrupts = , -@@ -689,6 +739,7 @@ +@@ -692,6 +742,7 @@ assigned-clock-rates = <297000000>, <300000000>; clocks = <&cru ACLK_GPU_MALI>, <&scmi_clk SCMI_CLK_GPU>; clock-names = "bus", "core"; @@ -110,7 +110,7 @@ Signed-off-by: Jonas Karlman interrupts = , , , -@@ -1031,6 +1082,33 @@ +@@ -1034,6 +1085,33 @@ status = "disabled"; };