1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-18 07:56:15 +02:00

[ar71xx] minor ethernet driver update

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12985 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2008-10-15 18:31:21 +00:00
parent 313afd99d6
commit 92c4109e54
3 changed files with 11 additions and 9 deletions

View File

@ -37,7 +37,7 @@
#define ETH_FCS_LEN 4 #define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx" #define AG71XX_DRV_NAME "ag71xx"
#define AG71XX_DRV_VERSION "0.4.1" #define AG71XX_DRV_VERSION "0.4.2"
#define AG71XX_NAPI_TX 1 #define AG71XX_NAPI_TX 1

View File

@ -193,8 +193,10 @@ void ag71xx_phy_start(struct ag71xx *ag)
if (ag->phy_dev) { if (ag->phy_dev) {
phy_start(ag->phy_dev); phy_start(ag->phy_dev);
} else { } else {
ag->duplex = DUPLEX_FULL; struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
ag->speed = SPEED_100;
ag->duplex = pdata->duplex;
ag->speed = pdata->speed;
ag->link = 1; ag->link = 1;
ag71xx_phy_link_update(ag); ag71xx_phy_link_update(ag);
} }
@ -220,8 +222,8 @@ int ag71xx_phy_connect(struct ag71xx *ag)
int phy_count = 0; int phy_count = 0;
int phy_addr; int phy_addr;
if (ag->mii_bus) { if (ag->mii_bus && pdata->phy_mask) {
/* TODO: use mutex of the mdio bus */ /* TODO: use mutex of the mdio bus? */
for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
if (!(pdata->phy_mask & (1 << phy_addr))) if (!(pdata->phy_mask & (1 << phy_addr)))
continue; continue;
@ -242,9 +244,6 @@ int ag71xx_phy_connect(struct ag71xx *ag)
} }
switch (phy_count) { switch (phy_count) {
case 0:
printk(KERN_ERR "%s: no PHY found\n", dev->name);
return -ENODEV;
case 1: case 1:
ag->phy_dev = phy_connect(dev, phydev->dev.bus_id, ag->phy_dev = phy_connect(dev, phydev->dev.bus_id,
&ag71xx_phy_link_adjust, 0, pdata->phy_if_mode); &ag71xx_phy_link_adjust, 0, pdata->phy_if_mode);
@ -275,9 +274,10 @@ int ag71xx_phy_connect(struct ag71xx *ag)
ag->speed = 0; ag->speed = 0;
ag->duplex = -1; ag->duplex = -1;
break; break;
default: default:
ag->phy_dev = NULL; ag->phy_dev = NULL;
printk(KERN_DEBUG "%s: connected to multiple PHYs (%d)\n", printk(KERN_DEBUG "%s: connected to %d PHYs\n",
dev->name, phy_count); dev->name, phy_count);
break; break;
} }

View File

@ -25,6 +25,8 @@ struct ag71xx_platform_data {
u32 phy_mask; u32 phy_mask;
phy_interface_t phy_if_mode; phy_interface_t phy_if_mode;
u32 mii_if; u32 mii_if;
int speed;
int duplex;
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
}; };