1d4026123SMarius B. Kotsbak /* 2d4026123SMarius B. Kotsbak * USB network interface driver for Samsung Kalmia based LTE USB modem like the 3d4026123SMarius B. Kotsbak * Samsung GT-B3730 and GT-B3710. 4d4026123SMarius B. Kotsbak * 5d4026123SMarius B. Kotsbak * Copyright (C) 2011 Marius Bjoernstad Kotsbak <marius@kotsbak.com> 6d4026123SMarius B. Kotsbak * 7d4026123SMarius B. Kotsbak * Sponsored by Quicklink Video Distribution Services Ltd. 8d4026123SMarius B. Kotsbak * 9d4026123SMarius B. Kotsbak * Based on the cdc_eem module. 10d4026123SMarius B. Kotsbak * 11d4026123SMarius B. Kotsbak * This program is free software; you can redistribute it and/or modify 12d4026123SMarius B. Kotsbak * it under the terms of the GNU General Public License as published by 13d4026123SMarius B. Kotsbak * the Free Software Foundation; either version 2 of the License, or 14d4026123SMarius B. Kotsbak * (at your option) any later version. 15d4026123SMarius B. Kotsbak */ 16d4026123SMarius B. Kotsbak 17d4026123SMarius B. Kotsbak #include <linux/module.h> 18d4026123SMarius B. Kotsbak #include <linux/init.h> 19d4026123SMarius B. Kotsbak #include <linux/netdevice.h> 20d4026123SMarius B. Kotsbak #include <linux/etherdevice.h> 21d4026123SMarius B. Kotsbak #include <linux/ctype.h> 22d4026123SMarius B. Kotsbak #include <linux/ethtool.h> 23d4026123SMarius B. Kotsbak #include <linux/workqueue.h> 24d4026123SMarius B. Kotsbak #include <linux/mii.h> 25d4026123SMarius B. Kotsbak #include <linux/usb.h> 26d4026123SMarius B. Kotsbak #include <linux/crc32.h> 27d4026123SMarius B. Kotsbak #include <linux/usb/cdc.h> 28d4026123SMarius B. Kotsbak #include <linux/usb/usbnet.h> 29d4026123SMarius B. Kotsbak #include <linux/gfp.h> 30d4026123SMarius B. Kotsbak 31d4026123SMarius B. Kotsbak /* 32d4026123SMarius B. Kotsbak * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control 33d4026123SMarius B. Kotsbak * handled by the "option" module and an ethernet data port handled by this 34d4026123SMarius B. Kotsbak * module. 35d4026123SMarius B. Kotsbak * 36d4026123SMarius B. Kotsbak * The stick must first be switched into modem mode by usb_modeswitch 37d4026123SMarius B. Kotsbak * or similar tool. Then the modem gets sent two initialization packets by 38d4026123SMarius B. Kotsbak * this module, which gives the MAC address of the device. User space can then 39d4026123SMarius B. Kotsbak * connect the modem using AT commands through the ACM port and then use 40d4026123SMarius B. Kotsbak * DHCP on the network interface exposed by this module. Network packets are 41d4026123SMarius B. Kotsbak * sent to and from the modem in a proprietary format discovered after watching 42d4026123SMarius B. Kotsbak * the behavior of the windows driver for the modem. 43d4026123SMarius B. Kotsbak * 44d4026123SMarius B. Kotsbak * More information about the use of the modem is available in usb_modeswitch 45d4026123SMarius B. Kotsbak * forum and the project page: 46d4026123SMarius B. Kotsbak * 47d4026123SMarius B. Kotsbak * http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=465 48d4026123SMarius B. Kotsbak * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver 49d4026123SMarius B. Kotsbak */ 50d4026123SMarius B. Kotsbak 51d4026123SMarius B. Kotsbak /* #define DEBUG */ 52d4026123SMarius B. Kotsbak /* #define VERBOSE */ 53d4026123SMarius B. Kotsbak 54d4026123SMarius B. Kotsbak #define KALMIA_HEADER_LENGTH 6 55d4026123SMarius B. Kotsbak #define KALMIA_ALIGN_SIZE 4 56d4026123SMarius B. Kotsbak #define KALMIA_USB_TIMEOUT 10000 57d4026123SMarius B. Kotsbak 58d4026123SMarius B. Kotsbak /*-------------------------------------------------------------------------*/ 59d4026123SMarius B. Kotsbak 60d4026123SMarius B. Kotsbak static int 61d4026123SMarius B. Kotsbak kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len, 62d4026123SMarius B. Kotsbak u8 *buffer, u8 expected_len) 63d4026123SMarius B. Kotsbak { 64d4026123SMarius B. Kotsbak int act_len; 65d4026123SMarius B. Kotsbak int status; 66d4026123SMarius B. Kotsbak 67d4026123SMarius B. Kotsbak netdev_dbg(dev->net, "Sending init packet"); 68d4026123SMarius B. Kotsbak 69d4026123SMarius B. Kotsbak status = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 0x02), 70d4026123SMarius B. Kotsbak init_msg, init_msg_len, &act_len, KALMIA_USB_TIMEOUT); 71d4026123SMarius B. Kotsbak if (status != 0) { 72d4026123SMarius B. Kotsbak netdev_err(dev->net, 73d4026123SMarius B. Kotsbak "Error sending init packet. Status %i, length %i\n", 74d4026123SMarius B. Kotsbak status, act_len); 75d4026123SMarius B. Kotsbak return status; 76d4026123SMarius B. Kotsbak } 77d4026123SMarius B. Kotsbak else if (act_len != init_msg_len) { 78d4026123SMarius B. Kotsbak netdev_err(dev->net, 79d4026123SMarius B. Kotsbak "Did not send all of init packet. Bytes sent: %i", 80d4026123SMarius B. Kotsbak act_len); 81d4026123SMarius B. Kotsbak } 82d4026123SMarius B. Kotsbak else { 83d4026123SMarius B. Kotsbak netdev_dbg(dev->net, "Successfully sent init packet."); 84d4026123SMarius B. Kotsbak } 85d4026123SMarius B. Kotsbak 86d4026123SMarius B. Kotsbak status = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, 0x81), 87d4026123SMarius B. Kotsbak buffer, expected_len, &act_len, KALMIA_USB_TIMEOUT); 88d4026123SMarius B. Kotsbak 89d4026123SMarius B. Kotsbak if (status != 0) 90d4026123SMarius B. Kotsbak netdev_err(dev->net, 91d4026123SMarius B. Kotsbak "Error receiving init result. Status %i, length %i\n", 92d4026123SMarius B. Kotsbak status, act_len); 93d4026123SMarius B. Kotsbak else if (act_len != expected_len) 94d4026123SMarius B. Kotsbak netdev_err(dev->net, "Unexpected init result length: %i\n", 95d4026123SMarius B. Kotsbak act_len); 96d4026123SMarius B. Kotsbak 97d4026123SMarius B. Kotsbak return status; 98d4026123SMarius B. Kotsbak } 99d4026123SMarius B. Kotsbak 100d4026123SMarius B. Kotsbak static int 101d4026123SMarius B. Kotsbak kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr) 102d4026123SMarius B. Kotsbak { 103bd0d7aa6SJesper Juhl static const char init_msg_1[] = 104d4026123SMarius B. Kotsbak { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 105d4026123SMarius B. Kotsbak 0x00, 0x00 }; 106bd0d7aa6SJesper Juhl static const char init_msg_2[] = 107d4026123SMarius B. Kotsbak { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4, 108d4026123SMarius B. Kotsbak 0x00, 0x00 }; 109bd0d7aa6SJesper Juhl static const int buflen = 28; 1107cdfa4a3SMarius B. Kotsbak char *usb_buf; 111d4026123SMarius B. Kotsbak int status; 112d4026123SMarius B. Kotsbak 1137cdfa4a3SMarius B. Kotsbak usb_buf = kmalloc(buflen, GFP_DMA | GFP_KERNEL); 1147cdfa4a3SMarius B. Kotsbak if (!usb_buf) 1157cdfa4a3SMarius B. Kotsbak return -ENOMEM; 1167cdfa4a3SMarius B. Kotsbak 1177cdfa4a3SMarius B. Kotsbak memcpy(usb_buf, init_msg_1, 12); 1187cdfa4a3SMarius B. Kotsbak status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_1) 1197cdfa4a3SMarius B. Kotsbak / sizeof(init_msg_1[0]), usb_buf, 24); 120d4026123SMarius B. Kotsbak if (status != 0) 121d4026123SMarius B. Kotsbak return status; 122d4026123SMarius B. Kotsbak 1237cdfa4a3SMarius B. Kotsbak memcpy(usb_buf, init_msg_2, 12); 1247cdfa4a3SMarius B. Kotsbak status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_2) 1257cdfa4a3SMarius B. Kotsbak / sizeof(init_msg_2[0]), usb_buf, 28); 126d4026123SMarius B. Kotsbak if (status != 0) 127d4026123SMarius B. Kotsbak return status; 128d4026123SMarius B. Kotsbak 1297cdfa4a3SMarius B. Kotsbak memcpy(ethernet_addr, usb_buf + 10, ETH_ALEN); 130d4026123SMarius B. Kotsbak 1317cdfa4a3SMarius B. Kotsbak kfree(usb_buf); 132d4026123SMarius B. Kotsbak return status; 133d4026123SMarius B. Kotsbak } 134d4026123SMarius B. Kotsbak 135d4026123SMarius B. Kotsbak static int 136d4026123SMarius B. Kotsbak kalmia_bind(struct usbnet *dev, struct usb_interface *intf) 137d4026123SMarius B. Kotsbak { 1385c18e80bSDan Carpenter int status; 139d4026123SMarius B. Kotsbak u8 ethernet_addr[ETH_ALEN]; 140d4026123SMarius B. Kotsbak 141d4026123SMarius B. Kotsbak /* Don't bind to AT command interface */ 142d4026123SMarius B. Kotsbak if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) 143d4026123SMarius B. Kotsbak return -EINVAL; 144d4026123SMarius B. Kotsbak 145d4026123SMarius B. Kotsbak dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK); 146d4026123SMarius B. Kotsbak dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK); 147d4026123SMarius B. Kotsbak dev->status = NULL; 148d4026123SMarius B. Kotsbak 149d4026123SMarius B. Kotsbak dev->net->hard_header_len += KALMIA_HEADER_LENGTH; 150d4026123SMarius B. Kotsbak dev->hard_mtu = 1400; 151d4026123SMarius B. Kotsbak dev->rx_urb_size = dev->hard_mtu * 10; // Found as optimal after testing 152d4026123SMarius B. Kotsbak 153d4026123SMarius B. Kotsbak status = kalmia_init_and_get_ethernet_addr(dev, ethernet_addr); 154d4026123SMarius B. Kotsbak 155d4026123SMarius B. Kotsbak if (status < 0) { 156d4026123SMarius B. Kotsbak usb_set_intfdata(intf, NULL); 157d4026123SMarius B. Kotsbak usb_driver_release_interface(driver_of(intf), intf); 158d4026123SMarius B. Kotsbak return status; 159d4026123SMarius B. Kotsbak } 160d4026123SMarius B. Kotsbak 161d4026123SMarius B. Kotsbak memcpy(dev->net->dev_addr, ethernet_addr, ETH_ALEN); 162d4026123SMarius B. Kotsbak 163d4026123SMarius B. Kotsbak return status; 164d4026123SMarius B. Kotsbak } 165d4026123SMarius B. Kotsbak 166d4026123SMarius B. Kotsbak static struct sk_buff * 167d4026123SMarius B. Kotsbak kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) 168d4026123SMarius B. Kotsbak { 169d4026123SMarius B. Kotsbak struct sk_buff *skb2 = NULL; 170d4026123SMarius B. Kotsbak u16 content_len; 171d4026123SMarius B. Kotsbak unsigned char *header_start; 172d4026123SMarius B. Kotsbak unsigned char ether_type_1, ether_type_2; 173d4026123SMarius B. Kotsbak u8 remainder, padlen = 0; 174d4026123SMarius B. Kotsbak 175d4026123SMarius B. Kotsbak if (!skb_cloned(skb)) { 176d4026123SMarius B. Kotsbak int headroom = skb_headroom(skb); 177d4026123SMarius B. Kotsbak int tailroom = skb_tailroom(skb); 178d4026123SMarius B. Kotsbak 179d4026123SMarius B. Kotsbak if ((tailroom >= KALMIA_ALIGN_SIZE) && (headroom 180d4026123SMarius B. Kotsbak >= KALMIA_HEADER_LENGTH)) 181d4026123SMarius B. Kotsbak goto done; 182d4026123SMarius B. Kotsbak 183d4026123SMarius B. Kotsbak if ((headroom + tailroom) > (KALMIA_HEADER_LENGTH 184d4026123SMarius B. Kotsbak + KALMIA_ALIGN_SIZE)) { 185d4026123SMarius B. Kotsbak skb->data = memmove(skb->head + KALMIA_HEADER_LENGTH, 186d4026123SMarius B. Kotsbak skb->data, skb->len); 187d4026123SMarius B. Kotsbak skb_set_tail_pointer(skb, skb->len); 188d4026123SMarius B. Kotsbak goto done; 189d4026123SMarius B. Kotsbak } 190d4026123SMarius B. Kotsbak } 191d4026123SMarius B. Kotsbak 192d4026123SMarius B. Kotsbak skb2 = skb_copy_expand(skb, KALMIA_HEADER_LENGTH, 193d4026123SMarius B. Kotsbak KALMIA_ALIGN_SIZE, flags); 194d4026123SMarius B. Kotsbak if (!skb2) 195d4026123SMarius B. Kotsbak return NULL; 196d4026123SMarius B. Kotsbak 197d4026123SMarius B. Kotsbak dev_kfree_skb_any(skb); 198d4026123SMarius B. Kotsbak skb = skb2; 199d4026123SMarius B. Kotsbak 2007cdfa4a3SMarius B. Kotsbak done: 2017cdfa4a3SMarius B. Kotsbak header_start = skb_push(skb, KALMIA_HEADER_LENGTH); 202d4026123SMarius B. Kotsbak ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12]; 203d4026123SMarius B. Kotsbak ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13]; 204d4026123SMarius B. Kotsbak 205d4026123SMarius B. Kotsbak netdev_dbg(dev->net, "Sending etherType: %02x%02x", ether_type_1, 206d4026123SMarius B. Kotsbak ether_type_2); 207d4026123SMarius B. Kotsbak 208d4026123SMarius B. Kotsbak /* According to empiric data for data packages */ 209d4026123SMarius B. Kotsbak header_start[0] = 0x57; 210d4026123SMarius B. Kotsbak header_start[1] = 0x44; 211d4026123SMarius B. Kotsbak content_len = skb->len - KALMIA_HEADER_LENGTH; 212d4026123SMarius B. Kotsbak 2137cdfa4a3SMarius B. Kotsbak put_unaligned_le16(content_len, &header_start[2]); 214d4026123SMarius B. Kotsbak header_start[4] = ether_type_1; 215d4026123SMarius B. Kotsbak header_start[5] = ether_type_2; 216d4026123SMarius B. Kotsbak 217d4026123SMarius B. Kotsbak /* Align to 4 bytes by padding with zeros */ 218d4026123SMarius B. Kotsbak remainder = skb->len % KALMIA_ALIGN_SIZE; 219d4026123SMarius B. Kotsbak if (remainder > 0) { 220d4026123SMarius B. Kotsbak padlen = KALMIA_ALIGN_SIZE - remainder; 221d4026123SMarius B. Kotsbak memset(skb_put(skb, padlen), 0, padlen); 222d4026123SMarius B. Kotsbak } 223d4026123SMarius B. Kotsbak 224*cbb963deSAndy Shevchenko netdev_dbg(dev->net, 225*cbb963deSAndy Shevchenko "Sending package with length %i and padding %i. Header: %6phC.", 226*cbb963deSAndy Shevchenko content_len, padlen, header_start); 227d4026123SMarius B. Kotsbak 228d4026123SMarius B. Kotsbak return skb; 229d4026123SMarius B. Kotsbak } 230d4026123SMarius B. Kotsbak 231d4026123SMarius B. Kotsbak static int 232d4026123SMarius B. Kotsbak kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 233d4026123SMarius B. Kotsbak { 234d4026123SMarius B. Kotsbak /* 235d4026123SMarius B. Kotsbak * Our task here is to strip off framing, leaving skb with one 236d4026123SMarius B. Kotsbak * data frame for the usbnet framework code to process. 237d4026123SMarius B. Kotsbak */ 238bd0d7aa6SJesper Juhl static const u8 HEADER_END_OF_USB_PACKET[] = 239d4026123SMarius B. Kotsbak { 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 }; 240bd0d7aa6SJesper Juhl static const u8 EXPECTED_UNKNOWN_HEADER_1[] = 241d4026123SMarius B. Kotsbak { 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 }; 242bd0d7aa6SJesper Juhl static const u8 EXPECTED_UNKNOWN_HEADER_2[] = 243d4026123SMarius B. Kotsbak { 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 }; 2447cdfa4a3SMarius B. Kotsbak int i = 0; 245d4026123SMarius B. Kotsbak 246d4026123SMarius B. Kotsbak /* incomplete header? */ 247d4026123SMarius B. Kotsbak if (skb->len < KALMIA_HEADER_LENGTH) 248d4026123SMarius B. Kotsbak return 0; 249d4026123SMarius B. Kotsbak 250d4026123SMarius B. Kotsbak do { 251d4026123SMarius B. Kotsbak struct sk_buff *skb2 = NULL; 252d4026123SMarius B. Kotsbak u8 *header_start; 253d4026123SMarius B. Kotsbak u16 usb_packet_length, ether_packet_length; 254d4026123SMarius B. Kotsbak int is_last; 255d4026123SMarius B. Kotsbak 256d4026123SMarius B. Kotsbak header_start = skb->data; 257d4026123SMarius B. Kotsbak 258d4026123SMarius B. Kotsbak if (unlikely(header_start[0] != 0x57 || header_start[1] != 0x44)) { 259d4026123SMarius B. Kotsbak if (!memcmp(header_start, EXPECTED_UNKNOWN_HEADER_1, 260d4026123SMarius B. Kotsbak sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp( 261d4026123SMarius B. Kotsbak header_start, EXPECTED_UNKNOWN_HEADER_2, 262d4026123SMarius B. Kotsbak sizeof(EXPECTED_UNKNOWN_HEADER_2))) { 263*cbb963deSAndy Shevchenko netdev_dbg(dev->net, 264*cbb963deSAndy Shevchenko "Received expected unknown frame header: %6phC. Package length: %i\n", 265*cbb963deSAndy Shevchenko header_start, 266d4026123SMarius B. Kotsbak skb->len - KALMIA_HEADER_LENGTH); 267d4026123SMarius B. Kotsbak } 268d4026123SMarius B. Kotsbak else { 269*cbb963deSAndy Shevchenko netdev_err(dev->net, 270*cbb963deSAndy Shevchenko "Received unknown frame header: %6phC. Package length: %i\n", 271*cbb963deSAndy Shevchenko header_start, 272d4026123SMarius B. Kotsbak skb->len - KALMIA_HEADER_LENGTH); 273d4026123SMarius B. Kotsbak return 0; 274d4026123SMarius B. Kotsbak } 275d4026123SMarius B. Kotsbak } 276d4026123SMarius B. Kotsbak else 277*cbb963deSAndy Shevchenko netdev_dbg(dev->net, 278*cbb963deSAndy Shevchenko "Received header: %6phC. Package length: %i\n", 279*cbb963deSAndy Shevchenko header_start, skb->len - KALMIA_HEADER_LENGTH); 280d4026123SMarius B. Kotsbak 281d4026123SMarius B. Kotsbak /* subtract start header and end header */ 282d4026123SMarius B. Kotsbak usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH); 2837cdfa4a3SMarius B. Kotsbak ether_packet_length = get_unaligned_le16(&header_start[2]); 284d4026123SMarius B. Kotsbak skb_pull(skb, KALMIA_HEADER_LENGTH); 285d4026123SMarius B. Kotsbak 286d4026123SMarius B. Kotsbak /* Some small packets misses end marker */ 287d4026123SMarius B. Kotsbak if (usb_packet_length < ether_packet_length) { 288d4026123SMarius B. Kotsbak ether_packet_length = usb_packet_length 289d4026123SMarius B. Kotsbak + KALMIA_HEADER_LENGTH; 290d4026123SMarius B. Kotsbak is_last = true; 291d4026123SMarius B. Kotsbak } 292d4026123SMarius B. Kotsbak else { 293d4026123SMarius B. Kotsbak netdev_dbg(dev->net, "Correct package length #%i", i 294d4026123SMarius B. Kotsbak + 1); 295d4026123SMarius B. Kotsbak 296d4026123SMarius B. Kotsbak is_last = (memcmp(skb->data + ether_packet_length, 297d4026123SMarius B. Kotsbak HEADER_END_OF_USB_PACKET, 298d4026123SMarius B. Kotsbak sizeof(HEADER_END_OF_USB_PACKET)) == 0); 299d4026123SMarius B. Kotsbak if (!is_last) { 300d4026123SMarius B. Kotsbak header_start = skb->data + ether_packet_length; 301*cbb963deSAndy Shevchenko netdev_dbg(dev->net, 302*cbb963deSAndy Shevchenko "End header: %6phC. Package length: %i\n", 303*cbb963deSAndy Shevchenko header_start, 304d4026123SMarius B. Kotsbak skb->len - KALMIA_HEADER_LENGTH); 305d4026123SMarius B. Kotsbak } 306d4026123SMarius B. Kotsbak } 307d4026123SMarius B. Kotsbak 308d4026123SMarius B. Kotsbak if (is_last) { 309d4026123SMarius B. Kotsbak skb2 = skb; 310d4026123SMarius B. Kotsbak } 311d4026123SMarius B. Kotsbak else { 312d4026123SMarius B. Kotsbak skb2 = skb_clone(skb, GFP_ATOMIC); 313d4026123SMarius B. Kotsbak if (unlikely(!skb2)) 314d4026123SMarius B. Kotsbak return 0; 315d4026123SMarius B. Kotsbak } 316d4026123SMarius B. Kotsbak 317d4026123SMarius B. Kotsbak skb_trim(skb2, ether_packet_length); 318d4026123SMarius B. Kotsbak 319d4026123SMarius B. Kotsbak if (is_last) { 320d4026123SMarius B. Kotsbak return 1; 321d4026123SMarius B. Kotsbak } 322d4026123SMarius B. Kotsbak else { 323d4026123SMarius B. Kotsbak usbnet_skb_return(dev, skb2); 324d4026123SMarius B. Kotsbak skb_pull(skb, ether_packet_length); 325d4026123SMarius B. Kotsbak } 326d4026123SMarius B. Kotsbak 327d4026123SMarius B. Kotsbak i++; 328d4026123SMarius B. Kotsbak } 329d4026123SMarius B. Kotsbak while (skb->len); 330d4026123SMarius B. Kotsbak 331d4026123SMarius B. Kotsbak return 1; 332d4026123SMarius B. Kotsbak } 333d4026123SMarius B. Kotsbak 334d4026123SMarius B. Kotsbak static const struct driver_info kalmia_info = { 335d4026123SMarius B. Kotsbak .description = "Samsung Kalmia LTE USB dongle", 336d4026123SMarius B. Kotsbak .flags = FLAG_WWAN, 337d4026123SMarius B. Kotsbak .bind = kalmia_bind, 338d4026123SMarius B. Kotsbak .rx_fixup = kalmia_rx_fixup, 339d4026123SMarius B. Kotsbak .tx_fixup = kalmia_tx_fixup 340d4026123SMarius B. Kotsbak }; 341d4026123SMarius B. Kotsbak 342d4026123SMarius B. Kotsbak /*-------------------------------------------------------------------------*/ 343d4026123SMarius B. Kotsbak 344d4026123SMarius B. Kotsbak static const struct usb_device_id products[] = { 345d4026123SMarius B. Kotsbak /* The unswitched USB ID, to get the module auto loaded: */ 346d4026123SMarius B. Kotsbak { USB_DEVICE(0x04e8, 0x689a) }, 347d4026123SMarius B. Kotsbak /* The stick swithed into modem (by e.g. usb_modeswitch): */ 348d4026123SMarius B. Kotsbak { USB_DEVICE(0x04e8, 0x6889), 349d4026123SMarius B. Kotsbak .driver_info = (unsigned long) &kalmia_info, }, 350d4026123SMarius B. Kotsbak { /* EMPTY == end of list */} }; 351d4026123SMarius B. Kotsbak MODULE_DEVICE_TABLE( usb, products); 352d4026123SMarius B. Kotsbak 353d4026123SMarius B. Kotsbak static struct usb_driver kalmia_driver = { 354d4026123SMarius B. Kotsbak .name = "kalmia", 355d4026123SMarius B. Kotsbak .id_table = products, 356d4026123SMarius B. Kotsbak .probe = usbnet_probe, 357d4026123SMarius B. Kotsbak .disconnect = usbnet_disconnect, 358d4026123SMarius B. Kotsbak .suspend = usbnet_suspend, 359e1f12eb6SSarah Sharp .resume = usbnet_resume, 360e1f12eb6SSarah Sharp .disable_hub_initiated_lpm = 1, 361d4026123SMarius B. Kotsbak }; 362d4026123SMarius B. Kotsbak 363d632eb1bSGreg Kroah-Hartman module_usb_driver(kalmia_driver); 364d4026123SMarius B. Kotsbak 365d4026123SMarius B. Kotsbak MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>"); 366d4026123SMarius B. Kotsbak MODULE_DESCRIPTION("Samsung Kalmia USB network driver"); 367d4026123SMarius B. Kotsbak MODULE_LICENSE("GPL"); 368