• Vladimir Oltean's avatar
    net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus · 24deec6b
    Vladimir Oltean authored
    You'd think people know that the internal 100BASE-TX PHY on the SJA1110
    responds only to clause 22 MDIO transactions, but they don't :)
    
    When a clause 45 transaction is attempted, sja1105_base_tx_mdio_read()
    and sja1105_base_tx_mdio_write() don't expect "reg" to contain bit 30
    set (MII_ADDR_C45) and pack this value into the SPI transaction buffer.
    
    But the field in the SPI buffer has a width smaller than 30 bits, so we
    see this confusing message from the packing() API rather than a proper
    rejection of C45 transactions:
    
    Call trace:
     dump_stack+0x1c/0x38
     sja1105_pack+0xbc/0xc0 [sja1105]
     sja1105_xfer+0x114/0x2b0 [sja1105]
     sja1105_xfer_u32+0x44/0xf4 [sja1105]
     sja1105_base_tx_mdio_read+0x44/0x7c [sja1105]
     mdiobus_read+0x44/0x80
     get_phy_c45_ids+0x70/0x234
     get_phy_device+0x68/0x15c
     fwnode_mdiobus_register_phy+0x74/0x240
     of_mdiobus_register+0x13c/0x380
     sja1105_mdiobus_register+0x368/0x490 [sja1105]
     sja1105_setup+0x94/0x119c [sja1105]
    Cannot store 401d2405 inside bits 24-4 (would truncate)
    
    Fixes: 5a8f0974 ("net: dsa: sja1105: register the MDIO buses for 100base-T1 and 100base-TX")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    24deec6b
sja1105_mdio.c 12.1 KB