diff options
author | Felix Fietkau <nbd@openwrt.org> | 2009-03-22 20:18:36 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2009-03-22 20:18:36 +0000 |
commit | f972eb41b5eb8277139812e0af5fc00f37cdb134 (patch) | |
tree | cc3303b49d93db6a7f2f22d48bf88cbbaab20e38 /target/linux/generic-2.6/files/drivers/net/phy/adm6996.c | |
parent | 7325f7cfbb97f86220c9d7695405f150112c2bfd (diff) | |
download | mtk-20170518-f972eb41b5eb8277139812e0af5fc00f37cdb134.zip mtk-20170518-f972eb41b5eb8277139812e0af5fc00f37cdb134.tar.gz mtk-20170518-f972eb41b5eb8277139812e0af5fc00f37cdb134.tar.bz2 |
mvswitch,adm6996: use phy fixups instead of a nonstandard patch for hardware detection
SVN-Revision: 14977
Diffstat (limited to 'target/linux/generic-2.6/files/drivers/net/phy/adm6996.c')
-rw-r--r-- | target/linux/generic-2.6/files/drivers/net/phy/adm6996.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c b/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c index 3033813..972d20c 100644 --- a/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c +++ b/target/linux/generic-2.6/files/drivers/net/phy/adm6996.c @@ -105,6 +105,24 @@ static int adm6996_config_aneg(struct phy_device *phydev) return 0; } +static int adm6996_fixup(struct phy_device *dev) +{ + struct mii_bus *bus = dev->bus; + u16 reg; + + /* look for the switch on the bus */ + reg = bus->read(bus, PHYADDR(ADM_SIG0)) & ADM_SIG0_MASK; + if (reg != ADM_SIG0_VAL) + return 0; + + reg = bus->read(bus, PHYADDR(ADM_SIG1)) & ADM_SIG1_MASK; + if (reg != ADM_SIG1_VAL) + return 0; + + dev->phy_id = (ADM_SIG0_VAL << 16) | ADM_SIG1_VAL; + return 0; +} + static int adm6996_probe(struct phy_device *pdev) { struct adm6996_priv *priv; @@ -124,30 +142,12 @@ static void adm6996_remove(struct phy_device *pdev) kfree(pdev->priv); } -static bool adm6996_detect(struct mii_bus *bus, int addr) -{ - u16 reg; - - /* we only attach to phy id 0 */ - if (addr != 0) - return false; - - /* look for the switch on the bus */ - reg = bus->read(bus, PHYADDR(ADM_SIG0)) & ADM_SIG0_MASK; - if (reg != ADM_SIG0_VAL) - return false; - - reg = bus->read(bus, PHYADDR(ADM_SIG1)) & ADM_SIG1_MASK; - if (reg != ADM_SIG1_VAL) - return false; - - return true; -} static struct phy_driver adm6996_driver = { .name = "Infineon ADM6996", + .phy_id = (ADM_SIG0_VAL << 16) | ADM_SIG1_VAL, + .phy_id_mask = 0xffffffff, .features = PHY_BASIC_FEATURES, - .detect = adm6996_detect, .probe = adm6996_probe, .remove = adm6996_remove, .config_init = &adm6996_config_init, @@ -158,6 +158,7 @@ static struct phy_driver adm6996_driver = { static int __init adm6996_init(void) { + phy_register_fixup_for_id(PHY_ANY_ID, adm6996_fixup); return phy_driver_register(&adm6996_driver); } |