^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Simple "CDC Subset" USB Networking Links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2000-2005 by David Brownell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/kmod.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/etherdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/ethtool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/mii.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/usb/usbnet.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * This supports simple USB network links that don't require any special
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * framing or hardware control operations. The protocol used here is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * strict subset of CDC Ethernet, with three basic differences reflecting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * the goal that almost any hardware should run it:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * - Minimal runtime control: one interface, no altsettings, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * no vendor or class specific control requests. If a device is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * configured, it is allowed to exchange packets with the host.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Fancier models would mean not working on some hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * - Minimal manufacturing control: no IEEE "Organizationally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * Unique ID" required, or an EEPROMs to store one. Each host uses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * one random "locally assigned" Ethernet address instead, which can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * of course be overridden using standard tools like "ifconfig".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * (With 2^46 such addresses, same-net collisions are quite rare.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * - There is no additional framing data for USB. Packets are written
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * exactly as in CDC Ethernet, starting with an Ethernet header and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * terminated by a short packet. However, the host will never send a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * zero length packet; some systems can't handle those robustly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * Anything that can transmit and receive USB bulk packets can implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * this protocol. That includes both smart peripherals and quite a lot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * of "host-to-host" USB cables (which embed two devices back-to-back).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * Note that although Linux may use many of those host-to-host links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * with this "cdc_subset" framing, that doesn't mean there may not be a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * better approach. Handling the "other end unplugs/replugs" scenario
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * well tends to require chip-specific vendor requests. Also, Windows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * peers at the other end of host-to-host cables may expect their own
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * framing to be used rather than this "cdc_subset" model.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #if defined(CONFIG_USB_EPSON2888) || defined(CONFIG_USB_ARMLINUX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* PDA style devices are always connected if present */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static int always_connected (struct usbnet *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #ifdef CONFIG_USB_ALI_M5632
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * ALi M5632 driver ... does high speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * NOTE that the MS-Windows drivers for this chip use some funky and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * (naturally) undocumented 7-byte prefix to each packet, so this is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * case where we don't currently interoperate. Also, once you unplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * one end of the cable, you need to replug the other end too ... since
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * chip docs are unavailable, there's no way to reset the relevant state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * short of a power cycle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static void m5632_recover(struct usbnet *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct usb_device *udev = dev->udev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct usb_interface *intf = dev->intf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) int r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) r = usb_lock_device_for_reset(udev, intf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (r < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) usb_reset_device(udev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) usb_unlock_device(udev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static const struct driver_info ali_m5632_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) .description = "ALi M5632",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) .recover = m5632_recover,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #ifdef CONFIG_USB_AN2720
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * AnchorChips 2720 driver ... http://www.cypress.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * This doesn't seem to have a way to detect whether the peer is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * connected, or need any reset handshaking. It's got pretty big
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * internal buffers (handles most of a frame's worth of data).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * Chip data sheets don't describe any vendor control messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) static const struct driver_info an2720_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .description = "AnchorChips/Cypress 2720",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) // no reset available!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) // no check_connect available!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) .in = 2, .out = 2, // direction distinguishes these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #endif /* CONFIG_USB_AN2720 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #ifdef CONFIG_USB_BELKIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * Belkin F5U104 ... two NetChip 2280 devices + Atmel AVR microcontroller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * ... also two eTEK designs, including one sold as "Advance USBNET"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static const struct driver_info belkin_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) .description = "Belkin, eTEK, or compatible",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #endif /* CONFIG_USB_BELKIN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #ifdef CONFIG_USB_EPSON2888
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * EPSON USB clients
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * This is the same idea as Linux PDAs (below) except the firmware in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * device might not be Tux-powered. Epson provides reference firmware that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * implements this interface. Product developers can reuse or modify that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * code, such as by using their own product and vendor codes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * Support was from Juro Bystricky <bystricky.juro@erd.epson.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static const struct driver_info epson2888_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .description = "Epson USB Device",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) .check_connect = always_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .in = 4, .out = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #endif /* CONFIG_USB_EPSON2888 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * info from Jonathan McDowell <noodles@earth.li>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #ifdef CONFIG_USB_KC2190
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static const struct driver_info kc2190_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .description = "KC Technology KC-190",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) #endif /* CONFIG_USB_KC2190 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #ifdef CONFIG_USB_ARMLINUX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #define HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /*-------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * Intel's SA-1100 chip integrates basic USB support, and is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * in PDAs like some iPaqs, the Yopy, some Zaurus models, and more.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * When they run Linux, arch/arm/mach-sa1100/usb-eth.c may be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * network using minimal USB framing data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * This describes the driver currently in standard ARM Linux kernels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * The Zaurus uses a different driver (see later).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * PXA25x and PXA210 use XScale cores (ARM v5TE) with better USB support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * and different USB endpoint numbering than the SA1100 devices. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * mach-pxa/usb-eth.c driver re-uses the device ids from mach-sa1100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * so we rely on the endpoint descriptors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) *-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static const struct driver_info linuxdev_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .description = "Linux Device",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .check_connect = always_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static const struct driver_info yopy_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .description = "Yopy",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) .check_connect = always_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static const struct driver_info blob_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) .description = "Boot Loader OBject",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) .check_connect = always_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) .flags = FLAG_POINTTOPOINT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #endif /* CONFIG_USB_ARMLINUX */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) #ifndef HAVE_HARDWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #warning You need to configure some hardware for this driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * chip vendor names won't normally be on the cables, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * may not be on the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static const struct usb_device_id products [] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #ifdef CONFIG_USB_ALI_M5632
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) USB_DEVICE (0x0402, 0x5632), // ALi defaults
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .driver_info = (unsigned long) &ali_m5632_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) USB_DEVICE (0x182d,0x207c), // SiteCom CN-124
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) .driver_info = (unsigned long) &ali_m5632_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #ifdef CONFIG_USB_AN2720
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) USB_DEVICE (0x0547, 0x2720), // AnchorChips defaults
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .driver_info = (unsigned long) &an2720_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) USB_DEVICE (0x0547, 0x2727), // Xircom PGUNET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .driver_info = (unsigned long) &an2720_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #ifdef CONFIG_USB_BELKIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) USB_DEVICE (0x050d, 0x0004), // Belkin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) .driver_info = (unsigned long) &belkin_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) USB_DEVICE (0x056c, 0x8100), // eTEK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) .driver_info = (unsigned long) &belkin_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) USB_DEVICE (0x0525, 0x9901), // Advance USBNET (eTEK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .driver_info = (unsigned long) &belkin_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #ifdef CONFIG_USB_EPSON2888
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) USB_DEVICE (0x0525, 0x2888), // EPSON USB client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) .driver_info = (unsigned long) &epson2888_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #ifdef CONFIG_USB_KC2190
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) USB_DEVICE (0x050f, 0x0190), // KC-190
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) .driver_info = (unsigned long) &kc2190_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #ifdef CONFIG_USB_ARMLINUX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) * SA-1100 using standard ARM Linux kernels, or compatible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * Often used when talking to Linux PDAs (iPaq, Yopy, etc).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) * The sa-1100 "usb-eth" driver handles the basic framing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * PXA25x or PXA210 ... these use a "usb-eth" driver much like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * the sa1100 one, but hardware uses different endpoint numbers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) * Or the Linux "Ethernet" gadget on hardware that can't talk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) * CDC Ethernet (e.g., no altsettings), in either of two modes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) * - acting just like the old "usb-eth" firmware, though
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * the implementation is different
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * - supporting RNDIS as the first/default configuration for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * MS-Windows interop; Linux needs to use the other config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) // 1183 = 0x049F, both used as hex values?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) // Compaq "Itsy" vendor/product id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) USB_DEVICE (0x049F, 0x505A), // usb-eth, or compatible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) .driver_info = (unsigned long) &linuxdev_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) USB_DEVICE (0x0E7E, 0x1001), // G.Mate "Yopy"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) .driver_info = (unsigned long) &yopy_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) .driver_info = (unsigned long) &blob_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) USB_DEVICE (0x1286, 0x8001), // "blob" bootloader
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) .driver_info = (unsigned long) &blob_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) // Linux Ethernet/RNDIS gadget, mostly on PXA, second config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) // e.g. Gumstix, current OpenZaurus, ... or anything else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) // that just enables this gadget option.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) USB_DEVICE (0x0525, 0xa4a2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) .driver_info = (unsigned long) &linuxdev_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) { }, // END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) MODULE_DEVICE_TABLE(usb, products);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) static int dummy_prereset(struct usb_interface *intf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) static int dummy_postreset(struct usb_interface *intf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) static struct usb_driver cdc_subset_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) .name = "cdc_subset",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) .probe = usbnet_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) .suspend = usbnet_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) .resume = usbnet_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) .pre_reset = dummy_prereset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) .post_reset = dummy_postreset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) .disconnect = usbnet_disconnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) .id_table = products,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) .disable_hub_initiated_lpm = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) module_usb_driver(cdc_subset_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) MODULE_AUTHOR("David Brownell");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) MODULE_LICENSE("GPL");