diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-03-21 18:16:07 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-03-21 18:16:07 +0000 |
commit | 9a1031ce6d35a6e33902f1ce3ddbec8bac707b51 (patch) | |
tree | 104eda89c8b766c366979c86bceeeaa27e570a5a /target/linux | |
parent | 479ff12fae0a202f72c5ffe8e4fdcf523206426b (diff) | |
download | upstream-9a1031ce6d35a6e33902f1ce3ddbec8bac707b51.tar.gz upstream-9a1031ce6d35a6e33902f1ce3ddbec8bac707b51.tar.bz2 upstream-9a1031ce6d35a6e33902f1ce3ddbec8bac707b51.zip |
ar71xx: change PHY select logic, and update phy_masks
SVN-Revision: 20358
Diffstat (limited to 'target/linux')
22 files changed, 37 insertions, 78 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.c index 571901e670..c48af45cfb 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.c @@ -48,7 +48,6 @@ void __init ap91_eth_init(u8 *mac_addr, const char *port_names[]) /* WAN port */ ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0x0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.fifo_cfg1 = 0x0fff0000; @@ -57,7 +56,6 @@ void __init ap91_eth_init(u8 *mac_addr, const char *port_names[]) /* LAN ports */ ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth1_data.phy_mask = 0x0; ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; ar71xx_eth1_data.fifo_cfg1 = 0x0fff0000; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c index 6fa950f70d..cd865b001e 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c @@ -113,7 +113,6 @@ static void __init ap81_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.has_ar8216 = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c index 72c0016316..9aa17dce1a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c @@ -206,7 +206,6 @@ static void __init ap83_generic_setup(void) ar71xx_add_device_eth(0); ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ar71xx_eth1_data.phy_mask = 0x0; ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c index a6f1daf461..b9b037a7ca 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-aw-nr580.c @@ -80,7 +80,6 @@ static void __init aw_nr580_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c index 5eb594c31a..f5eb7b2e43 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c @@ -144,7 +144,6 @@ static void __init dir_615c1_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c index 1e5a933815..42d0f81e6a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c @@ -135,7 +135,6 @@ static void __init mzk_w04nu_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.has_ar8216 = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c index 3a38c82851..ed431d824c 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c @@ -134,7 +134,6 @@ static void __init mzk_w300nh_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.has_ar8216 = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c index 96a976f8a8..576da4ba7a 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb42.c @@ -55,7 +55,6 @@ static void __init pb42_init(void) ar71xx_eth0_data.phy_mask = PB42_WAN_PHYMASK; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth1_data.phy_mask = PB42_LAN_PHYMASK; ar71xx_eth1_data.speed = SPEED_100; ar71xx_eth1_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c index 052884f5c7..aa746665e3 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-pb44.c @@ -179,7 +179,6 @@ static void __init pb44_init(void) ar71xx_add_device_eth(0); ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ar71xx_eth1_data.phy_mask = PB44_LAN_PHYMASK; ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; ar71xx_eth1_pll_data.pll_1000 = 0x110000; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c index bf1a39f3b4..0527e13a9f 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb4xx.c @@ -177,10 +177,10 @@ static void __init rb411_setup(void) rb4xx_generic_setup(); rb4xx_add_device_spi(); - ar71xx_add_device_mdio(0xfffffffe); + ar71xx_add_device_mdio(0xfffffffc); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0x00000001; + ar71xx_eth0_data.phy_mask = 0x00000003; ar71xx_add_device_eth(0); @@ -216,7 +216,6 @@ static void __init rb433_setup(void) ar71xx_add_device_mdio(0xffffffe9); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0x00000006; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; @@ -249,7 +248,6 @@ static void __init rb450_generic_setup(int gige) ar71xx_add_device_mdio(0xffffffe0); ar71xx_eth0_data.phy_if_mode = (gige) ? PHY_INTERFACE_MODE_RGMII : PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0x0000000f; ar71xx_eth0_data.speed = (gige) ? SPEED_1000 : SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; @@ -284,7 +282,6 @@ static void __init rb493_setup(void) ar71xx_add_device_mdio(0x3fffff00); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c index 4abb8e4ed1..2bf9ad9b03 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c @@ -120,7 +120,6 @@ static void __init tew_632brp_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c index fd8e5fce8d..3b7b764c22 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c @@ -130,7 +130,6 @@ static void __init tl_wr1043nd_setup(void) ar71xx_eth0_data.mii_bus_dev = &tl_wr1043nd_rtl8366rb_device.dev; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ar71xx_eth0_data.phy_mask = 0x0; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_pll_data.pll_1000 = 0x1a000000; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c index 9f9e3c6e8a..1b849e18b8 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr841n.c @@ -120,7 +120,6 @@ static void __init tl_wr841n_v1_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0x0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c index 67af5b0f1a..0c648939f9 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c @@ -121,7 +121,6 @@ static void __init tl_wr941nd_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0x0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c index 5b1c504f39..3cd5a63ef5 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ubnt.c @@ -136,9 +136,6 @@ static void __init ubnt_generic_setup(void) #define UBNT_RS_WAN_PHYMASK (1 << 20) #define UBNT_RS_LAN_PHYMASK ((1 << 16) | (1 << 17) | (1 << 18) | (1 << 19)) -#define UBNT_RSPRO_WAN_PHYMASK (1 << 4) -#define UBNT_RSPRO_LAN_PHYMASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) - static void __init ubnt_rs_setup(void) { ubnt_generic_setup(); @@ -149,8 +146,6 @@ static void __init ubnt_rs_setup(void) ar71xx_eth0_data.phy_mask = UBNT_RS_WAN_PHYMASK; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth1_data.phy_mask = UBNT_RS_LAN_PHYMASK; - ar71xx_eth1_data.speed = SPEED_100; ar71xx_eth1_data.duplex = DUPLEX_FULL; @@ -169,6 +164,9 @@ MIPS_MACHINE(AR71XX_MACH_UBNT_RS, "UBNT-RS", "Ubiquiti RouterStation", MIPS_MACHINE(AR71XX_MACH_UBNT_AR71XX, "Ubiquiti AR71xx-based board", "Ubiquiti RouterStation", ubnt_rs_setup); +#define UBNT_RSPRO_WAN_PHYMASK (1 << 4) +#define UBNT_RSPRO_LAN_PHYMASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) + static void __init ubnt_rspro_setup(void) { ubnt_generic_setup(); @@ -179,8 +177,6 @@ static void __init ubnt_rspro_setup(void) ar71xx_eth0_data.phy_mask = UBNT_RSPRO_WAN_PHYMASK; 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; @@ -235,7 +231,6 @@ static void __init ubnt_m_setup(void) ar71xx_add_device_mdio(~0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.fifo_cfg1 = 0x0010ffff; @@ -272,7 +267,6 @@ static void __init ubnt_nano_m_setup(void) ubnt_m_setup(); ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth1_data.phy_mask = 0; ar71xx_eth1_data.speed = SPEED_1000; ar71xx_eth1_data.duplex = DUPLEX_FULL; ar71xx_eth1_data.fifo_cfg1 = 0x0010ffff; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c index 3dd97789a0..62931e6a11 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c @@ -173,7 +173,6 @@ static void __init wndr3700_setup(void) ar71xx_eth0_pll_data.pll_1000 = 0x11110000; ar71xx_eth0_data.mii_bus_dev = &wndr3700_rtl8366s_device.dev; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c index bf4be89465..73422d6bad 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c @@ -122,7 +122,6 @@ static void __init wnr2000_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.has_ar8216 = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c index bf8b9f5623..22585842e2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c @@ -79,7 +79,7 @@ static void __init wp543_setup(void) ar71xx_add_device_mdio(0xfffffff7); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; - ar71xx_eth0_data.phy_mask = 0x00000008; + ar71xx_eth0_data.phy_mask = 0x08; ar71xx_eth0_data.reset_bit = RESET_MODULE_GE0_MAC | RESET_MODULE_GE0_PHY; ar71xx_add_device_eth(0); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c index 3d50afcbb2..886f94728e 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt400n.c @@ -143,7 +143,6 @@ static void __init wrt400n_setup(void) ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.has_ar8216 = 1; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c index c6fb241c51..b52cc601fc 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wzr-hp-g300nh.c @@ -234,7 +234,6 @@ static void __init wzrhpg300nh_setup(void) ar71xx_eth0_pll_data.pll_1000 = 0x1e000100; ar71xx_eth0_data.mii_bus_dev = &wzrhpg300nh_rtl8366s_device.dev; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; - ar71xx_eth0_data.phy_mask = 0xf; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h index 841c67fb98..5be89987bb 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h @@ -38,7 +38,7 @@ #define ETH_FCS_LEN 4 #define AG71XX_DRV_NAME "ag71xx" -#define AG71XX_DRV_VERSION "0.5.32" +#define AG71XX_DRV_VERSION "0.5.33" #define AG71XX_NAPI_WEIGHT 64 #define AG71XX_OOM_REFILL (1 + HZ/10) diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c index 4425b740e5..9c76544aff 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c @@ -47,10 +47,6 @@ void ag71xx_phy_start(struct ag71xx *ag) if (ag->phy_dev) { phy_start(ag->phy_dev); } else { - struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); - - ag->duplex = pdata->duplex; - ag->speed = pdata->speed; ag->link = 1; ag71xx_link_adjust(ag); } @@ -61,9 +57,7 @@ void ag71xx_phy_stop(struct ag71xx *ag) if (ag->phy_dev) { phy_stop(ag->phy_dev); } else { - ag->duplex = -1; ag->link = 0; - ag->speed = 0; ag71xx_link_adjust(ag); } } @@ -81,12 +75,16 @@ static int ag71xx_phy_connect_fixed(struct ag71xx *ag) case SPEED_1000: break; default: - printk(KERN_ERR "%s: invalid speed specified\n", - dev->name); + printk(KERN_ERR "%s: invalid speed specified\n", dev->name); ret = -EINVAL; break; } + printk(KERN_DEBUG "%s: using fixed link parameters\n", dev->name); + + ag->duplex = pdata->duplex; + ag->speed = pdata->speed; + return ret; } @@ -95,7 +93,6 @@ static int ag71xx_phy_connect_multi(struct ag71xx *ag) struct net_device *dev = ag->dev; struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); struct phy_device *phydev = NULL; - int phy_count = 0; int phy_addr; int ret = 0; @@ -113,50 +110,39 @@ static int ag71xx_phy_connect_multi(struct ag71xx *ag) if (phydev == NULL) phydev = ag->mii_bus->phy_map[phy_addr]; - - phy_count++; } - switch (phy_count) { - case 0: + if (!phydev) { printk(KERN_ERR "%s: no PHY found with phy_mask=%08x\n", dev->name, pdata->phy_mask); - ret = -ENODEV; - break; - case 1: - ag->phy_dev = phy_connect(dev, dev_name(&phydev->dev), - &ag71xx_phy_link_adjust, 0, pdata->phy_if_mode); - - if (IS_ERR(ag->phy_dev)) { - printk(KERN_ERR "%s: could not connect to PHY at %s\n", - dev->name, dev_name(&phydev->dev)); - return PTR_ERR(ag->phy_dev); - } + return -ENODEV; + } - /* mask with MAC supported features */ - if (pdata->has_gbit) - phydev->supported &= PHY_GBIT_FEATURES; - else - phydev->supported &= PHY_BASIC_FEATURES; + ag->phy_dev = phy_connect(dev, dev_name(&phydev->dev), + &ag71xx_phy_link_adjust, 0, + pdata->phy_if_mode); - phydev->advertising = phydev->supported; + if (IS_ERR(ag->phy_dev)) { + printk(KERN_ERR "%s: could not connect to PHY at %s\n", + dev->name, dev_name(&phydev->dev)); + return PTR_ERR(ag->phy_dev); + } - printk(KERN_DEBUG "%s: connected to PHY at %s " - "[uid=%08x, driver=%s]\n", - dev->name, dev_name(&phydev->dev), - phydev->phy_id, phydev->drv->name); + /* mask with MAC supported features */ + if (pdata->has_gbit) + phydev->supported &= PHY_GBIT_FEATURES; + else + phydev->supported &= PHY_BASIC_FEATURES; - ag->link = 0; - ag->speed = 0; - ag->duplex = -1; - break; + phydev->advertising = phydev->supported; - default: - printk(KERN_DEBUG "%s: connected to %d PHYs\n", - dev->name, phy_count); - ret = ag71xx_phy_connect_fixed(ag); - break; - } + printk(KERN_DEBUG "%s: connected to PHY at %s [uid=%08x, driver=%s]\n", + dev->name, dev_name(&phydev->dev), + phydev->phy_id, phydev->drv->name); + + ag->link = 0; + ag->speed = 0; + ag->duplex = -1; return ret; } |