aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorSteve Glendinning <steve.glendinning@shawell.net>2012-09-27 20:07:11 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-28 18:34:58 -0400
commitb5a044758672b6dc775fdab007337b47a54576f4 (patch)
tree3bab50b861a6881f1c63128d7c4d35de31ad8eae /drivers/net/usb
parentc954679cf76095b0a1232c3dad604a9066d78ab1 (diff)
smsc95xx: enable power saving mode during system suspend
This patch enables the device to enter its lowest power SUSPEND2 state during system suspend, instead of staying up using full power. Patch updated to not add two pointers to .suspend & .resume. Patch updated to replace BUG_ON with WARN_ON_ONCE and return. Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/smsc95xx.c28
-rw-r--r--drivers/net/usb/smsc95xx.h6
2 files changed, 32 insertions, 2 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index f29860d6341a..ba0360fb857f 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1018,6 +1018,32 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1018 } 1018 }
1019} 1019}
1020 1020
1021static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
1022{
1023 struct usbnet *dev = usb_get_intfdata(intf);
1024 int ret;
1025 u32 val;
1026
1027 if (WARN_ON_ONCE(!dev))
1028 return -EINVAL;
1029
1030 ret = usbnet_suspend(intf, message);
1031 check_warn_return(ret, "usbnet_suspend error");
1032
1033 netdev_info(dev->net, "entering SUSPEND2 mode");
1034
1035 ret = smsc95xx_read_reg(dev, PM_CTRL, &val);
1036 check_warn_return(ret, "Error reading PM_CTRL");
1037
1038 val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_);
1039 val |= PM_CTL_SUS_MODE_2;
1040
1041 ret = smsc95xx_write_reg(dev, PM_CTRL, val);
1042 check_warn_return(ret, "Error writing PM_CTRL");
1043
1044 return 0;
1045}
1046
1021static void smsc95xx_rx_csum_offload(struct sk_buff *skb) 1047static void smsc95xx_rx_csum_offload(struct sk_buff *skb)
1022{ 1048{
1023 skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2); 1049 skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2);
@@ -1280,7 +1306,7 @@ static struct usb_driver smsc95xx_driver = {
1280 .name = "smsc95xx", 1306 .name = "smsc95xx",
1281 .id_table = products, 1307 .id_table = products,
1282 .probe = usbnet_probe, 1308 .probe = usbnet_probe,
1283 .suspend = usbnet_suspend, 1309 .suspend = smsc95xx_suspend,
1284 .resume = usbnet_resume, 1310 .resume = usbnet_resume,
1285 .reset_resume = usbnet_resume, 1311 .reset_resume = usbnet_resume,
1286 .disconnect = usbnet_disconnect, 1312 .disconnect = usbnet_disconnect,
diff --git a/drivers/net/usb/smsc95xx.h b/drivers/net/usb/smsc95xx.h
index a275b626ec69..89ad9259d613 100644
--- a/drivers/net/usb/smsc95xx.h
+++ b/drivers/net/usb/smsc95xx.h
@@ -84,12 +84,16 @@
84#define HW_CFG_BCE_ (0x00000002) 84#define HW_CFG_BCE_ (0x00000002)
85#define HW_CFG_SRST_ (0x00000001) 85#define HW_CFG_SRST_ (0x00000001)
86 86
87#define RX_FIFO_INF (0x18)
88
87#define PM_CTRL (0x20) 89#define PM_CTRL (0x20)
90#define PM_CTL_RES_CLR_WKP_STS (0x00000200)
88#define PM_CTL_DEV_RDY_ (0x00000080) 91#define PM_CTL_DEV_RDY_ (0x00000080)
89#define PM_CTL_SUS_MODE_ (0x00000060) 92#define PM_CTL_SUS_MODE_ (0x00000060)
90#define PM_CTL_SUS_MODE_0 (0x00000000) 93#define PM_CTL_SUS_MODE_0 (0x00000000)
91#define PM_CTL_SUS_MODE_1 (0x00000020) 94#define PM_CTL_SUS_MODE_1 (0x00000020)
92#define PM_CTL_SUS_MODE_2 (0x00000060) 95#define PM_CTL_SUS_MODE_2 (0x00000040)
96#define PM_CTL_SUS_MODE_3 (0x00000060)
93#define PM_CTL_PHY_RST_ (0x00000010) 97#define PM_CTL_PHY_RST_ (0x00000010)
94#define PM_CTL_WOL_EN_ (0x00000008) 98#define PM_CTL_WOL_EN_ (0x00000008)
95#define PM_CTL_ED_EN_ (0x00000004) 99#define PM_CTL_ED_EN_ (0x00000004)