diff options
Diffstat (limited to 'drivers/net/usb/aqc111.c')
| -rw-r--r-- | drivers/net/usb/aqc111.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c index b86c5ce9a92a..7e44110746dd 100644 --- a/drivers/net/usb/aqc111.c +++ b/drivers/net/usb/aqc111.c | |||
| @@ -320,7 +320,6 @@ static int aqc111_get_link_ksettings(struct net_device *net, | |||
| 320 | static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed) | 320 | static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed) |
| 321 | { | 321 | { |
| 322 | struct aqc111_data *aqc111_data = dev->driver_priv; | 322 | struct aqc111_data *aqc111_data = dev->driver_priv; |
| 323 | u32 phy_on_the_wire; | ||
| 324 | 323 | ||
| 325 | aqc111_data->phy_cfg &= ~AQ_ADV_MASK; | 324 | aqc111_data->phy_cfg &= ~AQ_ADV_MASK; |
| 326 | aqc111_data->phy_cfg |= AQ_PAUSE; | 325 | aqc111_data->phy_cfg |= AQ_PAUSE; |
| @@ -362,8 +361,7 @@ static void aqc111_set_phy_speed(struct usbnet *dev, u8 autoneg, u16 speed) | |||
| 362 | } | 361 | } |
| 363 | } | 362 | } |
| 364 | 363 | ||
| 365 | phy_on_the_wire = aqc111_data->phy_cfg; | 364 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &aqc111_data->phy_cfg); |
| 366 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, &phy_on_the_wire); | ||
| 367 | } | 365 | } |
| 368 | 366 | ||
| 369 | static int aqc111_set_link_ksettings(struct net_device *net, | 367 | static int aqc111_set_link_ksettings(struct net_device *net, |
| @@ -439,7 +437,7 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu) | |||
| 439 | aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE, | 437 | aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE, |
| 440 | 2, ®16); | 438 | 2, ®16); |
| 441 | 439 | ||
| 442 | if (dev->net->mtu > 12500 && dev->net->mtu <= 16334) { | 440 | if (dev->net->mtu > 12500) { |
| 443 | memcpy(buf, &AQC111_BULKIN_SIZE[2], 5); | 441 | memcpy(buf, &AQC111_BULKIN_SIZE[2], 5); |
| 444 | /* RX bulk configuration */ | 442 | /* RX bulk configuration */ |
| 445 | aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RX_BULKIN_QCTRL, | 443 | aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RX_BULKIN_QCTRL, |
| @@ -453,10 +451,8 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu) | |||
| 453 | reg16 = 0x1020; | 451 | reg16 = 0x1020; |
| 454 | else if (dev->net->mtu <= 12500) | 452 | else if (dev->net->mtu <= 12500) |
| 455 | reg16 = 0x1420; | 453 | reg16 = 0x1420; |
| 456 | else if (dev->net->mtu <= 16334) | ||
| 457 | reg16 = 0x1A20; | ||
| 458 | else | 454 | else |
| 459 | return 0; | 455 | reg16 = 0x1A20; |
| 460 | 456 | ||
| 461 | aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_PAUSE_WATERLVL_LOW, | 457 | aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_PAUSE_WATERLVL_LOW, |
| 462 | 2, ®16); | 458 | 2, ®16); |
| @@ -757,7 +753,6 @@ static void aqc111_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
| 757 | { | 753 | { |
| 758 | struct aqc111_data *aqc111_data = dev->driver_priv; | 754 | struct aqc111_data *aqc111_data = dev->driver_priv; |
| 759 | u16 reg16; | 755 | u16 reg16; |
| 760 | u32 phy_on_the_wire; | ||
| 761 | 756 | ||
| 762 | /* Force bz */ | 757 | /* Force bz */ |
| 763 | reg16 = SFR_PHYPWR_RSTCTL_BZ; | 758 | reg16 = SFR_PHYPWR_RSTCTL_BZ; |
| @@ -771,9 +766,8 @@ static void aqc111_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
| 771 | aqc111_data->phy_cfg &= ~AQ_ADV_MASK; | 766 | aqc111_data->phy_cfg &= ~AQ_ADV_MASK; |
| 772 | aqc111_data->phy_cfg |= AQ_LOW_POWER; | 767 | aqc111_data->phy_cfg |= AQ_LOW_POWER; |
| 773 | aqc111_data->phy_cfg &= ~AQ_PHY_POWER_EN; | 768 | aqc111_data->phy_cfg &= ~AQ_PHY_POWER_EN; |
| 774 | phy_on_the_wire = aqc111_data->phy_cfg; | ||
| 775 | aqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0, | 769 | aqc111_write32_cmd_nopm(dev, AQ_PHY_OPS, 0, 0, |
| 776 | &phy_on_the_wire); | 770 | &aqc111_data->phy_cfg); |
| 777 | 771 | ||
| 778 | kfree(aqc111_data); | 772 | kfree(aqc111_data); |
| 779 | } | 773 | } |
| @@ -996,7 +990,6 @@ static int aqc111_reset(struct usbnet *dev) | |||
| 996 | { | 990 | { |
| 997 | struct aqc111_data *aqc111_data = dev->driver_priv; | 991 | struct aqc111_data *aqc111_data = dev->driver_priv; |
| 998 | u8 reg8 = 0; | 992 | u8 reg8 = 0; |
| 999 | u32 phy_on_the_wire; | ||
| 1000 | 993 | ||
| 1001 | dev->rx_urb_size = URB_SIZE; | 994 | dev->rx_urb_size = URB_SIZE; |
| 1002 | 995 | ||
| @@ -1009,9 +1002,8 @@ static int aqc111_reset(struct usbnet *dev) | |||
| 1009 | 1002 | ||
| 1010 | /* Power up ethernet PHY */ | 1003 | /* Power up ethernet PHY */ |
| 1011 | aqc111_data->phy_cfg = AQ_PHY_POWER_EN; | 1004 | aqc111_data->phy_cfg = AQ_PHY_POWER_EN; |
| 1012 | phy_on_the_wire = aqc111_data->phy_cfg; | ||
| 1013 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, | 1005 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, |
| 1014 | &phy_on_the_wire); | 1006 | &aqc111_data->phy_cfg); |
| 1015 | 1007 | ||
| 1016 | /* Set the MAC address */ | 1008 | /* Set the MAC address */ |
| 1017 | aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID, ETH_ALEN, | 1009 | aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_NODE_ID, ETH_ALEN, |
| @@ -1042,7 +1034,6 @@ static int aqc111_stop(struct usbnet *dev) | |||
| 1042 | { | 1034 | { |
| 1043 | struct aqc111_data *aqc111_data = dev->driver_priv; | 1035 | struct aqc111_data *aqc111_data = dev->driver_priv; |
| 1044 | u16 reg16 = 0; | 1036 | u16 reg16 = 0; |
| 1045 | u32 phy_on_the_wire; | ||
| 1046 | 1037 | ||
| 1047 | aqc111_read16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE, | 1038 | aqc111_read16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE, |
| 1048 | 2, ®16); | 1039 | 2, ®16); |
| @@ -1054,9 +1045,8 @@ static int aqc111_stop(struct usbnet *dev) | |||
| 1054 | 1045 | ||
| 1055 | /* Put PHY to low power*/ | 1046 | /* Put PHY to low power*/ |
| 1056 | aqc111_data->phy_cfg |= AQ_LOW_POWER; | 1047 | aqc111_data->phy_cfg |= AQ_LOW_POWER; |
| 1057 | phy_on_the_wire = aqc111_data->phy_cfg; | ||
| 1058 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, | 1048 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, |
| 1059 | &phy_on_the_wire); | 1049 | &aqc111_data->phy_cfg); |
| 1060 | 1050 | ||
| 1061 | netif_carrier_off(dev->net); | 1051 | netif_carrier_off(dev->net); |
| 1062 | 1052 | ||
| @@ -1332,7 +1322,6 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 1332 | u16 temp_rx_ctrl = 0x00; | 1322 | u16 temp_rx_ctrl = 0x00; |
| 1333 | u16 reg16; | 1323 | u16 reg16; |
| 1334 | u8 reg8; | 1324 | u8 reg8; |
| 1335 | u32 phy_on_the_wire; | ||
| 1336 | 1325 | ||
| 1337 | usbnet_suspend(intf, message); | 1326 | usbnet_suspend(intf, message); |
| 1338 | 1327 | ||
| @@ -1404,14 +1393,12 @@ static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 1404 | 1393 | ||
| 1405 | aqc111_write_cmd(dev, AQ_WOL_CFG, 0, 0, | 1394 | aqc111_write_cmd(dev, AQ_WOL_CFG, 0, 0, |
| 1406 | WOL_CFG_SIZE, &wol_cfg); | 1395 | WOL_CFG_SIZE, &wol_cfg); |
| 1407 | phy_on_the_wire = aqc111_data->phy_cfg; | ||
| 1408 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, | 1396 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, |
| 1409 | &phy_on_the_wire); | 1397 | &aqc111_data->phy_cfg); |
| 1410 | } else { | 1398 | } else { |
| 1411 | aqc111_data->phy_cfg |= AQ_LOW_POWER; | 1399 | aqc111_data->phy_cfg |= AQ_LOW_POWER; |
| 1412 | phy_on_the_wire = aqc111_data->phy_cfg; | ||
| 1413 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, | 1400 | aqc111_write32_cmd(dev, AQ_PHY_OPS, 0, 0, |
| 1414 | &phy_on_the_wire); | 1401 | &aqc111_data->phy_cfg); |
| 1415 | 1402 | ||
| 1416 | /* Disable RX path */ | 1403 | /* Disable RX path */ |
| 1417 | aqc111_read16_cmd_nopm(dev, AQ_ACCESS_MAC, | 1404 | aqc111_read16_cmd_nopm(dev, AQ_ACCESS_MAC, |
| @@ -1428,7 +1415,7 @@ static int aqc111_resume(struct usb_interface *intf) | |||
| 1428 | { | 1415 | { |
| 1429 | struct usbnet *dev = usb_get_intfdata(intf); | 1416 | struct usbnet *dev = usb_get_intfdata(intf); |
| 1430 | struct aqc111_data *aqc111_data = dev->driver_priv; | 1417 | struct aqc111_data *aqc111_data = dev->driver_priv; |
| 1431 | u16 reg16, oldreg16; | 1418 | u16 reg16; |
| 1432 | u8 reg8; | 1419 | u8 reg8; |
| 1433 | 1420 | ||
| 1434 | netif_carrier_off(dev->net); | 1421 | netif_carrier_off(dev->net); |
| @@ -1444,11 +1431,9 @@ static int aqc111_resume(struct usb_interface *intf) | |||
| 1444 | /* Configure RX control register => start operation */ | 1431 | /* Configure RX control register => start operation */ |
| 1445 | reg16 = aqc111_data->rxctl; | 1432 | reg16 = aqc111_data->rxctl; |
| 1446 | reg16 &= ~SFR_RX_CTL_START; | 1433 | reg16 &= ~SFR_RX_CTL_START; |
| 1447 | /* needs to be saved in case endianness is swapped */ | ||
| 1448 | oldreg16 = reg16; | ||
| 1449 | aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, ®16); | 1434 | aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, ®16); |
| 1450 | 1435 | ||
| 1451 | reg16 = oldreg16 | SFR_RX_CTL_START; | 1436 | reg16 |= SFR_RX_CTL_START; |
| 1452 | aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, ®16); | 1437 | aqc111_write16_cmd_nopm(dev, AQ_ACCESS_MAC, SFR_RX_CTL, 2, ®16); |
| 1453 | 1438 | ||
| 1454 | aqc111_set_phy_speed(dev, aqc111_data->autoneg, | 1439 | aqc111_set_phy_speed(dev, aqc111_data->autoneg, |
