18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * USB network interface driver for Samsung Kalmia based LTE USB modem like the
48c2ecf20Sopenharmony_ci * Samsung GT-B3730 and GT-B3710.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2011 Marius Bjoernstad Kotsbak <marius@kotsbak.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Sponsored by Quicklink Video Distribution Services Ltd.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Based on the cdc_eem module.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/module.h>
148c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
158c2ecf20Sopenharmony_ci#include <linux/etherdevice.h>
168c2ecf20Sopenharmony_ci#include <linux/ctype.h>
178c2ecf20Sopenharmony_ci#include <linux/ethtool.h>
188c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
198c2ecf20Sopenharmony_ci#include <linux/mii.h>
208c2ecf20Sopenharmony_ci#include <linux/usb.h>
218c2ecf20Sopenharmony_ci#include <linux/crc32.h>
228c2ecf20Sopenharmony_ci#include <linux/usb/cdc.h>
238c2ecf20Sopenharmony_ci#include <linux/usb/usbnet.h>
248c2ecf20Sopenharmony_ci#include <linux/gfp.h>
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control
288c2ecf20Sopenharmony_ci * handled by the "option" module and an ethernet data port handled by this
298c2ecf20Sopenharmony_ci * module.
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * The stick must first be switched into modem mode by usb_modeswitch
328c2ecf20Sopenharmony_ci * or similar tool. Then the modem gets sent two initialization packets by
338c2ecf20Sopenharmony_ci * this module, which gives the MAC address of the device. User space can then
348c2ecf20Sopenharmony_ci * connect the modem using AT commands through the ACM port and then use
358c2ecf20Sopenharmony_ci * DHCP on the network interface exposed by this module. Network packets are
368c2ecf20Sopenharmony_ci * sent to and from the modem in a proprietary format discovered after watching
378c2ecf20Sopenharmony_ci * the behavior of the windows driver for the modem.
388c2ecf20Sopenharmony_ci *
398c2ecf20Sopenharmony_ci * More information about the use of the modem is available in usb_modeswitch
408c2ecf20Sopenharmony_ci * forum and the project page:
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=465
438c2ecf20Sopenharmony_ci * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* #define	DEBUG */
478c2ecf20Sopenharmony_ci/* #define	VERBOSE */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define KALMIA_HEADER_LENGTH 6
508c2ecf20Sopenharmony_ci#define KALMIA_ALIGN_SIZE 4
518c2ecf20Sopenharmony_ci#define KALMIA_USB_TIMEOUT 10000
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------*/
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic int
568c2ecf20Sopenharmony_cikalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len,
578c2ecf20Sopenharmony_ci	u8 *buffer, u8 expected_len)
588c2ecf20Sopenharmony_ci{
598c2ecf20Sopenharmony_ci	int act_len;
608c2ecf20Sopenharmony_ci	int status;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	netdev_dbg(dev->net, "Sending init packet");
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	status = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 0x02),
658c2ecf20Sopenharmony_ci		init_msg, init_msg_len, &act_len, KALMIA_USB_TIMEOUT);
668c2ecf20Sopenharmony_ci	if (status != 0) {
678c2ecf20Sopenharmony_ci		netdev_err(dev->net,
688c2ecf20Sopenharmony_ci			"Error sending init packet. Status %i\n",
698c2ecf20Sopenharmony_ci			status);
708c2ecf20Sopenharmony_ci		return status;
718c2ecf20Sopenharmony_ci	}
728c2ecf20Sopenharmony_ci	else if (act_len != init_msg_len) {
738c2ecf20Sopenharmony_ci		netdev_err(dev->net,
748c2ecf20Sopenharmony_ci			"Did not send all of init packet. Bytes sent: %i",
758c2ecf20Sopenharmony_ci			act_len);
768c2ecf20Sopenharmony_ci	}
778c2ecf20Sopenharmony_ci	else {
788c2ecf20Sopenharmony_ci		netdev_dbg(dev->net, "Successfully sent init packet.");
798c2ecf20Sopenharmony_ci	}
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	status = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, 0x81),
828c2ecf20Sopenharmony_ci		buffer, expected_len, &act_len, KALMIA_USB_TIMEOUT);
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	if (status != 0)
858c2ecf20Sopenharmony_ci		netdev_err(dev->net,
868c2ecf20Sopenharmony_ci			"Error receiving init result. Status %i\n",
878c2ecf20Sopenharmony_ci			status);
888c2ecf20Sopenharmony_ci	else if (act_len != expected_len)
898c2ecf20Sopenharmony_ci		netdev_err(dev->net, "Unexpected init result length: %i\n",
908c2ecf20Sopenharmony_ci			act_len);
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci	return status;
938c2ecf20Sopenharmony_ci}
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_cistatic int
968c2ecf20Sopenharmony_cikalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr)
978c2ecf20Sopenharmony_ci{
988c2ecf20Sopenharmony_ci	static const char init_msg_1[] =
998c2ecf20Sopenharmony_ci		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
1008c2ecf20Sopenharmony_ci		0x00, 0x00 };
1018c2ecf20Sopenharmony_ci	static const char init_msg_2[] =
1028c2ecf20Sopenharmony_ci		{ 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4,
1038c2ecf20Sopenharmony_ci		0x00, 0x00 };
1048c2ecf20Sopenharmony_ci	static const int buflen = 28;
1058c2ecf20Sopenharmony_ci	char *usb_buf;
1068c2ecf20Sopenharmony_ci	int status;
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	usb_buf = kmalloc(buflen, GFP_DMA | GFP_KERNEL);
1098c2ecf20Sopenharmony_ci	if (!usb_buf)
1108c2ecf20Sopenharmony_ci		return -ENOMEM;
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci	memcpy(usb_buf, init_msg_1, 12);
1138c2ecf20Sopenharmony_ci	status = kalmia_send_init_packet(dev, usb_buf, ARRAY_SIZE(init_msg_1),
1148c2ecf20Sopenharmony_ci					 usb_buf, 24);
1158c2ecf20Sopenharmony_ci	if (status != 0)
1168c2ecf20Sopenharmony_ci		goto out;
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci	memcpy(usb_buf, init_msg_2, 12);
1198c2ecf20Sopenharmony_ci	status = kalmia_send_init_packet(dev, usb_buf, ARRAY_SIZE(init_msg_2),
1208c2ecf20Sopenharmony_ci					 usb_buf, 28);
1218c2ecf20Sopenharmony_ci	if (status != 0)
1228c2ecf20Sopenharmony_ci		goto out;
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci	memcpy(ethernet_addr, usb_buf + 10, ETH_ALEN);
1258c2ecf20Sopenharmony_ciout:
1268c2ecf20Sopenharmony_ci	kfree(usb_buf);
1278c2ecf20Sopenharmony_ci	return status;
1288c2ecf20Sopenharmony_ci}
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_cistatic int
1318c2ecf20Sopenharmony_cikalmia_bind(struct usbnet *dev, struct usb_interface *intf)
1328c2ecf20Sopenharmony_ci{
1338c2ecf20Sopenharmony_ci	int status;
1348c2ecf20Sopenharmony_ci	u8 ethernet_addr[ETH_ALEN];
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	/* Don't bind to AT command interface */
1378c2ecf20Sopenharmony_ci	if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
1388c2ecf20Sopenharmony_ci		return -EINVAL;
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci	dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK);
1418c2ecf20Sopenharmony_ci	dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK);
1428c2ecf20Sopenharmony_ci	dev->status = NULL;
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	dev->net->hard_header_len += KALMIA_HEADER_LENGTH;
1458c2ecf20Sopenharmony_ci	dev->hard_mtu = 1400;
1468c2ecf20Sopenharmony_ci	dev->rx_urb_size = dev->hard_mtu * 10; // Found as optimal after testing
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci	status = kalmia_init_and_get_ethernet_addr(dev, ethernet_addr);
1498c2ecf20Sopenharmony_ci	if (status)
1508c2ecf20Sopenharmony_ci		return status;
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	memcpy(dev->net->dev_addr, ethernet_addr, ETH_ALEN);
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	return status;
1558c2ecf20Sopenharmony_ci}
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_cistatic struct sk_buff *
1588c2ecf20Sopenharmony_cikalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
1598c2ecf20Sopenharmony_ci{
1608c2ecf20Sopenharmony_ci	struct sk_buff *skb2 = NULL;
1618c2ecf20Sopenharmony_ci	u16 content_len;
1628c2ecf20Sopenharmony_ci	unsigned char *header_start;
1638c2ecf20Sopenharmony_ci	unsigned char ether_type_1, ether_type_2;
1648c2ecf20Sopenharmony_ci	u8 remainder, padlen = 0;
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci	if (!skb_cloned(skb)) {
1678c2ecf20Sopenharmony_ci		int headroom = skb_headroom(skb);
1688c2ecf20Sopenharmony_ci		int tailroom = skb_tailroom(skb);
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci		if ((tailroom >= KALMIA_ALIGN_SIZE) && (headroom
1718c2ecf20Sopenharmony_ci			>= KALMIA_HEADER_LENGTH))
1728c2ecf20Sopenharmony_ci			goto done;
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci		if ((headroom + tailroom) > (KALMIA_HEADER_LENGTH
1758c2ecf20Sopenharmony_ci			+ KALMIA_ALIGN_SIZE)) {
1768c2ecf20Sopenharmony_ci			skb->data = memmove(skb->head + KALMIA_HEADER_LENGTH,
1778c2ecf20Sopenharmony_ci				skb->data, skb->len);
1788c2ecf20Sopenharmony_ci			skb_set_tail_pointer(skb, skb->len);
1798c2ecf20Sopenharmony_ci			goto done;
1808c2ecf20Sopenharmony_ci		}
1818c2ecf20Sopenharmony_ci	}
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci	skb2 = skb_copy_expand(skb, KALMIA_HEADER_LENGTH,
1848c2ecf20Sopenharmony_ci		KALMIA_ALIGN_SIZE, flags);
1858c2ecf20Sopenharmony_ci	if (!skb2)
1868c2ecf20Sopenharmony_ci		return NULL;
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	dev_kfree_skb_any(skb);
1898c2ecf20Sopenharmony_ci	skb = skb2;
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_cidone:
1928c2ecf20Sopenharmony_ci	header_start = skb_push(skb, KALMIA_HEADER_LENGTH);
1938c2ecf20Sopenharmony_ci	ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12];
1948c2ecf20Sopenharmony_ci	ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13];
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	netdev_dbg(dev->net, "Sending etherType: %02x%02x", ether_type_1,
1978c2ecf20Sopenharmony_ci		ether_type_2);
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci	/* According to empiric data for data packages */
2008c2ecf20Sopenharmony_ci	header_start[0] = 0x57;
2018c2ecf20Sopenharmony_ci	header_start[1] = 0x44;
2028c2ecf20Sopenharmony_ci	content_len = skb->len - KALMIA_HEADER_LENGTH;
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci	put_unaligned_le16(content_len, &header_start[2]);
2058c2ecf20Sopenharmony_ci	header_start[4] = ether_type_1;
2068c2ecf20Sopenharmony_ci	header_start[5] = ether_type_2;
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci	/* Align to 4 bytes by padding with zeros */
2098c2ecf20Sopenharmony_ci	remainder = skb->len % KALMIA_ALIGN_SIZE;
2108c2ecf20Sopenharmony_ci	if (remainder > 0) {
2118c2ecf20Sopenharmony_ci		padlen = KALMIA_ALIGN_SIZE - remainder;
2128c2ecf20Sopenharmony_ci		skb_put_zero(skb, padlen);
2138c2ecf20Sopenharmony_ci	}
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	netdev_dbg(dev->net,
2168c2ecf20Sopenharmony_ci		"Sending package with length %i and padding %i. Header: %6phC.",
2178c2ecf20Sopenharmony_ci		content_len, padlen, header_start);
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	return skb;
2208c2ecf20Sopenharmony_ci}
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_cistatic int
2238c2ecf20Sopenharmony_cikalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
2248c2ecf20Sopenharmony_ci{
2258c2ecf20Sopenharmony_ci	/*
2268c2ecf20Sopenharmony_ci	 * Our task here is to strip off framing, leaving skb with one
2278c2ecf20Sopenharmony_ci	 * data frame for the usbnet framework code to process.
2288c2ecf20Sopenharmony_ci	 */
2298c2ecf20Sopenharmony_ci	static const u8 HEADER_END_OF_USB_PACKET[] =
2308c2ecf20Sopenharmony_ci		{ 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 };
2318c2ecf20Sopenharmony_ci	static const u8 EXPECTED_UNKNOWN_HEADER_1[] =
2328c2ecf20Sopenharmony_ci		{ 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 };
2338c2ecf20Sopenharmony_ci	static const u8 EXPECTED_UNKNOWN_HEADER_2[] =
2348c2ecf20Sopenharmony_ci		{ 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 };
2358c2ecf20Sopenharmony_ci	int i = 0;
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci	/* incomplete header? */
2388c2ecf20Sopenharmony_ci	if (skb->len < KALMIA_HEADER_LENGTH)
2398c2ecf20Sopenharmony_ci		return 0;
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	do {
2428c2ecf20Sopenharmony_ci		struct sk_buff *skb2 = NULL;
2438c2ecf20Sopenharmony_ci		u8 *header_start;
2448c2ecf20Sopenharmony_ci		u16 usb_packet_length, ether_packet_length;
2458c2ecf20Sopenharmony_ci		int is_last;
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci		header_start = skb->data;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci		if (unlikely(header_start[0] != 0x57 || header_start[1] != 0x44)) {
2508c2ecf20Sopenharmony_ci			if (!memcmp(header_start, EXPECTED_UNKNOWN_HEADER_1,
2518c2ecf20Sopenharmony_ci				sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp(
2528c2ecf20Sopenharmony_ci				header_start, EXPECTED_UNKNOWN_HEADER_2,
2538c2ecf20Sopenharmony_ci				sizeof(EXPECTED_UNKNOWN_HEADER_2))) {
2548c2ecf20Sopenharmony_ci				netdev_dbg(dev->net,
2558c2ecf20Sopenharmony_ci					"Received expected unknown frame header: %6phC. Package length: %i\n",
2568c2ecf20Sopenharmony_ci					header_start,
2578c2ecf20Sopenharmony_ci					skb->len - KALMIA_HEADER_LENGTH);
2588c2ecf20Sopenharmony_ci			}
2598c2ecf20Sopenharmony_ci			else {
2608c2ecf20Sopenharmony_ci				netdev_err(dev->net,
2618c2ecf20Sopenharmony_ci					"Received unknown frame header: %6phC. Package length: %i\n",
2628c2ecf20Sopenharmony_ci					header_start,
2638c2ecf20Sopenharmony_ci					skb->len - KALMIA_HEADER_LENGTH);
2648c2ecf20Sopenharmony_ci				return 0;
2658c2ecf20Sopenharmony_ci			}
2668c2ecf20Sopenharmony_ci		}
2678c2ecf20Sopenharmony_ci		else
2688c2ecf20Sopenharmony_ci			netdev_dbg(dev->net,
2698c2ecf20Sopenharmony_ci				"Received header: %6phC. Package length: %i\n",
2708c2ecf20Sopenharmony_ci				header_start, skb->len - KALMIA_HEADER_LENGTH);
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci		/* subtract start header and end header */
2738c2ecf20Sopenharmony_ci		usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH);
2748c2ecf20Sopenharmony_ci		ether_packet_length = get_unaligned_le16(&header_start[2]);
2758c2ecf20Sopenharmony_ci		skb_pull(skb, KALMIA_HEADER_LENGTH);
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci		/* Some small packets misses end marker */
2788c2ecf20Sopenharmony_ci		if (usb_packet_length < ether_packet_length) {
2798c2ecf20Sopenharmony_ci			ether_packet_length = usb_packet_length
2808c2ecf20Sopenharmony_ci				+ KALMIA_HEADER_LENGTH;
2818c2ecf20Sopenharmony_ci			is_last = true;
2828c2ecf20Sopenharmony_ci		}
2838c2ecf20Sopenharmony_ci		else {
2848c2ecf20Sopenharmony_ci			netdev_dbg(dev->net, "Correct package length #%i", i
2858c2ecf20Sopenharmony_ci				+ 1);
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci			is_last = (memcmp(skb->data + ether_packet_length,
2888c2ecf20Sopenharmony_ci				HEADER_END_OF_USB_PACKET,
2898c2ecf20Sopenharmony_ci				sizeof(HEADER_END_OF_USB_PACKET)) == 0);
2908c2ecf20Sopenharmony_ci			if (!is_last) {
2918c2ecf20Sopenharmony_ci				header_start = skb->data + ether_packet_length;
2928c2ecf20Sopenharmony_ci				netdev_dbg(dev->net,
2938c2ecf20Sopenharmony_ci					"End header: %6phC. Package length: %i\n",
2948c2ecf20Sopenharmony_ci					header_start,
2958c2ecf20Sopenharmony_ci					skb->len - KALMIA_HEADER_LENGTH);
2968c2ecf20Sopenharmony_ci			}
2978c2ecf20Sopenharmony_ci		}
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci		if (is_last) {
3008c2ecf20Sopenharmony_ci			skb2 = skb;
3018c2ecf20Sopenharmony_ci		}
3028c2ecf20Sopenharmony_ci		else {
3038c2ecf20Sopenharmony_ci			skb2 = skb_clone(skb, GFP_ATOMIC);
3048c2ecf20Sopenharmony_ci			if (unlikely(!skb2))
3058c2ecf20Sopenharmony_ci				return 0;
3068c2ecf20Sopenharmony_ci		}
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci		skb_trim(skb2, ether_packet_length);
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci		if (is_last) {
3118c2ecf20Sopenharmony_ci			return 1;
3128c2ecf20Sopenharmony_ci		}
3138c2ecf20Sopenharmony_ci		else {
3148c2ecf20Sopenharmony_ci			usbnet_skb_return(dev, skb2);
3158c2ecf20Sopenharmony_ci			skb_pull(skb, ether_packet_length);
3168c2ecf20Sopenharmony_ci		}
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci		i++;
3198c2ecf20Sopenharmony_ci	}
3208c2ecf20Sopenharmony_ci	while (skb->len);
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	return 1;
3238c2ecf20Sopenharmony_ci}
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_cistatic const struct driver_info kalmia_info = {
3268c2ecf20Sopenharmony_ci	.description = "Samsung Kalmia LTE USB dongle",
3278c2ecf20Sopenharmony_ci	.flags = FLAG_WWAN,
3288c2ecf20Sopenharmony_ci	.bind = kalmia_bind,
3298c2ecf20Sopenharmony_ci	.rx_fixup = kalmia_rx_fixup,
3308c2ecf20Sopenharmony_ci	.tx_fixup = kalmia_tx_fixup
3318c2ecf20Sopenharmony_ci};
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci/*-------------------------------------------------------------------------*/
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_cistatic const struct usb_device_id products[] = {
3368c2ecf20Sopenharmony_ci	/* The unswitched USB ID, to get the module auto loaded: */
3378c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x04e8, 0x689a) },
3388c2ecf20Sopenharmony_ci	/* The stick switched into modem (by e.g. usb_modeswitch): */
3398c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x04e8, 0x6889),
3408c2ecf20Sopenharmony_ci		.driver_info = (unsigned long) &kalmia_info, },
3418c2ecf20Sopenharmony_ci	{ /* EMPTY == end of list */} };
3428c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE( usb, products);
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_cistatic struct usb_driver kalmia_driver = {
3458c2ecf20Sopenharmony_ci	.name = "kalmia",
3468c2ecf20Sopenharmony_ci	.id_table = products,
3478c2ecf20Sopenharmony_ci	.probe = usbnet_probe,
3488c2ecf20Sopenharmony_ci	.disconnect = usbnet_disconnect,
3498c2ecf20Sopenharmony_ci	.suspend = usbnet_suspend,
3508c2ecf20Sopenharmony_ci	.resume = usbnet_resume,
3518c2ecf20Sopenharmony_ci	.disable_hub_initiated_lpm = 1,
3528c2ecf20Sopenharmony_ci};
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_cimodule_usb_driver(kalmia_driver);
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ciMODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>");
3578c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Samsung Kalmia USB network driver");
3588c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL");
359