• Martin Blumenstingl's avatar
    mdio: mux: fix parsing mux registers outside of the PHY address range · 457839ed
    Martin Blumenstingl authored
    mdio_mux_init parses the child nodes of the MDIO mux. When using
    "mdio-mux-mmioreg" the child nodes are describing the register value
    that is written to switch between the MDIO busses.
    
    The change which makes the error messages more verbose changed the
    parsing of the "reg" property from a simple of_property_read_u32 call
    to of_mdio_parse_addr. On a Khadas VIM (based on the Meson GXL SoC,
    which uses mdio-mux-mmioreg) this prevents registering the MDIO mux
    (because the "reg" values on the MDIO mux child nodes are 0x2009087f
    and 0xe40908ff) and leads to the following errors:
      mdio-mux-mmioreg c883455c.eth-phy-mux: /soc/periphs@c8834000/eth-phy-mux/mdio@e40908ff PHY address -469169921 is too large
      mdio-mux-mmioreg c883455c.eth-phy-mux: Error: Failed to find reg for child /soc/periphs@c8834000/eth-phy-mux/mdio@e40908ff
      mdio-mux-mmioreg c883455c.eth-phy-mux: /soc/periphs@c8834000/eth-phy-mux/mdio@2009087f PHY address 537462911 is too large
      mdio-mux-mmioreg c883455c.eth-phy-mux: Error: Failed to find reg for child /soc/periphs@c8834000/eth-phy-mux/mdio@2009087f
      mdio-mux-mmioreg c883455c.eth-phy-mux: Error: No acceptable child buses found
      mdio-mux-mmioreg c883455c.eth-phy-mux: failed to register mdio-mux bus /soc/periphs@c8834000/eth-phy-mux
    (as a result of that ethernet is not working, because the PHY which is
    connected through the mux' child MDIO bus, which is not being
    registered).
    
    Fix this by reverting the change from of_mdio_parse_addr to
    of_mdio_parse_addr.
    
    Fixes: 342fa196 ("mdio: mux: make child bus walking more permissive and errors more verbose")
    Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
    Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    457839ed
mdio-mux.c 5.15 KB