diff options
author | Grant Grundler <grundler@google.com> | 2011-11-15 02:12:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-15 16:26:06 -0500 |
commit | b2d3ad291fab1783cc12eef3dd91c5fa98c2e5d5 (patch) | |
tree | 4fa38c93a0bc076dc63413783a3b471de8976708 /drivers/net/usb | |
parent | d3665188a79254c0698aa161e2c36dcda4e9ef55 (diff) |
net-next:asix: V2 more fixes for ax88178 phy init sequence
Now works on Samsung Series 5 (chromebook)
Two fixes here:
o use 0x7F mask for phymode
o read phyid *AFTER* phy is powered up (via GPIOs)
Signed-off-by: Allan Chou <allan@asix.com.tw>
Signed-off-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/asix.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 8462be589558..f870ab964e3a 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -1248,6 +1248,7 @@ static int ax88178_reset(struct usbnet *dev) | |||
1248 | __le16 eeprom; | 1248 | __le16 eeprom; |
1249 | u8 status; | 1249 | u8 status; |
1250 | int gpio0 = 0; | 1250 | int gpio0 = 0; |
1251 | u32 phyid; | ||
1251 | 1252 | ||
1252 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); | 1253 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); |
1253 | dbg("GPIO Status: 0x%04x", status); | 1254 | dbg("GPIO Status: 0x%04x", status); |
@@ -1263,12 +1264,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1263 | data->ledmode = 0; | 1264 | data->ledmode = 0; |
1264 | gpio0 = 1; | 1265 | gpio0 = 1; |
1265 | } else { | 1266 | } else { |
1266 | data->phymode = le16_to_cpu(eeprom) & 7; | 1267 | data->phymode = le16_to_cpu(eeprom) & 0x7F; |
1267 | data->ledmode = le16_to_cpu(eeprom) >> 8; | 1268 | data->ledmode = le16_to_cpu(eeprom) >> 8; |
1268 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; | 1269 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; |
1269 | } | 1270 | } |
1270 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); | 1271 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); |
1271 | 1272 | ||
1273 | /* Power up external GigaPHY through AX88178 GPIO pin */ | ||
1272 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); | 1274 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); |
1273 | if ((le16_to_cpu(eeprom) >> 8) != 1) { | 1275 | if ((le16_to_cpu(eeprom) >> 8) != 1) { |
1274 | asix_write_gpio(dev, 0x003c, 30); | 1276 | asix_write_gpio(dev, 0x003c, 30); |
@@ -1280,6 +1282,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1280 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); | 1282 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); |
1281 | } | 1283 | } |
1282 | 1284 | ||
1285 | /* Read PHYID register *AFTER* powering up PHY */ | ||
1286 | phyid = asix_get_phyid(dev); | ||
1287 | dbg("PHYID=0x%08x", phyid); | ||
1288 | |||
1289 | /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */ | ||
1290 | asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL); | ||
1291 | |||
1283 | asix_sw_reset(dev, 0); | 1292 | asix_sw_reset(dev, 0); |
1284 | msleep(150); | 1293 | msleep(150); |
1285 | 1294 | ||
@@ -1424,7 +1433,6 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1424 | { | 1433 | { |
1425 | int ret; | 1434 | int ret; |
1426 | u8 buf[ETH_ALEN]; | 1435 | u8 buf[ETH_ALEN]; |
1427 | u32 phyid; | ||
1428 | struct asix_data *data = (struct asix_data *)&dev->data; | 1436 | struct asix_data *data = (struct asix_data *)&dev->data; |
1429 | 1437 | ||
1430 | data->eeprom_len = AX88772_EEPROM_LEN; | 1438 | data->eeprom_len = AX88772_EEPROM_LEN; |
@@ -1451,12 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1451 | dev->net->netdev_ops = &ax88178_netdev_ops; | 1459 | dev->net->netdev_ops = &ax88178_netdev_ops; |
1452 | dev->net->ethtool_ops = &ax88178_ethtool_ops; | 1460 | dev->net->ethtool_ops = &ax88178_ethtool_ops; |
1453 | 1461 | ||
1454 | phyid = asix_get_phyid(dev); | 1462 | /* Blink LEDS so users know driver saw dongle */ |
1455 | dbg("PHYID=0x%08x", phyid); | 1463 | asix_sw_reset(dev, 0); |
1464 | msleep(150); | ||
1456 | 1465 | ||
1457 | ret = ax88178_reset(dev); | 1466 | asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD); |
1458 | if (ret < 0) | 1467 | msleep(150); |
1459 | return ret; | ||
1460 | 1468 | ||
1461 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1469 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1462 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1470 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |