mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
usbnet: Use lte%d interface name for 4g modem
Change-Id: Ifb58d307fb090943dfd267b614deb6a08a6f7ac8 Signed-off-by: Alex Zhao <zzc@rock-chips.com>
This commit is contained in:
@@ -554,6 +554,16 @@ static const struct driver_info wwan_info = {
|
||||
.manage_power = usbnet_manage_power,
|
||||
};
|
||||
|
||||
static const struct driver_info lte_info = {
|
||||
.description = "CDC Ethernet Device(lte)",
|
||||
.flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_LTE,
|
||||
.bind = usbnet_cdc_bind,
|
||||
.unbind = usbnet_cdc_unbind,
|
||||
.status = usbnet_cdc_status,
|
||||
.set_rx_mode = usbnet_cdc_update_filter,
|
||||
.manage_power = usbnet_manage_power,
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#define HUAWEI_VENDOR_ID 0x12D1
|
||||
@@ -914,6 +924,12 @@ static const struct usb_device_id products[] = {
|
||||
USB_CDC_SUBCLASS_ETHERNET,
|
||||
USB_CDC_PROTO_NONE),
|
||||
.driver_info = (unsigned long)&wwan_info,
|
||||
}, {
|
||||
/* RM310 modules*/
|
||||
USB_DEVICE_AND_INTERFACE_INFO(0x1286, 0x4E3C, USB_CLASS_COMM,
|
||||
USB_CDC_SUBCLASS_ETHERNET,
|
||||
USB_CDC_PROTO_NONE),
|
||||
.driver_info = (unsigned long)<e_info,
|
||||
}, {
|
||||
USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
|
||||
USB_CDC_PROTO_NONE),
|
||||
|
||||
@@ -1756,6 +1756,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
|
||||
if ((dev->driver_info->flags & FLAG_WWAN) != 0)
|
||||
strcpy(net->name, "wwan%d");
|
||||
|
||||
/* LTE devices should always be named "lte%d" */
|
||||
if ((dev->driver_info->flags & FLAG_LTE) != 0)
|
||||
strcpy(net->name, "lte%d");
|
||||
|
||||
/* devices that cannot do ARP */
|
||||
if ((dev->driver_info->flags & FLAG_NOARP) != 0)
|
||||
net->flags |= IFF_NOARP;
|
||||
|
||||
@@ -568,6 +568,7 @@ static void option_instat_callback(struct urb *urb);
|
||||
|
||||
|
||||
static const struct usb_device_id option_ids[] = {
|
||||
{ USB_DEVICE(0x1286, 0x4e3c) },
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
|
||||
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
|
||||
|
||||
@@ -491,6 +491,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
|
||||
{
|
||||
struct usb_serial *serial = port->serial;
|
||||
struct urb *urb;
|
||||
struct usb_device_descriptor *desc = &serial->dev->descriptor;
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
|
||||
if (!urb)
|
||||
@@ -500,6 +501,11 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
|
||||
usb_sndbulkpipe(serial->dev, endpoint) | dir,
|
||||
buf, len, callback, ctx);
|
||||
|
||||
if (dir == USB_DIR_OUT) {
|
||||
if ((desc->idVendor == cpu_to_le16(0x1286) &&
|
||||
desc->idProduct == cpu_to_le16(0x4e3c)))
|
||||
urb->transfer_flags |= URB_ZERO_PACKET;
|
||||
}
|
||||
return urb;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,8 @@ struct driver_info {
|
||||
#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
|
||||
#define FLAG_NOARP 0x8000 /* device can't do ARP */
|
||||
|
||||
#define FLAG_LTE 0x10000 /* use "lte%d" names */
|
||||
|
||||
/* init device ... can sleep, or cause probe() failure */
|
||||
int (*bind)(struct usbnet *, struct usb_interface *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user