arm64: dts: rockchip: fix GMAC clocks and USB OTG power on RK3568 boards
Subsystems (3)
cover arm64: dts: rockchip: fix GMAC clocks and USB OTG power on RK3568 boards
This series fixes two classes of board-level issues found while bringing up several RK3568 boards.
The first four patches address GMAC clock parents. On these boards the DTS lists SCLK_GMACx in assigned-clocks but only provides a parent for SCLK_GMACx_RX_TX, so SCLK_GMACx keeps whatever parent the bootloader or the hardware reset left. Add CLK_MACx_2TOP explicitly so the GMAC main clock always comes from the internal source. BPI-R2 Pro additionally describes clock_in_out wrongly ("input" while the port is a fixed-link with no external 125 MHz clock); switch it to "output" to match the hardware. On RK3568 clock_in_out does not change the hardware clock routing today, so that part is a description fix.
The last patch fixes USB OTG power on the Ariaboard Photonicat. On battery power the USB port is dead because usb2phy0_otg is fed from a regulator that only exists when the DC input is present. Add a boost regulator gated by the existing vcc5v0_usb30_otg0 rail and switch the PHY supply to it, restoring USB host functionality on battery.
---
Coia Prant (5):
arm64: dts: rockchip: fix GMAC clock parents on 9Tripod X3568 v4
arm64: dts: rockchip: fix GMAC clock parents on Graperain G3568 v2
arm64: dts: rockchip: fix GMAC clock setup on BPI-R2 Pro
arm64: dts: rockchip: fix GMAC clock parent on Photonicat
arm64: dts: rockchip: fix USB OTG power on Photonicat in battery mode
.../dts/rockchip/rk3568-9tripod-x3568-v4.dts | 4 ++-- .../boot/dts/rockchip/rk3568-bpi-r2-pro.dts | 4 +++- .../rockchip/rk3568-graperain-g3568-v2.dts | 4 ++-- .../boot/dts/rockchip/rk3568-photonicat.dts | 21 +++++++++++++++++-- 4 files changed, 26 insertions(+), 7 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/5 arm64: dts: rockchip: fix GMAC clock parents on 9Tripod X3568 v4
Both GMAC nodes list SCLK_GMACx in assigned-clocks, but only SCLK_GMACx_RX_TX gets a parent in assigned-clock-parents. SCLK_GMACx therefore keeps whatever parent the bootloader or the hardware reset left, which may or may not be the internal CLK_MACx_2TOP.
Add CLK_MACx_2TOP as the parent of SCLK_GMACx explicitly, so the GMAC main clock always comes from the internal clock source and does not depend on the bootloader state. The rate assignment is unchanged:SCLK_GMACx_RX_TX stays at 0 (managed at runtime by rk_set_clk_tx_rate()), SCLK_GMACx stays at 125 MHz.
--- arch/arm64/boot/dts/rockchip/rk3568-9tripod-x3568-v4.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-9tripod-x3568-v4.dts +2 -2
@@ -268,7 +268,7 @@ &cpu3 { &gmac0 { assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; - assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>; assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; pinctrl-names = "default";
@@ -284,7 +284,7 @@ &gmac0_rgmii_clk &gmac1 { assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; - assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; pinctrl-names = "default";
Signature · 1 line
2.47.3
PATCH 2/5 arm64: dts: rockchip: fix GMAC clock parents on Graperain G3568 v2
In reply to Coia PrantBoth GMAC nodes list SCLK_GMACx in assigned-clocks, but only SCLK_GMACx_RX_TX gets a parent in assigned-clock-parents. SCLK_GMACx therefore keeps whatever parent the bootloader or the hardware reset left, which may or may not be the internal CLK_MACx_2TOP.
Add CLK_MACx_2TOP as the parent of SCLK_GMACx explicitly, so the GMAC main clock always comes from the internal clock source and does not depend on the bootloader state. The rate assignment is unchanged:SCLK_GMACx_RX_TX stays at 0 (managed at runtime by rk_set_clk_tx_rate()), SCLK_GMACx stays at 125 MHz.
--- arch/arm64/boot/dts/rockchip/rk3568-graperain-g3568-v2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3568-graperain-g3568-v2.dts +2 -2
@@ -280,7 +280,7 @@ &cpu3 { &gmac0 { assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; - assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>; + assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>; assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; pinctrl-names = "default";
@@ -296,7 +296,7 @@ &gmac0_rgmii_clk &gmac1 { assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; - assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; pinctrl-names = "default";
Signature · 1 line
2.47.3
PATCH 3/5 arm64: dts: rockchip: fix GMAC clock setup on BPI-R2 Pro
In reply to Coia PrantBoth GMAC nodes rely on the internal 125 MHz GMAC main clock, but neither pins its rate explicitly. Add assigned-clock-rates = <0>, <125000000> so SCLK_GMACx is fixed at 125 MHz instead of whatever the bootloader or the hardware reset left. The RGMII speed clock (SCLK_GMACx_RX_TX) stays at 0, since it is managed at runtime by rk_set_clk_tx_rate().
For gmac0, also switch clock_in_out from "input" to "output". The port uses a fixed-link, and there is no external 125 MHz clock feeding the MAC, so "input" described a clock source that is not wired up. Note that on RK3568 clock_in_out does not change the hardware clock routing today (rk3568_ops has no io_clksel masks), so this corrects the description rather than the behaviour.
--- arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts +3 -1
@@ -206,7 +206,8 @@ &combphy2 { &gmac0 { assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>; - clock_in_out = "input"; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "output"; phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&gmac0_miim
@@ -232,6 +233,7 @@ fixed-link { &gmac1 { assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; + assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; phy-handle = <&rgmii_phy1>; phy-mode = "rgmii";
Signature · 1 line
2.47.3
PATCH 4/5 arm64: dts: rockchip: fix GMAC clock parent on Photonicat
In reply to Coia PrantThe RGMII WAN port on the Ariaboard Photonicat uses SCLK_GMAC1 as the GMAC main clock and SCLK_GMAC1_RX_TX as the RGMII speed clock. Only the parent of SCLK_GMAC1_RX_TX is set, so SCLK_GMAC1 keeps whatever parent the bootloader or the hardware reset left.
Set the parent of SCLK_GMAC1 to CLK_MAC1_2TOP explicitly, so the GMAC main clock always uses the internal source and does not depend on the bootloader state. The rate assignment is unchanged: SCLK_GMAC1_RX_TX keeps its rate unset, SCLK_GMAC1 stays at 125 MHz.
--- arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +1 -1
@@ -285,7 +285,7 @@ &gmac0 { /* Motorcomm YT8521SC WAN port */ &gmac1 { assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; - assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; assigned-clock-rates = <0>, <125000000>; clock_in_out = "output"; phy-handle = <&rgmii_phy>;
Signature · 1 line
2.47.3
PATCH 5/5 arm64: dts: rockchip: fix USB OTG power on Photonicat in battery mode
In reply to Coia PrantWhen the Ariaboard Photonicat runs on battery, the USB port has no power output and attached devices are not detected. With the external supply connected, the same port works fine. The root cause is that the regulator feeding usb2phy0_otg (vcc5v0_usb30_otg0) is only available from the external DC input, and there is no 5V rail for the USB PHY when the board is powered from the battery.
Add a vcc5v0_usb30_otg0_boost regulator, gated by vcc5v0_usb30_otg0, and switch usb2phy0_otg to use it as its phy-supply. The boost converter is enabled through GPIO4_D2 and generates the 5V USB VBUS from the vccin_5v rail. Note that vccin_5v is the actual energy source, while vcc5v0_usb30_otg0 gates the path; vin-supply is modelled on the gate so the regulator core enables it before the boost.
This restores USB host functionality on battery power, matching the vendor firmware behaviour.
--- .../boot/dts/rockchip/rk3568-photonicat.dts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +18 -1
@@ -151,6 +151,19 @@ vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { vin-supply = <&vccin_5v>; }; + /* actually fed by vccin_5v, dependent on vcc5v0_usb30_otg0 */ + vcc5v0_usb30_otg0_boost: regulator-vcc5v0-boost { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_boost_en>; + regulator-name = "vcc5v0_boost"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc5v0_usb30_otg0>; + }; + vccin_5v: regulator-vccin-5v { compatible = "regulator-fixed"; regulator-name = "vccin_5v";
@@ -460,6 +473,10 @@ rf_pwr_en: rf-pwr-en { usb_host_pwren_h: usb-host-pwren-h { rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; }; + + vcc5v0_boost_en: vcc5v0-boost-en { + rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; }; wifi {
@@ -617,7 +634,7 @@ &usb2phy0_host { }; &usb2phy0_otg { - phy-supply = <&vcc5v0_usb30_otg0>; + phy-supply = <&vcc5v0_usb30_otg0_boost>; status = "okay"; };
Signature · 1 line
2.47.3
Re: [PATCH 5/5] arm64: dts: rockchip: fix USB OTG power on Photonicat in battery mode
Hi,
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { · line 155
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +2
-0+ /* actually fed by vccin_5v, dependent on vcc5v0_usb30_otg0 */ + vcc5v0_usb30_otg0_boost: regulator-vcc5v0-boost {
This is incorrect from the schematic:
VBAT -> 5V_BOOST / 5V_OUT regulator
|
Boost_EN ---------
5V_OUT -----
|-> VCC5V0_USB30_OTG0 -> USB3 VBUS
VCCIN_5V --- |
|USB_HOST_PWREN_H -------
So you should modify the vin-supply of vcc5v0_usb30_otg0.
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { · line 161
Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +1
-0+ regulator-name = "vcc5v0_boost";
vcc5v_boost
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { · line 165
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +2
-0+ vin-supply = <&vcc5v0_usb30_otg0>; + };
vccin_5v: vbat: regulator-vccin-5v {
vin-supply = <&vbat>;
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts rf_pwr_en: rf-pwr-en { · line 477
Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +1
-0+ vcc5v0_boost_en: vcc5v0-boost-en {
boost_en
Re: [PATCH 5/5] arm64: dts: rockchip: fix USB OTG power on Photonicat in battery mode
Quoted 27 lines · Chukun Pan <[email protected]> 于2026年11月2日周一 19:50写道:
Hi,
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { · line 155
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +2
-0+ /* actually fed by vccin_5v, dependent on vcc5v0_usb30_otg0 */ + vcc5v0_usb30_otg0_boost: regulator-vcc5v0-boost {This is incorrect from the schematic:
VBAT -> 5V_BOOST / 5V_OUT regulator
|
Boost_EN---------5V_OUT -----
|-> VCC5V0_USB30_OTG0 -> USB3 VBUS VCCIN_5V --- | |
USB_HOST_PWREN_H-------So you should modify the vin-supply of
vcc5v0_usb30_otg0.Quoted 1 line
+ regulator-name = "
vcc5v0_boost";
vcc5v_boostarch/arm64/boot/dts/rockchip/rk3568-photonicat.dts vcc5v0_usb30_otg0: regulator-vcc5v0-usb30-otg0 { · line 165
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +2
-0+ vin-supply = <&vcc5v0_usb30_otg0>; + };
Quoted 6 lines
vccin_5v: vbat: regulator-vccin-5v {
vin-supply = <&vbat>;Quoted 1 line
+
vcc5v0_boost_en: vcc5v0-boost-en {
boost_en
Hi,
Thanks for the schematic pointers. While reworking the USB power path, I also noticed an issue with the modem power supply.
For the USB fix, I've reworked it according to the schematic:
- Added a vbat fixed-regulator node.
- Added 5v_boost (VBAT -> 5V_BOOST via U16 and BOOST_EN).
- Added 5v_out to represent the OR-ed 5V_OUT rail (Boost via D5002 + VCCIN_5V via D16).
- Changed vcc5v0_usb30_otg0 (USB VBUS load switch) to use 5v_out as its vin-supply.
For the modem, the vcc3v4_rf regulator was incorrectly supplied by vccin_5v, which means the M.2 B-Key modem would lose power in battery mode. The schematic shows it is actually derived from vcc_syson via a ferrite bead (B1). I've changed its vin-supply to <&vcc_syson>.
I'll send out a v2 with both fixes shortly.
Thanks,
Coia