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/mvswitch.c | |
parent | 7325f7cfbb97f86220c9d7695405f150112c2bfd (diff) | |
download | upstream-f972eb41b5eb8277139812e0af5fc00f37cdb134.tar.gz upstream-f972eb41b5eb8277139812e0af5fc00f37cdb134.tar.bz2 upstream-f972eb41b5eb8277139812e0af5fc00f37cdb134.zip |
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/mvswitch.c')
-rw-r--r-- | target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c b/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c index f5a292a80d..427bad4050 100644 --- a/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c +++ b/target/linux/generic-2.6/files/drivers/net/phy/mvswitch.c @@ -38,6 +38,8 @@ MODULE_DESCRIPTION("Marvell 88E6060 Switch driver"); MODULE_AUTHOR("Felix Fietkau"); MODULE_LICENSE("GPL"); +#define MVSWITCH_MAGIC 0x88E6060 + struct mvswitch_priv { /* the driver's tx function */ int (*hardstart)(struct sk_buff *skb, struct net_device *dev); @@ -401,37 +403,6 @@ mvswitch_remove(struct phy_device *pdev) kfree(priv); } -static bool -mvswitch_detect(struct mii_bus *bus, int addr) -{ - u16 reg; - int i; - - /* we attach to phy id 31 to make sure that the late probe works */ - if (addr != 31) - return false; - - /* look for the switch on the bus */ - reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - if (reg != MV_IDENT_VALUE) - return false; - - /* - * Now that we've established that the switch actually exists, let's - * get rid of the competition :) - */ - for (i = 0; i < 31; i++) { - if (!bus->phy_map[i]) - continue; - - device_unregister(&bus->phy_map[i]->dev); - kfree(bus->phy_map[i]); - bus->phy_map[i] = NULL; - } - - return true; -} - static int mvswitch_probe(struct phy_device *pdev) { @@ -446,11 +417,26 @@ mvswitch_probe(struct phy_device *pdev) return 0; } +static int +mvswitch_fixup(struct phy_device *dev) +{ + u16 reg; + + /* look for the switch on the bus */ + reg = dev->bus->read(dev->bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; + if (reg != MV_IDENT_VALUE) + return 0; + + dev->phy_id = MVSWITCH_MAGIC; + return 0; +} + static struct phy_driver mvswitch_driver = { .name = "Marvell 88E6060", + .phy_id = MVSWITCH_MAGIC, + .phy_id_mask = 0xffffffff, .features = PHY_BASIC_FEATURES, - .detect = &mvswitch_detect, .probe = &mvswitch_probe, .remove = &mvswitch_remove, .config_init = &mvswitch_config_init, @@ -462,6 +448,7 @@ static struct phy_driver mvswitch_driver = { static int __init mvswitch_init(void) { + phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); return phy_driver_register(&mvswitch_driver); } |