ar71xx: change PHY select logic, and update phy_masks

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20358 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2010-03-21 18:16:07 +00:00
parent 7ac41fd398
commit 41b8423dc1
22 changed files with 41 additions and 82 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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,51 +110,40 @@ 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);
}
/* mask with MAC supported features */
if (pdata->has_gbit)
phydev->supported &= PHY_GBIT_FEATURES;
else
phydev->supported &= PHY_BASIC_FEATURES;
phydev->advertising = phydev->supported;
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;
break;
default:
printk(KERN_DEBUG "%s: connected to %d PHYs\n",
dev->name, phy_count);
ret = ag71xx_phy_connect_fixed(ag);
break;
return -ENODEV;
}
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);
}
/* mask with MAC supported features */
if (pdata->has_gbit)
phydev->supported &= PHY_GBIT_FEATURES;
else
phydev->supported &= PHY_BASIC_FEATURES;
phydev->advertising = phydev->supported;
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;
}