diff options
author | Dan Williams <dcbw@redhat.com> | 2012-07-24 04:43:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-24 16:55:38 -0400 |
commit | f94898ea6682977f15c5a8f9ffb293a14f95455a (patch) | |
tree | 8d1f3645baac6ac1a3ef3c09b8c00766002cd018 /drivers/net | |
parent | 8b72ff6484fe303e01498b58621810a114f3cf09 (diff) |
cdc-ncm: tag Ericsson WWAN devices (eg F5521gw) with FLAG_WWAN
Tag Ericsson NCM devices as WWAN modems, since they almost certainly all
are. This way userspace clients know that the device requires further
setup on the AT-capable serial ports before connectivity is available.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 68 |
1 files changed, 45 insertions, 23 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 4b9513fcf275..f4ce5957df32 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -138,20 +138,7 @@ struct cdc_ncm_ctx { | |||
138 | static void cdc_ncm_txpath_bh(unsigned long param); | 138 | static void cdc_ncm_txpath_bh(unsigned long param); |
139 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); | 139 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); |
140 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); | 140 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); |
141 | static const struct driver_info cdc_ncm_info; | ||
142 | static struct usb_driver cdc_ncm_driver; | 141 | static struct usb_driver cdc_ncm_driver; |
143 | static const struct ethtool_ops cdc_ncm_ethtool_ops; | ||
144 | |||
145 | static const struct usb_device_id cdc_devs[] = { | ||
146 | { USB_INTERFACE_INFO(USB_CLASS_COMM, | ||
147 | USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | ||
148 | .driver_info = (unsigned long)&cdc_ncm_info, | ||
149 | }, | ||
150 | { | ||
151 | }, | ||
152 | }; | ||
153 | |||
154 | MODULE_DEVICE_TABLE(usb, cdc_devs); | ||
155 | 142 | ||
156 | static void | 143 | static void |
157 | cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) | 144 | cdc_ncm_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) |
@@ -454,6 +441,16 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx) | |||
454 | kfree(ctx); | 441 | kfree(ctx); |
455 | } | 442 | } |
456 | 443 | ||
444 | static const struct ethtool_ops cdc_ncm_ethtool_ops = { | ||
445 | .get_drvinfo = cdc_ncm_get_drvinfo, | ||
446 | .get_link = usbnet_get_link, | ||
447 | .get_msglevel = usbnet_get_msglevel, | ||
448 | .set_msglevel = usbnet_set_msglevel, | ||
449 | .get_settings = usbnet_get_settings, | ||
450 | .set_settings = usbnet_set_settings, | ||
451 | .nway_reset = usbnet_nway_reset, | ||
452 | }; | ||
453 | |||
457 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | 454 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) |
458 | { | 455 | { |
459 | struct cdc_ncm_ctx *ctx; | 456 | struct cdc_ncm_ctx *ctx; |
@@ -1203,6 +1200,41 @@ static const struct driver_info cdc_ncm_info = { | |||
1203 | .tx_fixup = cdc_ncm_tx_fixup, | 1200 | .tx_fixup = cdc_ncm_tx_fixup, |
1204 | }; | 1201 | }; |
1205 | 1202 | ||
1203 | /* Same as cdc_ncm_info, but with FLAG_WWAN */ | ||
1204 | static const struct driver_info wwan_info = { | ||
1205 | .description = "Mobile Broadband Network Device", | ||
1206 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET | ||
1207 | | FLAG_WWAN, | ||
1208 | .bind = cdc_ncm_bind, | ||
1209 | .unbind = cdc_ncm_unbind, | ||
1210 | .check_connect = cdc_ncm_check_connect, | ||
1211 | .manage_power = cdc_ncm_manage_power, | ||
1212 | .status = cdc_ncm_status, | ||
1213 | .rx_fixup = cdc_ncm_rx_fixup, | ||
1214 | .tx_fixup = cdc_ncm_tx_fixup, | ||
1215 | }; | ||
1216 | |||
1217 | static const struct usb_device_id cdc_devs[] = { | ||
1218 | /* Ericsson MBM devices like F5521gw */ | ||
1219 | { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | ||
1220 | | USB_DEVICE_ID_MATCH_VENDOR, | ||
1221 | .idVendor = 0x0bdb, | ||
1222 | .bInterfaceClass = USB_CLASS_COMM, | ||
1223 | .bInterfaceSubClass = USB_CDC_SUBCLASS_NCM, | ||
1224 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
1225 | .driver_info = (unsigned long) &wwan_info, | ||
1226 | }, | ||
1227 | |||
1228 | /* Generic CDC-NCM devices */ | ||
1229 | { USB_INTERFACE_INFO(USB_CLASS_COMM, | ||
1230 | USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | ||
1231 | .driver_info = (unsigned long)&cdc_ncm_info, | ||
1232 | }, | ||
1233 | { | ||
1234 | }, | ||
1235 | }; | ||
1236 | MODULE_DEVICE_TABLE(usb, cdc_devs); | ||
1237 | |||
1206 | static struct usb_driver cdc_ncm_driver = { | 1238 | static struct usb_driver cdc_ncm_driver = { |
1207 | .name = "cdc_ncm", | 1239 | .name = "cdc_ncm", |
1208 | .id_table = cdc_devs, | 1240 | .id_table = cdc_devs, |
@@ -1215,16 +1247,6 @@ static struct usb_driver cdc_ncm_driver = { | |||
1215 | .disable_hub_initiated_lpm = 1, | 1247 | .disable_hub_initiated_lpm = 1, |
1216 | }; | 1248 | }; |
1217 | 1249 | ||
1218 | static const struct ethtool_ops cdc_ncm_ethtool_ops = { | ||
1219 | .get_drvinfo = cdc_ncm_get_drvinfo, | ||
1220 | .get_link = usbnet_get_link, | ||
1221 | .get_msglevel = usbnet_get_msglevel, | ||
1222 | .set_msglevel = usbnet_set_msglevel, | ||
1223 | .get_settings = usbnet_get_settings, | ||
1224 | .set_settings = usbnet_set_settings, | ||
1225 | .nway_reset = usbnet_nway_reset, | ||
1226 | }; | ||
1227 | |||
1228 | module_usb_driver(cdc_ncm_driver); | 1250 | module_usb_driver(cdc_ncm_driver); |
1229 | 1251 | ||
1230 | MODULE_AUTHOR("Hans Petter Selasky"); | 1252 | MODULE_AUTHOR("Hans Petter Selasky"); |