smsc95xx.c (42e21c01071b4406341e32aba65e40c7f9b7e973) | smsc95xx.c (eb970ff07c15f13eb474f643fd165ebe3e4e24b2) |
---|---|
1 /*************************************************************************** 2 * 3 * Copyright (C) 2007-2008 SMSC 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. --- 39 unchanged lines hidden (view full) --- 48#define SMSC95XX_INTERNAL_PHY_ID (1) 49#define SMSC95XX_TX_OVERHEAD (8) 50#define SMSC95XX_TX_OVERHEAD_CSUM (12) 51#define SUPPORTED_WAKE (WAKE_PHY | WAKE_UCAST | WAKE_BCAST | \ 52 WAKE_MCAST | WAKE_ARP | WAKE_MAGIC) 53 54#define FEATURE_8_WAKEUP_FILTERS (0x01) 55#define FEATURE_PHY_NLP_CROSSOVER (0x02) | 1 /*************************************************************************** 2 * 3 * Copyright (C) 2007-2008 SMSC 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. --- 39 unchanged lines hidden (view full) --- 48#define SMSC95XX_INTERNAL_PHY_ID (1) 49#define SMSC95XX_TX_OVERHEAD (8) 50#define SMSC95XX_TX_OVERHEAD_CSUM (12) 51#define SUPPORTED_WAKE (WAKE_PHY | WAKE_UCAST | WAKE_BCAST | \ 52 WAKE_MCAST | WAKE_ARP | WAKE_MAGIC) 53 54#define FEATURE_8_WAKEUP_FILTERS (0x01) 55#define FEATURE_PHY_NLP_CROSSOVER (0x02) |
56#define FEATURE_AUTOSUSPEND (0x04) | 56#define FEATURE_REMOTE_WAKEUP (0x04) |
57 58#define SUSPEND_SUSPEND0 (0x01) 59#define SUSPEND_SUSPEND1 (0x02) 60#define SUSPEND_SUSPEND2 (0x04) 61#define SUSPEND_SUSPEND3 (0x08) 62#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ 63 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) 64 --- 1076 unchanged lines hidden (view full) --- 1141 if (ret < 0) 1142 return ret; 1143 val >>= 16; 1144 1145 if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) || 1146 (val == ID_REV_CHIP_ID_89530_) || (val == ID_REV_CHIP_ID_9730_)) 1147 pdata->features = (FEATURE_8_WAKEUP_FILTERS | 1148 FEATURE_PHY_NLP_CROSSOVER | | 57 58#define SUSPEND_SUSPEND0 (0x01) 59#define SUSPEND_SUSPEND1 (0x02) 60#define SUSPEND_SUSPEND2 (0x04) 61#define SUSPEND_SUSPEND3 (0x08) 62#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ 63 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) 64 --- 1076 unchanged lines hidden (view full) --- 1141 if (ret < 0) 1142 return ret; 1143 val >>= 16; 1144 1145 if ((val == ID_REV_CHIP_ID_9500A_) || (val == ID_REV_CHIP_ID_9530_) || 1146 (val == ID_REV_CHIP_ID_89530_) || (val == ID_REV_CHIP_ID_9730_)) 1147 pdata->features = (FEATURE_8_WAKEUP_FILTERS | 1148 FEATURE_PHY_NLP_CROSSOVER | |
1149 FEATURE_AUTOSUSPEND); | 1149 FEATURE_REMOTE_WAKEUP); |
1150 else if (val == ID_REV_CHIP_ID_9512_) 1151 pdata->features = FEATURE_8_WAKEUP_FILTERS; 1152 1153 dev->net->netdev_ops = &smsc95xx_netdev_ops; 1154 dev->net->ethtool_ops = &smsc95xx_ethtool_ops; 1155 dev->net->flags |= IFF_MULTICAST; 1156 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1157 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; --- 215 unchanged lines hidden (view full) --- 1373 /* interface is ifconfig down so fully power down hw */ 1374 netdev_dbg(dev->net, "autosuspend entering SUSPEND2\n"); 1375 return smsc95xx_enter_suspend2(dev); 1376 } 1377 1378 if (!link_up) { 1379 /* link is down so enter EDPD mode, but only if device can 1380 * reliably resume from it. This check should be redundant | 1150 else if (val == ID_REV_CHIP_ID_9512_) 1151 pdata->features = FEATURE_8_WAKEUP_FILTERS; 1152 1153 dev->net->netdev_ops = &smsc95xx_netdev_ops; 1154 dev->net->ethtool_ops = &smsc95xx_ethtool_ops; 1155 dev->net->flags |= IFF_MULTICAST; 1156 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1157 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; --- 215 unchanged lines hidden (view full) --- 1373 /* interface is ifconfig down so fully power down hw */ 1374 netdev_dbg(dev->net, "autosuspend entering SUSPEND2\n"); 1375 return smsc95xx_enter_suspend2(dev); 1376 } 1377 1378 if (!link_up) { 1379 /* link is down so enter EDPD mode, but only if device can 1380 * reliably resume from it. This check should be redundant |
1381 * as current FEATURE_AUTOSUSPEND parts also support | 1381 * as current FEATURE_REMOTE_WAKEUP parts also support |
1382 * FEATURE_PHY_NLP_CROSSOVER but it's included for clarity */ 1383 if (!(pdata->features & FEATURE_PHY_NLP_CROSSOVER)) { 1384 netdev_warn(dev->net, "EDPD not supported\n"); 1385 return -EBUSY; 1386 } 1387 1388 netdev_dbg(dev->net, "autosuspend entering SUSPEND1\n"); 1389 --- 38 unchanged lines hidden (view full) --- 1428 netdev_warn(dev->net, "error during last resume\n"); 1429 pdata->suspend_flags = 0; 1430 } 1431 1432 /* determine if link is up using only _nopm functions */ 1433 link_up = smsc95xx_link_ok_nopm(dev); 1434 1435 if (message.event == PM_EVENT_AUTO_SUSPEND && | 1382 * FEATURE_PHY_NLP_CROSSOVER but it's included for clarity */ 1383 if (!(pdata->features & FEATURE_PHY_NLP_CROSSOVER)) { 1384 netdev_warn(dev->net, "EDPD not supported\n"); 1385 return -EBUSY; 1386 } 1387 1388 netdev_dbg(dev->net, "autosuspend entering SUSPEND1\n"); 1389 --- 38 unchanged lines hidden (view full) --- 1428 netdev_warn(dev->net, "error during last resume\n"); 1429 pdata->suspend_flags = 0; 1430 } 1431 1432 /* determine if link is up using only _nopm functions */ 1433 link_up = smsc95xx_link_ok_nopm(dev); 1434 1435 if (message.event == PM_EVENT_AUTO_SUSPEND && |
1436 (pdata->features & FEATURE_AUTOSUSPEND)) { | 1436 (pdata->features & FEATURE_REMOTE_WAKEUP)) { |
1437 ret = smsc95xx_autosuspend(dev, link_up); 1438 goto done; 1439 } 1440 1441 /* if we get this far we're not autosuspending */ 1442 /* if no wol options set, or if link is down and we're not waking on 1443 * PHY activity, enter lowest power SUSPEND2 mode 1444 */ --- 420 unchanged lines hidden (view full) --- 1865} 1866 1867static int smsc95xx_manage_power(struct usbnet *dev, int on) 1868{ 1869 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1870 1871 dev->intf->needs_remote_wakeup = on; 1872 | 1437 ret = smsc95xx_autosuspend(dev, link_up); 1438 goto done; 1439 } 1440 1441 /* if we get this far we're not autosuspending */ 1442 /* if no wol options set, or if link is down and we're not waking on 1443 * PHY activity, enter lowest power SUSPEND2 mode 1444 */ --- 420 unchanged lines hidden (view full) --- 1865} 1866 1867static int smsc95xx_manage_power(struct usbnet *dev, int on) 1868{ 1869 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1870 1871 dev->intf->needs_remote_wakeup = on; 1872 |
1873 if (pdata->features & FEATURE_AUTOSUSPEND) | 1873 if (pdata->features & FEATURE_REMOTE_WAKEUP) |
1874 return 0; 1875 | 1874 return 0; 1875 |
1876 /* this chip revision doesn't support autosuspend */ 1877 netdev_info(dev->net, "hardware doesn't support USB autosuspend\n"); | 1876 /* this chip revision isn't capable of remote wakeup */ 1877 netdev_info(dev->net, "hardware isn't capable of remote wakeup\n"); |
1878 1879 if (on) 1880 usb_autopm_get_interface_no_resume(dev->intf); 1881 else 1882 usb_autopm_put_interface(dev->intf); 1883 1884 return 0; 1885} --- 127 unchanged lines hidden --- | 1878 1879 if (on) 1880 usb_autopm_get_interface_no_resume(dev->intf); 1881 else 1882 usb_autopm_put_interface(dev->intf); 1883 1884 return 0; 1885} --- 127 unchanged lines hidden --- |