Lines Matching +full:modem +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * USB network interface driver for Samsung Kalmia based LTE USB modem like the
4 * Samsung GT-B3730 and GT-B3710.
27 * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control
31 * The stick must first be switched into modem mode by usb_modeswitch
32 * or similar tool. Then the modem gets sent two initialization packets by
34 * connect the modem using AT commands through the ACM port and then use
36 * sent to and from the modem in a proprietary format discovered after watching
37 * the behavior of the windows driver for the modem.
39 * More information about the use of the modem is available in usb_modeswitch
43 * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver
53 /*-------------------------------------------------------------------------*/
62 netdev_dbg(dev->net, "Sending init packet"); in kalmia_send_init_packet()
64 status = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 0x02), in kalmia_send_init_packet()
67 netdev_err(dev->net, in kalmia_send_init_packet()
68 "Error sending init packet. Status %i, length %i\n", in kalmia_send_init_packet()
73 netdev_err(dev->net, in kalmia_send_init_packet()
74 "Did not send all of init packet. Bytes sent: %i", in kalmia_send_init_packet()
78 netdev_dbg(dev->net, "Successfully sent init packet."); in kalmia_send_init_packet()
81 status = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, 0x81), in kalmia_send_init_packet()
85 netdev_err(dev->net, in kalmia_send_init_packet()
86 "Error receiving init result. Status %i, length %i\n", in kalmia_send_init_packet()
89 netdev_err(dev->net, "Unexpected init result length: %i\n", in kalmia_send_init_packet()
110 return -ENOMEM; in kalmia_init_and_get_ethernet_addr()
137 if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) in kalmia_bind()
138 return -EINVAL; in kalmia_bind()
140 dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK); in kalmia_bind()
141 dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK); in kalmia_bind()
142 dev->status = NULL; in kalmia_bind()
144 dev->net->hard_header_len += KALMIA_HEADER_LENGTH; in kalmia_bind()
145 dev->hard_mtu = 1400; in kalmia_bind()
146 dev->rx_urb_size = dev->hard_mtu * 10; // Found as optimal after testing in kalmia_bind()
152 memcpy(dev->net->dev_addr, ethernet_addr, ETH_ALEN); in kalmia_bind()
176 skb->data = memmove(skb->head + KALMIA_HEADER_LENGTH, in kalmia_tx_fixup()
177 skb->data, skb->len); in kalmia_tx_fixup()
178 skb_set_tail_pointer(skb, skb->len); in kalmia_tx_fixup()
196 netdev_dbg(dev->net, "Sending etherType: %02x%02x", ether_type_1, in kalmia_tx_fixup()
202 content_len = skb->len - KALMIA_HEADER_LENGTH; in kalmia_tx_fixup()
209 remainder = skb->len % KALMIA_ALIGN_SIZE; in kalmia_tx_fixup()
211 padlen = KALMIA_ALIGN_SIZE - remainder; in kalmia_tx_fixup()
215 netdev_dbg(dev->net, in kalmia_tx_fixup()
238 if (skb->len < KALMIA_HEADER_LENGTH) in kalmia_rx_fixup()
247 header_start = skb->data; in kalmia_rx_fixup()
254 netdev_dbg(dev->net, in kalmia_rx_fixup()
257 skb->len - KALMIA_HEADER_LENGTH); in kalmia_rx_fixup()
260 netdev_err(dev->net, in kalmia_rx_fixup()
263 skb->len - KALMIA_HEADER_LENGTH); in kalmia_rx_fixup()
268 netdev_dbg(dev->net, in kalmia_rx_fixup()
270 header_start, skb->len - KALMIA_HEADER_LENGTH); in kalmia_rx_fixup()
273 usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH); in kalmia_rx_fixup()
284 netdev_dbg(dev->net, "Correct package length #%i", i in kalmia_rx_fixup()
287 is_last = (memcmp(skb->data + ether_packet_length, in kalmia_rx_fixup()
291 header_start = skb->data + ether_packet_length; in kalmia_rx_fixup()
292 netdev_dbg(dev->net, in kalmia_rx_fixup()
295 skb->len - KALMIA_HEADER_LENGTH); in kalmia_rx_fixup()
320 while (skb->len); in kalmia_rx_fixup()
333 /*-------------------------------------------------------------------------*/
338 /* The stick switched into modem (by e.g. usb_modeswitch): */