On 10 April 2011 12:09, Peter Lebbing <pe...@digitalbrains.com> wrote:
> So, do you have any ideas on the best way to properly handle this PHY that 
> looks
> like 32 PHYs?

Take a look at ar71xx, they define a (machine dependent) phy mask for
each eth that says at which phy addresses a device may attach.

e.g. the rs pro setup code has:

        ar71xx_add_device_mdio(~(UBNT_RSPRO_WAN_PHYMASK |
                                 UBNT_RSPRO_LAN_PHYMASK));

        ar71xx_init_mac(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, 0);
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
        ar71xx_eth0_data.phy_mask = UBNT_RSPRO_WAN_PHYMASK;

        ubnt_init_secondary_mac(ar71xx_mac_base);
        ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
        ar71xx_eth1_data.phy_mask = UBNT_RSPRO_LAN_PHYMASK;
        ar71xx_eth1_data.speed = SPEED_1000;
        ar71xx_eth1_data.duplex = DUPLEX_FULL;

This results that only for one of the "allowed" phy masks a phy driver
gets attached:

static int ag71xx_phy_connect_multi(struct ag71xx *ag)
{
(...)
       for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
                if (!(pdata->phy_mask & (1 << phy_addr)))
                        continue;

                if (ag->mii_bus->phy_map[phy_addr] == NULL)
                        continue;

               if (phydev == NULL)
                        phydev = ag->mii_bus->phy_map[phy_addr];
        }
(...)
        ag->phy_dev = phy_connect(dev, dev_name(&phydev->dev),
                                  &ag71xx_phy_link_adjust, 0,
                                  pdata->phy_if_mode);
(...)
}


Of course this assumes you already know which device you have.

Regards
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to