aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-05-09 21:31:55 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-09 21:31:55 -0400
commit5b2fc499917e5897a13add780e181b4cef197072 (patch)
tree1a1ba52c0c2a7ce9843875cdd713d75d37c4ea1b /drivers/usb
parent3cb7396b7b26585b1ab7c1a8ca554ec103da5d37 (diff)
Move USB network drivers to drivers/net/usb.
It is preferable to group drivers by usage (net, scsi, ATA, ...) than by bus. When reviewing drivers, the [PCI|USB|PCMCIA|...] maintainer is probably less qualified on networking issues than a networking maintainer. Also, from a practical standpoint, chips often appear on multiple buses, which is why we do not put drivers into drivers/pci/net. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/Makefile7
-rw-r--r--drivers/usb/net/Kconfig338
-rw-r--r--drivers/usb/net/Makefile23
-rw-r--r--drivers/usb/net/asix.c1490
-rw-r--r--drivers/usb/net/catc.c963
-rw-r--r--drivers/usb/net/cdc_ether.c570
-rw-r--r--drivers/usb/net/cdc_subset.c344
-rw-r--r--drivers/usb/net/dm9601.c619
-rw-r--r--drivers/usb/net/gl620a.c245
-rw-r--r--drivers/usb/net/kaweth.c1337
-rw-r--r--drivers/usb/net/kawethfw.h557
-rw-r--r--drivers/usb/net/mcs7830.c534
-rw-r--r--drivers/usb/net/net1080.c615
-rw-r--r--drivers/usb/net/pegasus.c1504
-rw-r--r--drivers/usb/net/pegasus.h307
-rw-r--r--drivers/usb/net/plusb.c150
-rw-r--r--drivers/usb/net/rndis_host.c727
-rw-r--r--drivers/usb/net/rtl8150.c1004
-rw-r--r--drivers/usb/net/usbnet.c1304
-rw-r--r--drivers/usb/net/usbnet.h200
-rw-r--r--drivers/usb/net/zaurus.c385
22 files changed, 0 insertions, 13225 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index b847bbc8b0e..278a22cea5b 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -87,8 +87,6 @@ source "drivers/usb/storage/Kconfig"
source "drivers/usb/image/Kconfig"
-source "drivers/usb/net/Kconfig"
-
source "drivers/usb/mon/Kconfig"
comment "USB port drivers"
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 0ef090b1b37..72464b58699 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -23,13 +23,6 @@ obj-$(CONFIG_USB_PRINTER) += class/
obj-$(CONFIG_USB_STORAGE) += storage/
obj-$(CONFIG_USB) += storage/
-obj-$(CONFIG_USB_CATC) += net/
-obj-$(CONFIG_USB_KAWETH) += net/
-obj-$(CONFIG_USB_PEGASUS) += net/
-obj-$(CONFIG_USB_RTL8150) += net/
-obj-$(CONFIG_USB_USBNET) += net/
-obj-$(CONFIG_USB_ZD1201) += net/
-
obj-$(CONFIG_USB_MDC800) += image/
obj-$(CONFIG_USB_MICROTEK) += image/
diff --git a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
deleted file mode 100644
index 3de564b2314..00000000000
--- a/drivers/usb/net/Kconfig
+++ /dev/null
@@ -1,338 +0,0 @@
-#
-# USB Network devices configuration
-#
-comment "Networking support is needed for USB Network Adapter support"
- depends on USB && !NET
-
-menu "USB Network Adapters"
- depends on USB && NET
-
-config USB_CATC
- tristate "USB CATC NetMate-based Ethernet device support (EXPERIMENTAL)"
- depends on EXPERIMENTAL
- select CRC32
- ---help---
- Say Y if you want to use one of the following 10Mbps USB Ethernet
- device based on the EL1210A chip. Supported devices are:
- Belkin F5U011
- Belkin F5U111
- CATC NetMate
- CATC NetMate II
- smartBridges smartNIC
-
- This driver makes the adapter appear as a normal Ethernet interface,
- typically on eth0, if it is the only ethernet device, or perhaps on
- eth1, if you have a PCI or ISA ethernet card installed.
-
- To compile this driver as a module, choose M here: the
- module will be called catc.
-
-config USB_KAWETH
- tristate "USB KLSI KL5USB101-based ethernet device support"
- ---help---
- Say Y here if you want to use one of the following 10Mbps only
- USB Ethernet adapters based on the KLSI KL5KUSB101B chipset:
- 3Com 3C19250
- ADS USB-10BT
- ATEN USB Ethernet
- ASANTE USB To Ethernet Adapter
- AOX Endpoints USB Ethernet
- Correga K.K.
- D-Link DSB-650C and DU-E10
- Entrega / Portgear E45
- I-O DATA USB-ET/T
- Jaton USB Ethernet Device Adapter
- Kingston Technology USB Ethernet Adapter
- Linksys USB10T
- Mobility USB-Ethernet Adapter
- NetGear EA-101
- Peracom Enet and Enet2
- Portsmith Express Ethernet Adapter
- Shark Pocket Adapter
- SMC 2202USB
- Sony Vaio port extender
-
- This driver is likely to work with most 10Mbps only USB Ethernet
- adapters, including some "no brand" devices. It does NOT work on
- SmartBridges smartNIC or on Belkin F5U111 devices - you should use
- the CATC NetMate driver for those. If you are not sure which one
- you need, select both, and the correct one should be selected for
- you.
-
- This driver makes the adapter appear as a normal Ethernet interface,
- typically on eth0, if it is the only ethernet device, or perhaps on
- eth1, if you have a PCI or ISA ethernet card installed.
-
- To compile this driver as a module, choose M here: the
- module will be called kaweth.
-
-config USB_PEGASUS
- tristate "USB Pegasus/Pegasus-II based ethernet device support"
- select MII
- ---help---
- Say Y here if you know you have Pegasus or Pegasus-II based adapter.
- If in doubt then look at <file:drivers/usb/net/pegasus.h> for the
- complete list of supported devices.
-
- If your particular adapter is not in the list and you are _sure_ it
- is Pegasus or Pegasus II based then send me
- <petkan@users.sourceforge.net> vendor and device IDs.
-
- To compile this driver as a module, choose M here: the
- module will be called pegasus.
-
-config USB_RTL8150
- tristate "USB RTL8150 based ethernet device support (EXPERIMENTAL)"
- depends on EXPERIMENTAL
- select MII
- help
- Say Y here if you have RTL8150 based usb-ethernet adapter.
- Send me <petkan@users.sourceforge.net> any comments you may have.
- You can also check for updates at <http://pegasus2.sourceforge.net/>.
-
- To compile this driver as a module, choose M here: the
- module will be called rtl8150.
-
-config USB_USBNET_MII
- tristate
- default n
-
-config USB_USBNET
- tristate "Multi-purpose USB Networking Framework"
- select MII if USB_USBNET_MII != n
- ---help---
- This driver supports several kinds of network links over USB,
- with "minidrivers" built around a common network driver core
- that supports deep queues for efficient transfers. (This gives
- better performance with small packets and at high speeds).
-
- The USB host runs "usbnet", and the other end of the link might be:
-
- - Another USB host, when using USB "network" or "data transfer"
- cables. These are often used to network laptops to PCs, like
- "Laplink" parallel cables or some motherboards. These rely
- on specialized chips from many suppliers.
-
- - An intelligent USB gadget, perhaps embedding a Linux system.
- These include PDAs running Linux (iPaq, Yopy, Zaurus, and
- others), and devices that interoperate using the standard
- CDC-Ethernet specification (including many cable modems).
-
- - Network adapter hardware (like those for 10/100 Ethernet) which
- uses this driver framework.
-
- The link will appear with a name like "usb0", when the link is
- a two-node link, or "eth0" for most CDC-Ethernet devices. Those
- two-node links are most easily managed with Ethernet Bridging
- (CONFIG_BRIDGE) instead of routing.
-
- For more information see <http://www.linux-usb.org/usbnet/>.
-
- To compile this driver as a module, choose M here: the
- module will be called usbnet.
-
-config USB_NET_AX8817X
- tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
- depends on USB_USBNET && NET_ETHERNET
- select CRC32
- select USB_USBNET_MII
- default y
- help
- This option adds support for ASIX AX88xxx based USB 2.0
- 10/100 Ethernet adapters.
-
- This driver should work with at least the following devices:
- * Aten UC210T
- * ASIX AX88172
- * Billionton Systems, USB2AR
- * Buffalo LUA-U2-KTX
- * Corega FEther USB2-TX
- * D-Link DUB-E100
- * Hawking UF200
- * Linksys USB200M
- * Netgear FA120
- * Sitecom LN-029
- * Intellinet USB 2.0 Ethernet
- * ST Lab USB 2.0 Ethernet
- * TrendNet TU2-ET100
-
- This driver creates an interface named "ethX", where X depends on
- what other networking devices you have in use.
-
-
-config USB_NET_CDCETHER
- tristate "CDC Ethernet support (smart devices such as cable modems)"
- depends on USB_USBNET
- default y
- help
- This option supports devices conforming to the Communication Device
- Class (CDC) Ethernet Control Model, a specification that's easy to
- implement in device firmware. The CDC specifications are available
- from <http://www.usb.org/>.
-
- CDC Ethernet is an implementation option for DOCSIS cable modems
- that support USB connectivity, used for non-Microsoft USB hosts.
- The Linux-USB CDC Ethernet Gadget driver is an open implementation.
- This driver should work with at least the following devices:
-
- * Ericsson PipeRider (all variants)
- * Motorola (DM100 and SB4100)
- * Broadcom Cable Modem (reference design)
- * Toshiba PCX1100U
- * ...
-
- This driver creates an interface named "ethX", where X depends on
- what other networking devices you have in use. However, if the
- IEEE 802 "local assignment" bit is set in the address, a "usbX"
- name is used instead.
-
-config USB_NET_DM9601
- tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
- depends on USB_USBNET
- select CRC32
- select USB_USBNET_MII
- help
- This option adds support for Davicom DM9601 based USB 1.1
- 10/100 Ethernet adapters.
-
-config USB_NET_GL620A
- tristate "GeneSys GL620USB-A based cables"
- depends on USB_USBNET
- help
- Choose this option if you're using a host-to-host cable,
- or PC2PC motherboard, with this chip.
-
- Note that the half-duplex "GL620USB" is not supported.
-
-config USB_NET_NET1080
- tristate "NetChip 1080 based cables (Laplink, ...)"
- default y
- depends on USB_USBNET
- help
- Choose this option if you're using a host-to-host cable based
- on this design: one NetChip 1080 chip and supporting logic,
- optionally with LEDs that indicate traffic
-
-config USB_NET_PLUSB
- tristate "Prolific PL-2301/2302 based cables"
- # if the handshake/init/reset problems, from original 'plusb',
- # are ever resolved ... then remove "experimental"
- depends on USB_USBNET && EXPERIMENTAL
- help
- Choose this option if you're using a host-to-host cable
- with one of these chips.
-
-config USB_NET_MCS7830
- tristate "MosChip MCS7830 based Ethernet adapters"
- depends on USB_USBNET
- select USB_USBNET_MII
- help
- Choose this option if you're using a 10/100 Ethernet USB2
- adapter based on the MosChip 7830 controller. This includes
- adapters marketed under the DeLOCK brand.
-
-config USB_NET_RNDIS_HOST
- tristate "Host for RNDIS and ActiveSync devices (EXPERIMENTAL)"
- depends on USB_USBNET && EXPERIMENTAL
- select USB_NET_CDCETHER
- help
- This option enables hosting "Remote NDIS" USB networking links,
- as encouraged by Microsoft (instead of CDC Ethernet!) for use in
- various devices that may only support this protocol. A variant
- of this protocol (with even less public documentation) seems to
- be at the root of Microsoft's "ActiveSync" too.
-
- Avoid using this protocol unless you have no better options.
- The protocol specification is incomplete, and is controlled by
- (and for) Microsoft; it isn't an "Open" ecosystem or market.
-
-config USB_NET_CDC_SUBSET
- tristate "Simple USB Network Links (CDC Ethernet subset)"
- depends on USB_USBNET
- default y
- help
- This driver module supports USB network devices that can work
- without any device-specific information. Select it if you have
- one of these drivers.
-
- Note that while many USB host-to-host cables can work in this mode,
- that may mean not being able to talk to Win32 systems or more
- commonly not being able to handle certain events (like replugging
- the host on the other end) very well. Also, these devices will
- not generally have permanently assigned Ethernet addresses.
-
-config USB_ALI_M5632
- boolean "ALi M5632 based 'USB 2.0 Data Link' cables"
- depends on USB_NET_CDC_SUBSET
- help
- Choose this option if you're using a host-to-host cable
- based on this design, which supports USB 2.0 high speed.
-
-config USB_AN2720
- boolean "AnchorChips 2720 based cables (Xircom PGUNET, ...)"
- depends on USB_NET_CDC_SUBSET
- help
- Choose this option if you're using a host-to-host cable
- based on this design. Note that AnchorChips is now a
- Cypress brand.
-
-config USB_BELKIN
- boolean "eTEK based host-to-host cables (Advance, Belkin, ...)"
- depends on USB_NET_CDC_SUBSET
- default y
- help
- Choose this option if you're using a host-to-host cable
- based on this design: two NetChip 2890 chips and an Atmel
- microcontroller, with LEDs that indicate traffic.
-
-config USB_ARMLINUX
- boolean "Embedded ARM Linux links (iPaq, ...)"
- depends on USB_NET_CDC_SUBSET
- default y
- help
- Choose this option to support the "usb-eth" networking driver
- used by most of the ARM Linux community with device controllers
- such as the SA-11x0 and PXA-25x UDCs, or the tftp capabilities
- in some PXA versions of the "blob" boot loader.
-
- Linux-based "Gumstix" PXA-25x based systems use this protocol
- to talk with other Linux systems.
-
- Although the ROMs shipped with Sharp Zaurus products use a
- different link level framing protocol, you can have them use
- this simpler protocol by installing a different kernel.
-
-config USB_EPSON2888
- boolean "Epson 2888 based firmware (DEVELOPMENT)"
- depends on USB_NET_CDC_SUBSET
- help
- Choose this option to support the usb networking links used
- by some sample firmware from Epson.
-
-config USB_KC2190
- boolean "KT Technology KC2190 based cables (InstaNet)"
- depends on USB_NET_CDC_SUBSET && EXPERIMENTAL
- help
-  Choose this option if you're using a host-to-host cable
-  with one of these chips.
-
-config USB_NET_ZAURUS
- tristate "Sharp Zaurus (stock ROMs) and compatible"
- depends on USB_USBNET
- select USB_NET_CDCETHER
- select CRC32
- default y
- help
- Choose this option to support the usb networking links used by
- Zaurus models like the SL-5000D, SL-5500, SL-5600, A-300, B-500.
- This also supports some related device firmware, as used in some
- PDAs from Olympus and some cell phones from Motorola.
-
- If you install an alternate image, such as the Linux 2.6 based
- versions of OpenZaurus, you should no longer need to support this
- protocol. Only the "eth-fd" or "net_fd" drivers in these devices
- really need this non-conformant variant of CDC Ethernet (or in
- some cases CDC MDLM) protocol, not "g_ether".
-
-
-endmenu
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
deleted file mode 100644
index 595a539f838..00000000000
--- a/drivers/usb/net/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Makefile for USB Network drivers
-#
-
-obj-$(CONFIG_USB_CATC) += catc.o
-obj-$(CONFIG_USB_KAWETH) += kaweth.o
-obj-$(CONFIG_USB_PEGASUS) += pegasus.o
-obj-$(CONFIG_USB_RTL8150) += rtl8150.o
-obj-$(CONFIG_USB_NET_AX8817X) += asix.o
-obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
-obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
-obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
-obj-$(CONFIG_USB_NET_NET1080) += net1080.o
-obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
-obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
-obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
-obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
-obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
-obj-$(CONFIG_USB_USBNET) += usbnet.o
-
-ifeq ($(CONFIG_USB_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
deleted file mode 100644
index d5ef97bc4d0..00000000000
--- a/drivers/usb/net/asix.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- * ASIX AX8817X based USB 2.0 Ethernet Devices
- * Copyright (C) 2003-2006 David Hollis <dhollis@davehollis.com>
- * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
- * Copyright (C) 2006 James Painter <jamie.painter@iname.com>
- * Copyright (c) 2002-2003 TiVo Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-// #define DEBUG // error path messages, extra info
-// #define VERBOSE // more; success messages
-
-#include <linux/module.h>
-#include <linux/kmod.h>
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ethtool.h>
-#include <linux/workqueue.h>
-#include <linux/mii.h>
-#include <linux/usb.h>
-#include <linux/crc32.h>
-
-#include "usbnet.h"
-
-#define DRIVER_VERSION "14-Jun-2006"
-static const char driver_name [] = "asix";
-
-/* ASIX AX8817X based USB 2.0 Ethernet Devices */
-
-#define AX_CMD_SET_SW_MII 0x06
-#define AX_CMD_READ_MII_REG 0x07
-#define AX_CMD_WRITE_MII_REG 0x08
-#define AX_CMD_SET_HW_MII 0x0a
-#define AX_CMD_READ_EEPROM 0x0b
-#define AX_CMD_WRITE_EEPROM 0x0c
-#define AX_CMD_WRITE_ENABLE 0x0d
-#define AX_CMD_WRITE_DISABLE 0x0e
-#define AX_CMD_READ_RX_CTL 0x0f
-#define AX_CMD_WRITE_RX_CTL 0x10
-#define AX_CMD_READ_IPG012 0x11
-#define AX_CMD_WRITE_IPG0 0x12
-#define AX_CMD_WRITE_IPG1 0x13
-#define AX_CMD_READ_NODE_ID 0x13
-#define AX_CMD_WRITE_IPG2 0x14
-#define AX_CMD_WRITE_MULTI_FILTER 0x16
-#define AX88172_CMD_READ_NODE_ID 0x17
-#define AX_CMD_READ_PHY_ID 0x19
-#define AX_CMD_READ_MEDIUM_STATUS 0x1a
-#define AX_CMD_WRITE_MEDIUM_MODE 0x1b
-#define AX_CMD_READ_MONITOR_MODE 0x1c
-#define AX_CMD_WRITE_MONITOR_MODE 0x1d
-#define AX_CMD_READ_GPIOS 0x1e
-#define AX_CMD_WRITE_GPIOS 0x1f
-#define AX_CMD_SW_RESET 0x20
-#define AX_CMD_SW_PHY_STATUS 0x21
-#define AX_CMD_SW_PHY_SELECT 0x22
-
-#define AX_MONITOR_MODE 0x01
-#define AX_MONITOR_LINK 0x02
-#define AX_MONITOR_MAGIC 0x04
-#define AX_MONITOR_HSFS 0x10
-
-/* AX88172 Medium Status Register values */
-#define AX88172_MEDIUM_FD 0x02
-#define AX88172_MEDIUM_TX 0x04
-#define AX88172_MEDIUM_FC 0x10
-#define AX88172_MEDIUM_DEFAULT \
- ( AX88172_MEDIUM_FD | AX88172_MEDIUM_TX | AX88172_MEDIUM_FC )
-
-#define AX_MCAST_FILTER_SIZE 8
-#define AX_MAX_MCAST 64
-
-#define AX_SWRESET_CLEAR 0x00
-#define AX_SWRESET_RR 0x01
-#define AX_SWRESET_RT 0x02
-#define AX_SWRESET_PRTE 0x04
-#define AX_SWRESET_PRL 0x08
-#define AX_SWRESET_BZ 0x10
-#define AX_SWRESET_IPRL 0x20
-#define AX_SWRESET_IPPD 0x40
-
-#define AX88772_IPG0_DEFAULT 0x15
-#define AX88772_IPG1_DEFAULT 0x0c
-#define AX88772_IPG2_DEFAULT 0x12
-
-/* AX88772 & AX88178 Medium Mode Register */
-#define AX_MEDIUM_PF 0x0080
-#define AX_MEDIUM_JFE 0x0040
-#define AX_MEDIUM_TFC 0x0020
-#define AX_MEDIUM_RFC 0x0010
-#define AX_MEDIUM_ENCK 0x0008
-#define AX_MEDIUM_AC 0x0004
-#define AX_MEDIUM_FD 0x0002
-#define AX_MEDIUM_GM 0x0001
-#define AX_MEDIUM_SM 0x1000
-#define AX_MEDIUM_SBP 0x0800
-#define AX_MEDIUM_PS 0x0200
-#define AX_MEDIUM_RE 0x0100
-
-#define AX88178_MEDIUM_DEFAULT \
- (AX_MEDIUM_PS | AX_MEDIUM_FD | AX_MEDIUM_AC | \
- AX_MEDIUM_RFC | AX_MEDIUM_TFC | AX_MEDIUM_JFE | \
- AX_MEDIUM_RE )
-
-#define AX88772_MEDIUM_DEFAULT \
- (AX_MEDIUM_FD | AX_MEDIUM_RFC | \
- AX_MEDIUM_TFC | AX_MEDIUM_PS | \
- AX_MEDIUM_AC | AX_MEDIUM_RE )
-
-/* AX88772 & AX88178 RX_CTL values */
-#define AX_RX_CTL_SO 0x0080
-#define AX_RX_CTL_AP 0x0020
-#define AX_RX_CTL_AM 0x0010
-#define AX_RX_CTL_AB 0x0008
-#define AX_RX_CTL_SEP 0x0004
-#define AX_RX_CTL_AMALL 0x0002
-#define AX_RX_CTL_PRO 0x0001
-#define AX_RX_CTL_MFB_2048 0x0000
-#define AX_RX_CTL_MFB_4096 0x0100
-#define AX_RX_CTL_MFB_8192 0x0200
-#define AX_RX_CTL_MFB_16384 0x0300
-
-#define AX_DEFAULT_RX_CTL \
- (AX_RX_CTL_SO | AX_RX_CTL_AB )
-
-/* GPIO 0 .. 2 toggles */
-#define AX_GPIO_GPO0EN 0x01 /* GPIO0 Output enable */
-#define AX_GPIO_GPO_0 0x02 /* GPIO0 Output value */
-#define AX_GPIO_GPO1EN 0x04 /* GPIO1 Output enable */
-#define AX_GPIO_GPO_1 0x08 /* GPIO1 Output value */
-#define AX_GPIO_GPO2EN 0x10 /* GPIO2 Output enable */
-#define AX_GPIO_GPO_2 0x20 /* GPIO2 Output value */
-#define AX_GPIO_RESERVED 0x40 /* Reserved */
-#define AX_GPIO_RSE 0x80 /* Reload serial EEPROM */
-
-#define AX_EEPROM_MAGIC 0xdeadbeef
-#define AX88172_EEPROM_LEN 0x40
-#define AX88772_EEPROM_LEN 0xff
-
-#define PHY_MODE_MARVELL 0x0000
-#define MII_MARVELL_LED_CTRL 0x0018
-#define MII_MARVELL_STATUS 0x001b
-#define MII_MARVELL_CTRL 0x0014
-
-#define MARVELL_LED_MANUAL 0x0019
-
-#define MARVELL_STATUS_HWCFG 0x0004
-
-#define MARVELL_CTRL_TXDELAY 0x0002
-#define MARVELL_CTRL_RXDELAY 0x0080
-
-/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
-struct asix_data {
- u8 multi_filter[AX_MCAST_FILTER_SIZE];
- u8 phymode;
- u8 ledmode;
- u8 eeprom_len;
-};
-
-struct ax88172_int_data {
- u16 res1;
- u8 link;
- u16 res2;
- u8 status;
- u16 res3;
-} __attribute__ ((packed));
-
-static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
- u16 size, void *data)
-{
- devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
- cmd, value, index, size);
- return usb_control_msg(
- dev->udev,
- usb_rcvctrlpipe(dev->udev, 0),
- cmd,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value,
- index,
- data,
- size,
- USB_CTRL_GET_TIMEOUT);
-}
-
-static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
- u16 size, void *data)
-{
- devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
- cmd, value, index, size);
- return usb_control_msg(
- dev->udev,
- usb_sndctrlpipe(dev->udev, 0),
- cmd,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value,
- index,
- data,
- size,
- USB_CTRL_SET_TIMEOUT);
-}
-
-static void asix_async_cmd_callback(struct urb *urb)
-{
- struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
-
- if (urb->status < 0)
- printk(KERN_DEBUG "asix_async_cmd_callback() failed with %d",
- urb->status);
-
- kfree(req);
- usb_free_urb(urb);
-}
-
-static void
-asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
- u16 size, void *data)
-{
- struct usb_ctrlrequest *req;
- int status;
- struct urb *urb;
-
- devdbg(dev,"asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
- cmd, value, index, size);
- if ((urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) {
- deverr(dev, "Error allocating URB in write_cmd_async!");
- return;
- }
-
- if ((req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC)) == NULL) {
- deverr(dev, "Failed to allocate memory for control request");
- usb_free_urb(urb);
- return;
- }
-
- req->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
- req->bRequest = cmd;
- req->wValue = cpu_to_le16(value);
- req->wIndex = cpu_to_le16(index);
- req->wLength = cpu_to_le16(size);
-
- usb_fill_control_urb(urb, dev->udev,
- usb_sndctrlpipe(dev->udev, 0),
- (void *)req, data, size,
- asix_async_cmd_callback, req);
-
- if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
- deverr(dev, "Error submitting the control message: status=%d",
- status);
- kfree(req);
- usb_free_urb(urb);
- }
-}
-
-static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
-{
- u8 *head;
- u32 header;
- char *packet;
- struct sk_buff *ax_skb;
- u16 size;
-
- head = (u8 *) skb->data;
- memcpy(&header, head, sizeof(header));
- le32_to_cpus(&header);
- packet = head + sizeof(header);
-
- skb_pull(skb, 4);
-
- while (skb->len > 0) {
- if ((short)(header & 0x0000ffff) !=
- ~((short)((header & 0xffff0000) >> 16))) {
- deverr(dev,"asix_rx_fixup() Bad Header Length");
- }
- /* get the packet length */
- size = (u16) (header & 0x0000ffff);
-
- if ((skb->len) - ((size + 1) & 0xfffe) == 0)
- return 2;
- if (size > ETH_FRAME_LEN) {
- deverr(dev,"asix_rx_fixup() Bad RX Length %d", size);
- return 0;
- }
- ax_skb = skb_clone(skb, GFP_ATOMIC);
- if (ax_skb) {
- ax_skb->len = size;
- ax_skb->data = packet;
- skb_set_tail_pointer(ax_skb, size);
- usbnet_skb_return(dev, ax_skb);
- } else {
- return 0;
- }
-
- skb_pull(skb, (size + 1) & 0xfffe);
-
- if (skb->len == 0)
- break;
-
- head = (u8 *) skb->data;
- memcpy(&header, head, sizeof(header));
- le32_to_cpus(&header);
- packet = head + sizeof(header);
- skb_pull(skb, 4);
- }
-
- if (skb->len < 0) {
- deverr(dev,"asix_rx_fixup() Bad SKB Length %d", skb->len);
- return 0;
- }
- return 1;
-}
-
-static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
- gfp_t flags)
-{
- int padlen;
- int headroom = skb_headroom(skb);
- int tailroom = skb_tailroom(skb);
- u32 packet_len;
- u32 padbytes = 0xffff0000;
-
- padlen = ((skb->len + 4) % 512) ? 0 : 4;
-
- if ((!skb_cloned(skb))
- && ((headroom + tailroom) >= (4 + padlen))) {
- if ((headroom < 4) || (tailroom < padlen)) {
- skb->data = memmove(skb->head + 4, skb->data, skb->len);
- skb_set_tail_pointer(skb, skb->len);
- }
- } else {
- struct sk_buff *skb2;
- skb2 = skb_copy_expand(skb, 4, padlen, flags);
- dev_kfree_skb_any(skb);
- skb = skb2;
- if (!skb)
- return NULL;
- }
-
- skb_push(skb, 4);
- packet_len = (((skb->len - 4) ^ 0x0000ffff) << 16) + (skb->len - 4);
- cpu_to_le32s(&packet_len);
- skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
-
- if ((skb->len % 512) == 0) {
- cpu_to_le32s(&padbytes);
- memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
- skb_put(skb, sizeof(padbytes));
- }
- return skb;
-}
-
-static void asix_status(struct usbnet *dev, struct urb *urb)
-{
- struct ax88172_int_data *event;
- int link;
-
- if (urb->actual_length < 8)
- return;
-
- event = urb->transfer_buffer;
- link = event->link & 0x01;
- if (netif_carrier_ok(dev->net) != link) {
- if (link) {
- netif_carrier_on(dev->net);
- usbnet_defer_kevent (dev, EVENT_LINK_RESET );
- } else
- netif_carrier_off(dev->net);
- devdbg(dev, "Link Status is: %d", link);
- }
-}
-
-static inline int asix_set_sw_mii(struct usbnet *dev)
-{
- int ret;
- ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL);
- if (ret < 0)
- deverr(dev, "Failed to enable software MII access");
- return ret;
-}
-
-static inline int asix_set_hw_mii(struct usbnet *dev)
-{
- int ret;
- ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL);
- if (ret < 0)
- deverr(dev, "Failed to enable hardware MII access");
- return ret;
-}
-
-static inline int asix_get_phy_addr(struct usbnet *dev)
-{
- int ret = 0;
- void *buf;
-
- devdbg(dev, "asix_get_phy_addr()");
-
- buf = kmalloc(2, GFP_KERNEL);
- if (!buf)
- goto out1;
-
- if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
- 0, 0, 2, buf)) < 2) {
- deverr(dev, "Error reading PHYID register: %02x", ret);
- goto out2;
- }
- devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf));
- ret = *((u8 *)buf + 1);
-out2:
- kfree(buf);
-out1:
- return ret;
-}
-
-static int asix_sw_reset(struct usbnet *dev, u8 flags)
-{
- int ret;
-
- ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL);
- if (ret < 0)
- deverr(dev,"Failed to send software reset: %02x", ret);
-
- return ret;
-}
-
-static u16 asix_read_rx_ctl(struct usbnet *dev)
-{
- u16 ret = 0;
- void *buf;
-
- buf = kmalloc(2, GFP_KERNEL);
- if (!buf)
- goto out1;
-
- if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL,
- 0, 0, 2, buf)) < 2) {
- deverr(dev, "Error reading RX_CTL register: %02x", ret);
- goto out2;
- }
- ret = le16_to_cpu(*((u16 *)buf));
-out2:
- kfree(buf);
-out1:
- return ret;
-}
-
-static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
-{
- int ret;
-
- devdbg(dev,"asix_write_rx_ctl() - mode = 0x%04x", mode);
- ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL);
- if (ret < 0)
- deverr(dev, "Failed to write RX_CTL mode to 0x%04x: %02x",
- mode, ret);
-
- return ret;
-}
-
-static u16 asix_read_medium_status(struct usbnet *dev)
-{
- u16 ret = 0;
- void *buf;
-
- buf = kmalloc(2, GFP_KERNEL);
- if (!buf)
- goto out1;
-
- if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS,
- 0, 0, 2, buf)) < 2) {
- deverr(dev, "Error reading Medium Status register: %02x", ret);
- goto out2;
- }
- ret = le16_to_cpu(*((u16 *)buf));
-out2:
- kfree(buf);
-out1:
- return ret;
-}
-
-static int asix_write_medium_mode(struct usbnet *dev, u16 mode)
-{
- int ret;
-
- devdbg(dev,"asix_write_medium_mode() - mode = 0x%04x", mode);
- ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL);
- if (ret < 0)
- deverr(dev, "Failed to write Medium Mode mode to 0x%04x: %02x",
- mode, ret);
-
- return ret;
-}
-
-static int asix_write_gpio(struct usbnet *dev, u16 value, int sleep)
-{
- int ret;
-
- devdbg(dev,"asix_write_gpio() - value = 0x%04x", value);
- ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, value, 0, 0, NULL);
- if (ret < 0)
- deverr(dev, "Failed to write GPIO value 0x%04x: %02x",
- value, ret);
-
- if (sleep)
- msleep(sleep);
-
- return ret;
-}
-
-/*
- * AX88772 & AX88178 have a 16-bit RX_CTL value
- */
-static void asix_set_multicast(struct net_device *net)
-{
- struct usbnet *dev = netdev_priv(net);
- struct asix_data *data = (struct asix_data *)&dev->data;
- u16 rx_ctl = AX_DEFAULT_RX_CTL;
-
- if (net->flags & IFF_PROMISC) {
- rx_ctl |= AX_RX_CTL_PRO;
- } else if (net-&g