Patch courtesy of OpenWRT. For the Marvell switch, four ports are used as LAN ports. The PHY addresses for the four LAN ports are 16, 17, 18 and 19. The CPU mac is connected to the Marvell switch port via direct MII interface, thus there is no PHY. This link is always on, and is full duplex. The MAC driver should be modified not to check for PHY's link and duplex status. There is no need to check for PHY 16-19 too. This patch (originated from compex) modifies the MAC driver to work with such a switch - it will not probe for the PHY if the PHY no is set to -1. Signed-off-by: Imre Kaloz Signed-off-by: Rod Whitby --- drivers/net/ixp4xx/mac_driver.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) Index: linux-2.6.21.1-arm/drivers/net/ixp4xx/mac_driver.c =================================================================== --- linux-2.6.21.1-arm.orig/drivers/net/ixp4xx/mac_driver.c +++ linux-2.6.21.1-arm/drivers/net/ixp4xx/mac_driver.c @@ -161,6 +161,16 @@ { struct mac_info *mac = netdev_priv(dev); + if ( mac->mii.phy_id < 0 ) { + if ( init ) { + netif_carrier_on(mac->mii.dev); + mac->mii.full_duplex = 1; + update_duplex_mode(dev); + return 1; + } + return 0; + } + if (mii_check_media(&mac->mii, netif_msg_link(mac), init)) { update_duplex_mode(dev); return 1; @@ -448,7 +458,12 @@ return -EINVAL; if (!try_module_get(THIS_MODULE)) return -ENODEV; - rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed); + if ( mac->mii.phy_id < 0 ) { + duplex_changed = 0; + rc = -EOPNOTSUPP; + } else { + rc = generic_mii_ioctl(&mac->mii, if_mii(rq), cmd, &duplex_changed); + } module_put(THIS_MODULE); if (duplex_changed) update_duplex_mode(dev); @@ -478,6 +493,9 @@ static int ixmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mac_info *mac = netdev_priv(dev); + if ( mac->mii.phy_id < 0 ) { + return 0; + } mii_ethtool_gset(&mac->mii, cmd); return 0; } @@ -486,6 +504,9 @@ { struct mac_info *mac = netdev_priv(dev); int rc; + if ( mac->mii.phy_id < 0 ) { + return -EOPNOTSUPP; + } rc = mii_ethtool_sset(&mac->mii, cmd); return rc; } @@ -493,12 +514,18 @@ static int ixmac_nway_reset(struct net_device *dev) { struct mac_info *mac = netdev_priv(dev); + if ( mac->mii.phy_id < 0 ) { + return -EOPNOTSUPP; + } return mii_nway_restart(&mac->mii); } static u32 ixmac_get_link(struct net_device *dev) { struct mac_info *mac = netdev_priv(dev); + if ( mac->mii.phy_id < 0 ) { + return 1; + } return mii_link_ok(&mac->mii); }