smsc95xx.c (06a221be022c2cc98a48e0808a4ef0dc8f0b3a34) | smsc95xx.c (ec32115db2bcb7133171c6a036107ca7eb62267f) |
---|---|
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. --- 59 unchanged lines hidden (view full) --- 68 spinlock_t mac_cr_lock; 69 int wuff_filter_count; 70}; 71 72static bool turbo_mode = true; 73module_param(turbo_mode, bool, 0644); 74MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); 75 | 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. --- 59 unchanged lines hidden (view full) --- 68 spinlock_t mac_cr_lock; 69 int wuff_filter_count; 70}; 71 72static bool turbo_mode = true; 73module_param(turbo_mode, bool, 0644); 74MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); 75 |
76static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, 77 u32 *data) | 76static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, 77 u32 *data, int in_pm) |
78{ 79 u32 buf; 80 int ret; | 78{ 79 u32 buf; 80 int ret; |
81 int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16); |
|
81 82 BUG_ON(!dev); 83 | 82 83 BUG_ON(!dev); 84 |
84 ret = usbnet_read_cmd(dev, USB_VENDOR_REQUEST_READ_REGISTER, 85 USB_DIR_IN | USB_TYPE_VENDOR | 86 USB_RECIP_DEVICE, 87 0, index, &buf, 4); | 85 if (!in_pm) 86 fn = usbnet_read_cmd; 87 else 88 fn = usbnet_read_cmd_nopm; 89 90 ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN 91 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 92 0, index, &buf, 4); |
88 if (unlikely(ret < 0)) | 93 if (unlikely(ret < 0)) |
89 netdev_warn(dev->net, "Failed to read register index 0x%08x\n", index); | 94 netdev_warn(dev->net, 95 "Failed to read reg index 0x%08x: %d", index, ret); |
90 91 le32_to_cpus(&buf); 92 *data = buf; 93 94 return ret; 95} 96 | 96 97 le32_to_cpus(&buf); 98 *data = buf; 99 100 return ret; 101} 102 |
97static int __must_check smsc95xx_write_reg(struct usbnet *dev, u32 index, 98 u32 data) | 103static int __must_check __smsc95xx_write_reg(struct usbnet *dev, u32 index, 104 u32 data, int in_pm) |
99{ 100 u32 buf; 101 int ret; | 105{ 106 u32 buf; 107 int ret; |
108 int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16); |
|
102 103 BUG_ON(!dev); 104 | 109 110 BUG_ON(!dev); 111 |
112 if (!in_pm) 113 fn = usbnet_write_cmd; 114 else 115 fn = usbnet_write_cmd_nopm; 116 |
|
105 buf = data; 106 cpu_to_le32s(&buf); 107 | 117 buf = data; 118 cpu_to_le32s(&buf); 119 |
108 109 ret = usbnet_write_cmd(dev, USB_VENDOR_REQUEST_WRITE_REGISTER, 110 USB_DIR_OUT | USB_TYPE_VENDOR | 111 USB_RECIP_DEVICE, 112 0, index, &buf, 4); | 120 ret = fn(dev, USB_VENDOR_REQUEST_WRITE_REGISTER, USB_DIR_OUT 121 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 122 0, index, &buf, 4); |
113 if (unlikely(ret < 0)) | 123 if (unlikely(ret < 0)) |
114 netdev_warn(dev->net, "Failed to write register index 0x%08x\n", index); | 124 netdev_warn(dev->net, 125 "Failed to write reg index 0x%08x: %d", index, ret); |
115 116 return ret; 117} 118 | 126 127 return ret; 128} 129 |
130static int __must_check smsc95xx_read_reg_nopm(struct usbnet *dev, u32 index, 131 u32 *data) 132{ 133 return __smsc95xx_read_reg(dev, index, data, 1); 134} 135 136static int __must_check smsc95xx_write_reg_nopm(struct usbnet *dev, u32 index, 137 u32 data) 138{ 139 return __smsc95xx_write_reg(dev, index, data, 1); 140} 141 142static int __must_check smsc95xx_read_reg(struct usbnet *dev, u32 index, 143 u32 *data) 144{ 145 return __smsc95xx_read_reg(dev, index, data, 0); 146} 147 148static int __must_check smsc95xx_write_reg(struct usbnet *dev, u32 index, 149 u32 data) 150{ 151 return __smsc95xx_write_reg(dev, index, data, 0); 152} |
|
119static int smsc95xx_set_feature(struct usbnet *dev, u32 feature) 120{ 121 if (WARN_ON_ONCE(!dev)) 122 return -EINVAL; 123 | 153static int smsc95xx_set_feature(struct usbnet *dev, u32 feature) 154{ 155 if (WARN_ON_ONCE(!dev)) 156 return -EINVAL; 157 |
124 return usbnet_write_cmd(dev, USB_REQ_SET_FEATURE, 125 USB_RECIP_DEVICE, feature, 0, NULL, 0); | 158 return usbnet_write_cmd_nopm(dev, USB_REQ_SET_FEATURE, 159 USB_RECIP_DEVICE, feature, 0, 160 NULL, 0); |
126} 127 128static int smsc95xx_clear_feature(struct usbnet *dev, u32 feature) 129{ 130 if (WARN_ON_ONCE(!dev)) 131 return -EINVAL; 132 | 161} 162 163static int smsc95xx_clear_feature(struct usbnet *dev, u32 feature) 164{ 165 if (WARN_ON_ONCE(!dev)) 166 return -EINVAL; 167 |
133 return usbnet_write_cmd(dev, USB_REQ_CLEAR_FEATURE, 134 USB_RECIP_DEVICE, feature, 0, NULL, 0); | 168 return usbnet_write_cmd_nopm(dev, USB_REQ_CLEAR_FEATURE, 169 USB_RECIP_DEVICE, feature, 170 0, NULL, 0); |
135} 136 137/* Loop until the read is completed with timeout 138 * called with phy_mutex held */ 139static int __must_check smsc95xx_phy_wait_not_busy(struct usbnet *dev) 140{ 141 unsigned long start_time = jiffies; 142 u32 val; --- 560 unchanged lines hidden (view full) --- 703 /* Enable Tx at SCSRs */ 704 ret = smsc95xx_write_reg(dev, TX_CFG, TX_CFG_ON_); 705 check_warn_return(ret, "Failed to write TX_CFG: %d\n", ret); 706 707 return 0; 708} 709 710/* Starts the Receive path */ | 171} 172 173/* Loop until the read is completed with timeout 174 * called with phy_mutex held */ 175static int __must_check smsc95xx_phy_wait_not_busy(struct usbnet *dev) 176{ 177 unsigned long start_time = jiffies; 178 u32 val; --- 560 unchanged lines hidden (view full) --- 739 /* Enable Tx at SCSRs */ 740 ret = smsc95xx_write_reg(dev, TX_CFG, TX_CFG_ON_); 741 check_warn_return(ret, "Failed to write TX_CFG: %d\n", ret); 742 743 return 0; 744} 745 746/* Starts the Receive path */ |
711static int smsc95xx_start_rx_path(struct usbnet *dev) | 747static int smsc95xx_start_rx_path(struct usbnet *dev, int in_pm) |
712{ 713 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 714 unsigned long flags; 715 int ret; 716 717 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 718 pdata->mac_cr |= MAC_CR_RXEN_; 719 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags); 720 | 748{ 749 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 750 unsigned long flags; 751 int ret; 752 753 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 754 pdata->mac_cr |= MAC_CR_RXEN_; 755 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags); 756 |
721 ret = smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr); | 757 ret = __smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr, in_pm); |
722 check_warn_return(ret, "Failed to write MAC_CR: %d\n", ret); 723 724 return 0; 725} 726 727static int smsc95xx_phy_initialize(struct usbnet *dev) 728{ 729 int bmcr, ret, timeout = 0; --- 202 unchanged lines hidden (view full) --- 932 read_buf |= INT_EP_CTL_PHY_INT_; 933 934 ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf); 935 check_warn_return(ret, "Failed to write INT_EP_CTL: %d\n", ret); 936 937 ret = smsc95xx_start_tx_path(dev); 938 check_warn_return(ret, "Failed to start TX path"); 939 | 758 check_warn_return(ret, "Failed to write MAC_CR: %d\n", ret); 759 760 return 0; 761} 762 763static int smsc95xx_phy_initialize(struct usbnet *dev) 764{ 765 int bmcr, ret, timeout = 0; --- 202 unchanged lines hidden (view full) --- 968 read_buf |= INT_EP_CTL_PHY_INT_; 969 970 ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf); 971 check_warn_return(ret, "Failed to write INT_EP_CTL: %d\n", ret); 972 973 ret = smsc95xx_start_tx_path(dev); 974 check_warn_return(ret, "Failed to start TX path"); 975 |
940 ret = smsc95xx_start_rx_path(dev); | 976 ret = smsc95xx_start_rx_path(dev, 0); |
941 check_warn_return(ret, "Failed to start RX path"); 942 943 netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n"); 944 return 0; 945} 946 947static const struct net_device_ops smsc95xx_netdev_ops = { 948 .ndo_open = usbnet_open, --- 85 unchanged lines hidden (view full) --- 1034 ret = usbnet_suspend(intf, message); 1035 check_warn_return(ret, "usbnet_suspend error"); 1036 1037 /* if no wol options set, enter lowest power SUSPEND2 mode */ 1038 if (!(pdata->wolopts & SUPPORTED_WAKE)) { 1039 netdev_info(dev->net, "entering SUSPEND2 mode"); 1040 1041 /* disable energy detect (link up) & wake up events */ | 977 check_warn_return(ret, "Failed to start RX path"); 978 979 netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n"); 980 return 0; 981} 982 983static const struct net_device_ops smsc95xx_netdev_ops = { 984 .ndo_open = usbnet_open, --- 85 unchanged lines hidden (view full) --- 1070 ret = usbnet_suspend(intf, message); 1071 check_warn_return(ret, "usbnet_suspend error"); 1072 1073 /* if no wol options set, enter lowest power SUSPEND2 mode */ 1074 if (!(pdata->wolopts & SUPPORTED_WAKE)) { 1075 netdev_info(dev->net, "entering SUSPEND2 mode"); 1076 1077 /* disable energy detect (link up) & wake up events */ |
1042 ret = smsc95xx_read_reg(dev, WUCSR, &val); | 1078 ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val); |
1043 check_warn_return(ret, "Error reading WUCSR"); 1044 1045 val &= ~(WUCSR_MPEN_ | WUCSR_WAKE_EN_); 1046 | 1079 check_warn_return(ret, "Error reading WUCSR"); 1080 1081 val &= ~(WUCSR_MPEN_ | WUCSR_WAKE_EN_); 1082 |
1047 ret = smsc95xx_write_reg(dev, WUCSR, val); | 1083 ret = smsc95xx_write_reg_nopm(dev, WUCSR, val); |
1048 check_warn_return(ret, "Error writing WUCSR"); 1049 | 1084 check_warn_return(ret, "Error writing WUCSR"); 1085 |
1050 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1086 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1051 check_warn_return(ret, "Error reading PM_CTRL"); 1052 1053 val &= ~(PM_CTL_ED_EN_ | PM_CTL_WOL_EN_); 1054 | 1087 check_warn_return(ret, "Error reading PM_CTRL"); 1088 1089 val &= ~(PM_CTL_ED_EN_ | PM_CTL_WOL_EN_); 1090 |
1055 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1091 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1056 check_warn_return(ret, "Error writing PM_CTRL"); 1057 1058 /* enter suspend2 mode */ | 1092 check_warn_return(ret, "Error writing PM_CTRL"); 1093 1094 /* enter suspend2 mode */ |
1059 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1095 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1060 check_warn_return(ret, "Error reading PM_CTRL"); 1061 1062 val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_); 1063 val |= PM_CTL_SUS_MODE_2; 1064 | 1096 check_warn_return(ret, "Error reading PM_CTRL"); 1097 1098 val &= ~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_); 1099 val |= PM_CTL_SUS_MODE_2; 1100 |
1065 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1101 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1066 check_warn_return(ret, "Error writing PM_CTRL"); 1067 1068 return 0; 1069 } 1070 1071 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 1072 u32 *filter_mask = kzalloc(32, GFP_KERNEL); 1073 u32 command[2]; --- 52 unchanged lines hidden (view full) --- 1126 filter_mask[filter * 4 + 3] = 0x00; 1127 command[filter/4] |= 0x01UL << ((filter % 4) * 8); 1128 offset[filter/4] |= 0x00 << ((filter % 4) * 8); 1129 crc[filter/2] |= smsc_crc(dev->net->dev_addr, ETH_ALEN, filter); 1130 filter++; 1131 } 1132 1133 for (i = 0; i < (pdata->wuff_filter_count * 4); i++) { | 1102 check_warn_return(ret, "Error writing PM_CTRL"); 1103 1104 return 0; 1105 } 1106 1107 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 1108 u32 *filter_mask = kzalloc(32, GFP_KERNEL); 1109 u32 command[2]; --- 52 unchanged lines hidden (view full) --- 1162 filter_mask[filter * 4 + 3] = 0x00; 1163 command[filter/4] |= 0x01UL << ((filter % 4) * 8); 1164 offset[filter/4] |= 0x00 << ((filter % 4) * 8); 1165 crc[filter/2] |= smsc_crc(dev->net->dev_addr, ETH_ALEN, filter); 1166 filter++; 1167 } 1168 1169 for (i = 0; i < (pdata->wuff_filter_count * 4); i++) { |
1134 ret = smsc95xx_write_reg(dev, WUFF, filter_mask[i]); | 1170 ret = smsc95xx_write_reg_nopm(dev, WUFF, filter_mask[i]); |
1135 if (ret < 0) 1136 kfree(filter_mask); 1137 check_warn_return(ret, "Error writing WUFF"); 1138 } 1139 kfree(filter_mask); 1140 1141 for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { | 1171 if (ret < 0) 1172 kfree(filter_mask); 1173 check_warn_return(ret, "Error writing WUFF"); 1174 } 1175 kfree(filter_mask); 1176 1177 for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { |
1142 ret = smsc95xx_write_reg(dev, WUFF, command[i]); | 1178 ret = smsc95xx_write_reg_nopm(dev, WUFF, command[i]); |
1143 check_warn_return(ret, "Error writing WUFF"); 1144 } 1145 1146 for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { | 1179 check_warn_return(ret, "Error writing WUFF"); 1180 } 1181 1182 for (i = 0; i < (pdata->wuff_filter_count / 4); i++) { |
1147 ret = smsc95xx_write_reg(dev, WUFF, offset[i]); | 1183 ret = smsc95xx_write_reg_nopm(dev, WUFF, offset[i]); |
1148 check_warn_return(ret, "Error writing WUFF"); 1149 } 1150 1151 for (i = 0; i < (pdata->wuff_filter_count / 2); i++) { | 1184 check_warn_return(ret, "Error writing WUFF"); 1185 } 1186 1187 for (i = 0; i < (pdata->wuff_filter_count / 2); i++) { |
1152 ret = smsc95xx_write_reg(dev, WUFF, crc[i]); | 1188 ret = smsc95xx_write_reg_nopm(dev, WUFF, crc[i]); |
1153 check_warn_return(ret, "Error writing WUFF"); 1154 } 1155 1156 /* clear any pending pattern match packet status */ | 1189 check_warn_return(ret, "Error writing WUFF"); 1190 } 1191 1192 /* clear any pending pattern match packet status */ |
1157 ret = smsc95xx_read_reg(dev, WUCSR, &val); | 1193 ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val); |
1158 check_warn_return(ret, "Error reading WUCSR"); 1159 1160 val |= WUCSR_WUFR_; 1161 | 1194 check_warn_return(ret, "Error reading WUCSR"); 1195 1196 val |= WUCSR_WUFR_; 1197 |
1162 ret = smsc95xx_write_reg(dev, WUCSR, val); | 1198 ret = smsc95xx_write_reg_nopm(dev, WUCSR, val); |
1163 check_warn_return(ret, "Error writing WUCSR"); 1164 } 1165 1166 if (pdata->wolopts & WAKE_MAGIC) { 1167 /* clear any pending magic packet status */ | 1199 check_warn_return(ret, "Error writing WUCSR"); 1200 } 1201 1202 if (pdata->wolopts & WAKE_MAGIC) { 1203 /* clear any pending magic packet status */ |
1168 ret = smsc95xx_read_reg(dev, WUCSR, &val); | 1204 ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val); |
1169 check_warn_return(ret, "Error reading WUCSR"); 1170 1171 val |= WUCSR_MPR_; 1172 | 1205 check_warn_return(ret, "Error reading WUCSR"); 1206 1207 val |= WUCSR_MPR_; 1208 |
1173 ret = smsc95xx_write_reg(dev, WUCSR, val); | 1209 ret = smsc95xx_write_reg_nopm(dev, WUCSR, val); |
1174 check_warn_return(ret, "Error writing WUCSR"); 1175 } 1176 1177 /* enable/disable wakeup sources */ | 1210 check_warn_return(ret, "Error writing WUCSR"); 1211 } 1212 1213 /* enable/disable wakeup sources */ |
1178 ret = smsc95xx_read_reg(dev, WUCSR, &val); | 1214 ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val); |
1179 check_warn_return(ret, "Error reading WUCSR"); 1180 1181 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 1182 netdev_info(dev->net, "enabling pattern match wakeup"); 1183 val |= WUCSR_WAKE_EN_; 1184 } else { 1185 netdev_info(dev->net, "disabling pattern match wakeup"); 1186 val &= ~WUCSR_WAKE_EN_; 1187 } 1188 1189 if (pdata->wolopts & WAKE_MAGIC) { 1190 netdev_info(dev->net, "enabling magic packet wakeup"); 1191 val |= WUCSR_MPEN_; 1192 } else { 1193 netdev_info(dev->net, "disabling magic packet wakeup"); 1194 val &= ~WUCSR_MPEN_; 1195 } 1196 | 1215 check_warn_return(ret, "Error reading WUCSR"); 1216 1217 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 1218 netdev_info(dev->net, "enabling pattern match wakeup"); 1219 val |= WUCSR_WAKE_EN_; 1220 } else { 1221 netdev_info(dev->net, "disabling pattern match wakeup"); 1222 val &= ~WUCSR_WAKE_EN_; 1223 } 1224 1225 if (pdata->wolopts & WAKE_MAGIC) { 1226 netdev_info(dev->net, "enabling magic packet wakeup"); 1227 val |= WUCSR_MPEN_; 1228 } else { 1229 netdev_info(dev->net, "disabling magic packet wakeup"); 1230 val &= ~WUCSR_MPEN_; 1231 } 1232 |
1197 ret = smsc95xx_write_reg(dev, WUCSR, val); | 1233 ret = smsc95xx_write_reg_nopm(dev, WUCSR, val); |
1198 check_warn_return(ret, "Error writing WUCSR"); 1199 1200 /* enable wol wakeup source */ | 1234 check_warn_return(ret, "Error writing WUCSR"); 1235 1236 /* enable wol wakeup source */ |
1201 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1237 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1202 check_warn_return(ret, "Error reading PM_CTRL"); 1203 1204 val |= PM_CTL_WOL_EN_; 1205 | 1238 check_warn_return(ret, "Error reading PM_CTRL"); 1239 1240 val |= PM_CTL_WOL_EN_; 1241 |
1206 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1242 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1207 check_warn_return(ret, "Error writing PM_CTRL"); 1208 1209 /* enable receiver to enable frame reception */ | 1243 check_warn_return(ret, "Error writing PM_CTRL"); 1244 1245 /* enable receiver to enable frame reception */ |
1210 smsc95xx_start_rx_path(dev); | 1246 smsc95xx_start_rx_path(dev, 1); |
1211 1212 /* some wol options are enabled, so enter SUSPEND0 */ 1213 netdev_info(dev->net, "entering SUSPEND0 mode"); 1214 | 1247 1248 /* some wol options are enabled, so enter SUSPEND0 */ 1249 netdev_info(dev->net, "entering SUSPEND0 mode"); 1250 |
1215 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1251 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1216 check_warn_return(ret, "Error reading PM_CTRL"); 1217 1218 val &= (~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_)); 1219 val |= PM_CTL_SUS_MODE_0; 1220 | 1252 check_warn_return(ret, "Error reading PM_CTRL"); 1253 1254 val &= (~(PM_CTL_SUS_MODE_ | PM_CTL_WUPS_ | PM_CTL_PHY_RST_)); 1255 val |= PM_CTL_SUS_MODE_0; 1256 |
1221 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1257 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1222 check_warn_return(ret, "Error writing PM_CTRL"); 1223 1224 /* clear wol status */ 1225 val &= ~PM_CTL_WUPS_; 1226 val |= PM_CTL_WUPS_WOL_; | 1258 check_warn_return(ret, "Error writing PM_CTRL"); 1259 1260 /* clear wol status */ 1261 val &= ~PM_CTL_WUPS_; 1262 val |= PM_CTL_WUPS_WOL_; |
1227 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1263 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1228 check_warn_return(ret, "Error writing PM_CTRL"); 1229 1230 /* read back PM_CTRL */ | 1264 check_warn_return(ret, "Error writing PM_CTRL"); 1265 1266 /* read back PM_CTRL */ |
1231 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1267 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1232 check_warn_return(ret, "Error reading PM_CTRL"); 1233 1234 smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP); 1235 1236 return 0; 1237} 1238 1239static int smsc95xx_resume(struct usb_interface *intf) --- 4 unchanged lines hidden (view full) --- 1244 u32 val; 1245 1246 BUG_ON(!dev); 1247 1248 if (pdata->wolopts) { 1249 smsc95xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP); 1250 1251 /* clear wake-up sources */ | 1268 check_warn_return(ret, "Error reading PM_CTRL"); 1269 1270 smsc95xx_set_feature(dev, USB_DEVICE_REMOTE_WAKEUP); 1271 1272 return 0; 1273} 1274 1275static int smsc95xx_resume(struct usb_interface *intf) --- 4 unchanged lines hidden (view full) --- 1280 u32 val; 1281 1282 BUG_ON(!dev); 1283 1284 if (pdata->wolopts) { 1285 smsc95xx_clear_feature(dev, USB_DEVICE_REMOTE_WAKEUP); 1286 1287 /* clear wake-up sources */ |
1252 ret = smsc95xx_read_reg(dev, WUCSR, &val); | 1288 ret = smsc95xx_read_reg_nopm(dev, WUCSR, &val); |
1253 check_warn_return(ret, "Error reading WUCSR"); 1254 1255 val &= ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_); 1256 | 1289 check_warn_return(ret, "Error reading WUCSR"); 1290 1291 val &= ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_); 1292 |
1257 ret = smsc95xx_write_reg(dev, WUCSR, val); | 1293 ret = smsc95xx_write_reg_nopm(dev, WUCSR, val); |
1258 check_warn_return(ret, "Error writing WUCSR"); 1259 1260 /* clear wake-up status */ | 1294 check_warn_return(ret, "Error writing WUCSR"); 1295 1296 /* clear wake-up status */ |
1261 ret = smsc95xx_read_reg(dev, PM_CTRL, &val); | 1297 ret = smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); |
1262 check_warn_return(ret, "Error reading PM_CTRL"); 1263 1264 val &= ~PM_CTL_WOL_EN_; 1265 val |= PM_CTL_WUPS_; 1266 | 1298 check_warn_return(ret, "Error reading PM_CTRL"); 1299 1300 val &= ~PM_CTL_WOL_EN_; 1301 val |= PM_CTL_WUPS_; 1302 |
1267 ret = smsc95xx_write_reg(dev, PM_CTRL, val); | 1303 ret = smsc95xx_write_reg_nopm(dev, PM_CTRL, val); |
1268 check_warn_return(ret, "Error writing PM_CTRL"); 1269 } 1270 1271 return usbnet_resume(intf); 1272 check_warn_return(ret, "usbnet_resume error"); 1273 1274 return 0; 1275} --- 276 unchanged lines hidden --- | 1304 check_warn_return(ret, "Error writing PM_CTRL"); 1305 } 1306 1307 return usbnet_resume(intf); 1308 check_warn_return(ret, "usbnet_resume error"); 1309 1310 return 0; 1311} --- 276 unchanged lines hidden --- |