summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ar71xx/files/drivers')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c74
2 files changed, 31 insertions, 45 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index 841c67fb9..5be89987b 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 4425b740e..9c76544af 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;
}