Known issueEthernet

Rockchip Ethernet "Cannot attach to PHY (error: -19)": Fix

stmmac_open: Cannot attach to PHY (error: -19)

The GMAC (stmmac) driver could not find the Ethernet PHY on the MDIO bus. -19 is ENODEV: the PHY never answered.

Applies to: RK3588 RK3588S RK3576 RK3568 RK3566 RK3399 RK3328 RK3288

Symptoms

  • ip link set eth0 up fails, and dmesg shows "Cannot attach to PHY (error: -19)"
  • No PHY ID under /sys/bus/mdio_bus/devices

Common causes

  • PHY held in reset: wrong reset GPIO, polarity or too-short reset delays
  • PHY unpowered or missing its 25 MHz crystal
  • Wrong PHY address (reg) vs hardware straps
  • MDIO/MDC pinctrl not applied
  • phy-handle points at the wrong node

How to fix it

  1. See what the MDIO bus found
    dmesg | grep -iE 'stmmac|dwmac|mdio|phy'
    cat /sys/bus/mdio_bus/devices/*/phy_id 2>/dev/null
  2. Fix reset timing and address
    &mdio0 {
        rgmii_phy: ethernet-phy@1 {
            compatible = "ethernet-phy-ieee802.3-c22";
            reg = <0x1>;              /* must match PHY address straps */
            reset-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>;
            reset-assert-us = <20000>;
            reset-deassert-us = <100000>;
        };
    };
  3. Measure the hardware

    Check PHY supply rails and the 25 MHz clock with a scope; confirm the reset line toggles at boot.

Go deeper

FAQ

What does "stmmac_open: Cannot attach to PHY (error: -19)" mean?

The GMAC (stmmac) driver could not find the Ethernet PHY on the MDIO bus. -19 is ENODEV: the PHY never answered.

What causes "stmmac_open: Cannot attach to PHY (error: -19)"?

PHY held in reset: wrong reset GPIO, polarity or too-short reset delays; PHY unpowered or missing its 25 MHz crystal; Wrong PHY address (reg) vs hardware straps; MDIO/MDC pinctrl not applied; phy-handle points at the wrong node.

How do I fix "stmmac_open: Cannot attach to PHY (error: -19)"?

1. See what the MDIO bus found 2. Fix reset timing and address 3. Measure the hardware: Check PHY supply rails and the 25 MHz clock with a scope; confirm the reset line toggles at boot.

Related issues

Rockchip 기반 제품을 개발 중이신가요?

하드웨어 설계부터 Linux, Android, AI 통합까지 Rockchip 프로젝트를 위한 엔지니어링 지원을 받으세요.