Re: [PATCH v2 2/2] arm64: dts: rockchip: Add Xunlong Orange Pi 3B
From: Jonas Karlman
Date: Sat Mar 08 2025 - 11:34:46 EST
Hi Arturas,
On 2025-03-08 15:53, Arturas Moskvinas wrote:
> On 6/27/24 2:03 AM, Jonas Karlman wrote:
>
>> The Xunlong Orange Pi 3B is a single-board computer based on the
>> Rockchip RK3566 SoC.
> ...> +
>> +&gmac1 {
>> + phy-handle = <&rgmii_phy1>;
>> + status = "okay";
>> +};
>> +
>> +&mdio1 {
>> + rgmii_phy1: ethernet-phy@1 {
>> + compatible = "ethernet-phy-ieee802.3-c22";
>> + reg = <1>;
>
> Jonas, were you able to test V1.1 board's Ethernet?
Yes, I have both a v1.1.1 and v2.1 hw revision of this board and
Ethernet should be working on both hw revisions.
>
> Whenever I start the board - Ethernet initialization fails with:
> ```
> [ 21.140055] rk_gmac-dwmac fe010000.ethernet eth0: __stmmac_open:
> Cannot attach to PHY (error: -19)
> ```
This is because of a reset issue with Ethernet PHYs in Linux, see [1].
Two workarounds:
1. Let boot firmware reset the PHY before Linux, i.e. use U-Boot
v2024.10 or newer.
2. Use a ethernet-phy-id compatible with correct phy-id to force Linux
to attach the PHY.
I suggest you try to wipe U-Boot from SPI flash on your board and update
to use U-Boot v2025.01 and try again.
>
> But if reset is performed inside gmac - initialization succeeds.
Use of deprecated snps,reset- props is not a proper fix for this issue,
instead Linux could use an improve Ethernet PHY initialization handling
and ensuring the PHY is reset before it tries to read a phy-id from it.
[1] https://lore.kernel.org/r/47d55aca-bee6-810f-379f-9431649fefa6@xxxxxxxxx/
Regards,
Jonas
>
> Eg. patch:
> ```
> ---
> linux-6.12.17.orig/arch/arm64/boot/dts/rockchip/rk3566-orangepi-3b-v1.1.dts
> +++ linux-6.12.17/arch/arm64/boot/dts/rockchip/rk3566-orangepi-3b-v1.1.dts
> @@ -16,14 +16,14 @@
> &gmac1 {
> phy-handle = <&rgmii_phy1>;
> status = "okay";
> + snps,reset-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
> + snps,reset-active-low;
> + snps,reset-delays-us = <0 50000 200000>;
> };
>
> &mdio1 {
> rgmii_phy1: ethernet-phy@1 {
> compatible = "ethernet-phy-ieee802.3-c22";
> reg = <1>;
> - reset-assert-us = <20000>;
> - reset-deassert-us = <50000>;
> - reset-gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
> };
> };
> ```
>> + reset-assert-us = <20000>;
>> + reset-deassert-us = <50000>;
>> + reset-gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
>> + };
>> +};
>
>
> Arturas Moskvinas