Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Este cometimento está contido em:
307
drivers/usb/net/Kconfig
Ficheiro normal
307
drivers/usb/net/Kconfig
Ficheiro normal
@@ -0,0 +1,307 @@
|
||||
#
|
||||
# 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
|
||||
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
|
||||
tristate "Multi-purpose USB Networking Framework"
|
||||
---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.
|
||||
|
||||
comment "USB Host-to-Host Cables"
|
||||
depends on USB_USBNET
|
||||
|
||||
config USB_ALI_M5632
|
||||
boolean "ALi M5632 based 'USB 2.0 Data Link' cables"
|
||||
depends on USB_USBNET
|
||||
default y
|
||||
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_USBNET
|
||||
default y
|
||||
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_USBNET
|
||||
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_GENESYS
|
||||
boolean "GeneSys GL620USB-A based cables"
|
||||
default y
|
||||
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_NET1080
|
||||
boolean "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 chips and supporting logic,
|
||||
supporting LEDs that indicate traffic
|
||||
|
||||
config USB_PL2301
|
||||
boolean "Prolific PL-2301/2302 based cables"
|
||||
default y
|
||||
# handshake/init/reset problems, from original 'plusb' driver
|
||||
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_KC2190
|
||||
boolean "KT Technology KC2190 based cables (InstaNet)"
|
||||
default y
|
||||
depends on USB_USBNET && EXPERIMENTAL
|
||||
help
|
||||
Choose this option if you're using a host-to-host cable
|
||||
with one of these chips.
|
||||
|
||||
comment "Intelligent USB Devices/Gadgets"
|
||||
depends on USB_USBNET
|
||||
|
||||
config USB_ARMLINUX
|
||||
boolean "Embedded ARM Linux links (iPaq, ...)"
|
||||
depends on USB_USBNET
|
||||
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_USBNET
|
||||
default y
|
||||
help
|
||||
Choose this option to support the usb networking links used
|
||||
by some sample firmware from Epson.
|
||||
|
||||
config USB_ZAURUS
|
||||
boolean "Sharp Zaurus (stock ROMs)"
|
||||
depends on USB_USBNET
|
||||
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.
|
||||
|
||||
If you install an alternate ROM image, you may no longer need
|
||||
to support this protocol. Only the "eth-fd" driver really needs
|
||||
this non-conformant variant of CDC Ethernet protocol.
|
||||
|
||||
config USB_CDCETHER
|
||||
boolean "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.
|
||||
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.
|
||||
|
||||
comment "USB Network Adapters"
|
||||
depends on USB_USBNET
|
||||
|
||||
config USB_AX8817X
|
||||
boolean "ASIX AX88xxx Based USB 2.0 Ethernet Devices"
|
||||
depends on USB_USBNET && NET_ETHERNET
|
||||
select CRC32
|
||||
select MII
|
||||
default y
|
||||
help
|
||||
This option adds support for ASIX AX88xxx based USB 2.0
|
||||
10/100 Ethernet devices.
|
||||
|
||||
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_ZD1201
|
||||
tristate "USB ZD1201 based Wireless device support"
|
||||
depends on NET_RADIO
|
||||
select FW_LOADER
|
||||
---help---
|
||||
Say Y if you want to use wireless LAN adapters based on the ZyDAS
|
||||
ZD1201 chip.
|
||||
|
||||
This driver makes the adapter appear as a normal Ethernet interface,
|
||||
typically on wlan0.
|
||||
|
||||
The zd1201 device requires external firmware to be loaded.
|
||||
This can be found at http://linux-lc100020.sourceforge.net/
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called zd1201.
|
||||
|
||||
endmenu
|
12
drivers/usb/net/Makefile
Ficheiro normal
12
drivers/usb/net/Makefile
Ficheiro normal
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# 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_USBNET) += usbnet.o
|
||||
obj-$(CONFIG_USB_ZD1201) += zd1201.o
|
||||
|
||||
CFLAGS_zd1201.o = -Idrivers/net/wireless/
|
960
drivers/usb/net/catc.c
Ficheiro normal
960
drivers/usb/net/catc.c
Ficheiro normal
@@ -0,0 +1,960 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Vojtech Pavlik
|
||||
*
|
||||
* CATC EL1210A NetMate USB Ethernet driver
|
||||
*
|
||||
* Sponsored by SuSE
|
||||
*
|
||||
* Based on the work of
|
||||
* Donald Becker
|
||||
*
|
||||
* Old chipset support added by Simon Evans <spse@secret.org.uk> 2002
|
||||
* - adds support for Belkin F5U011
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* Should you need to contact me, the author, you can do so either by
|
||||
* e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
|
||||
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#include <linux/usb.h>
|
||||
|
||||
/*
|
||||
* Version information.
|
||||
*/
|
||||
|
||||
#define DRIVER_VERSION "v2.8"
|
||||
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@suse.cz>"
|
||||
#define DRIVER_DESC "CATC EL1210A NetMate USB Ethernet driver"
|
||||
#define SHORT_DRIVER_DESC "EL1210A NetMate USB Ethernet"
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static const char driver_name[] = "catc";
|
||||
|
||||
/*
|
||||
* Some defines.
|
||||
*/
|
||||
|
||||
#define STATS_UPDATE (HZ) /* Time between stats updates */
|
||||
#define TX_TIMEOUT (5*HZ) /* Max time the queue can be stopped */
|
||||
#define PKT_SZ 1536 /* Max Ethernet packet size */
|
||||
#define RX_MAX_BURST 15 /* Max packets per rx buffer (> 0, < 16) */
|
||||
#define TX_MAX_BURST 15 /* Max full sized packets per tx buffer (> 0) */
|
||||
#define CTRL_QUEUE 16 /* Max control requests in flight (power of two) */
|
||||
#define RX_PKT_SZ 1600 /* Max size of receive packet for F5U011 */
|
||||
|
||||
/*
|
||||
* Control requests.
|
||||
*/
|
||||
|
||||
enum control_requests {
|
||||
ReadMem = 0xf1,
|
||||
GetMac = 0xf2,
|
||||
Reset = 0xf4,
|
||||
SetMac = 0xf5,
|
||||
SetRxMode = 0xf5, /* F5U011 only */
|
||||
WriteROM = 0xf8,
|
||||
SetReg = 0xfa,
|
||||
GetReg = 0xfb,
|
||||
WriteMem = 0xfc,
|
||||
ReadROM = 0xfd,
|
||||
};
|
||||
|
||||
/*
|
||||
* Registers.
|
||||
*/
|
||||
|
||||
enum register_offsets {
|
||||
TxBufCount = 0x20,
|
||||
RxBufCount = 0x21,
|
||||
OpModes = 0x22,
|
||||
TxQed = 0x23,
|
||||
RxQed = 0x24,
|
||||
MaxBurst = 0x25,
|
||||
RxUnit = 0x60,
|
||||
EthStatus = 0x61,
|
||||
StationAddr0 = 0x67,
|
||||
EthStats = 0x69,
|
||||
LEDCtrl = 0x81,
|
||||
};
|
||||
|
||||
enum eth_stats {
|
||||
TxSingleColl = 0x00,
|
||||
TxMultiColl = 0x02,
|
||||
TxExcessColl = 0x04,
|
||||
RxFramErr = 0x06,
|
||||
};
|
||||
|
||||
enum op_mode_bits {
|
||||
Op3MemWaits = 0x03,
|
||||
OpLenInclude = 0x08,
|
||||
OpRxMerge = 0x10,
|
||||
OpTxMerge = 0x20,
|
||||
OpWin95bugfix = 0x40,
|
||||
OpLoopback = 0x80,
|
||||
};
|
||||
|
||||
enum rx_filter_bits {
|
||||
RxEnable = 0x01,
|
||||
RxPolarity = 0x02,
|
||||
RxForceOK = 0x04,
|
||||
RxMultiCast = 0x08,
|
||||
RxPromisc = 0x10,
|
||||
AltRxPromisc = 0x20, /* F5U011 uses different bit */
|
||||
};
|
||||
|
||||
enum led_values {
|
||||
LEDFast = 0x01,
|
||||
LEDSlow = 0x02,
|
||||
LEDFlash = 0x03,
|
||||
LEDPulse = 0x04,
|
||||
LEDLink = 0x08,
|
||||
};
|
||||
|
||||
enum link_status {
|
||||
LinkNoChange = 0,
|
||||
LinkGood = 1,
|
||||
LinkBad = 2
|
||||
};
|
||||
|
||||
/*
|
||||
* The catc struct.
|
||||
*/
|
||||
|
||||
#define CTRL_RUNNING 0
|
||||
#define RX_RUNNING 1
|
||||
#define TX_RUNNING 2
|
||||
|
||||
struct catc {
|
||||
struct net_device *netdev;
|
||||
struct usb_device *usbdev;
|
||||
|
||||
struct net_device_stats stats;
|
||||
unsigned long flags;
|
||||
|
||||
unsigned int tx_ptr, tx_idx;
|
||||
unsigned int ctrl_head, ctrl_tail;
|
||||
spinlock_t tx_lock, ctrl_lock;
|
||||
|
||||
u8 tx_buf[2][TX_MAX_BURST * (PKT_SZ + 2)];
|
||||
u8 rx_buf[RX_MAX_BURST * (PKT_SZ + 2)];
|
||||
u8 irq_buf[2];
|
||||
u8 ctrl_buf[64];
|
||||
struct usb_ctrlrequest ctrl_dr;
|
||||
|
||||
struct timer_list timer;
|
||||
u8 stats_buf[8];
|
||||
u16 stats_vals[4];
|
||||
unsigned long last_stats;
|
||||
|
||||
u8 multicast[64];
|
||||
|
||||
struct ctrl_queue {
|
||||
u8 dir;
|
||||
u8 request;
|
||||
u16 value;
|
||||
u16 index;
|
||||
void *buf;
|
||||
int len;
|
||||
void (*callback)(struct catc *catc, struct ctrl_queue *q);
|
||||
} ctrl_queue[CTRL_QUEUE];
|
||||
|
||||
struct urb *tx_urb, *rx_urb, *irq_urb, *ctrl_urb;
|
||||
|
||||
u8 is_f5u011; /* Set if device is an F5U011 */
|
||||
u8 rxmode[2]; /* Used for F5U011 */
|
||||
atomic_t recq_sz; /* Used for F5U011 - counter of waiting rx packets */
|
||||
};
|
||||
|
||||
/*
|
||||
* Useful macros.
|
||||
*/
|
||||
|
||||
#define catc_get_mac(catc, mac) catc_ctrl_msg(catc, USB_DIR_IN, GetMac, 0, 0, mac, 6)
|
||||
#define catc_reset(catc) catc_ctrl_msg(catc, USB_DIR_OUT, Reset, 0, 0, NULL, 0)
|
||||
#define catc_set_reg(catc, reg, val) catc_ctrl_msg(catc, USB_DIR_OUT, SetReg, val, reg, NULL, 0)
|
||||
#define catc_get_reg(catc, reg, buf) catc_ctrl_msg(catc, USB_DIR_IN, GetReg, 0, reg, buf, 1)
|
||||
#define catc_write_mem(catc, addr, buf, size) catc_ctrl_msg(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size)
|
||||
#define catc_read_mem(catc, addr, buf, size) catc_ctrl_msg(catc, USB_DIR_IN, ReadMem, 0, addr, buf, size)
|
||||
|
||||
#define f5u011_rxmode(catc, rxmode) catc_ctrl_msg(catc, USB_DIR_OUT, SetRxMode, 0, 1, rxmode, 2)
|
||||
#define f5u011_rxmode_async(catc, rxmode) catc_ctrl_async(catc, USB_DIR_OUT, SetRxMode, 0, 1, &rxmode, 2, NULL)
|
||||
#define f5u011_mchash_async(catc, hash) catc_ctrl_async(catc, USB_DIR_OUT, SetRxMode, 0, 2, &hash, 8, NULL)
|
||||
|
||||
#define catc_set_reg_async(catc, reg, val) catc_ctrl_async(catc, USB_DIR_OUT, SetReg, val, reg, NULL, 0, NULL)
|
||||
#define catc_get_reg_async(catc, reg, cb) catc_ctrl_async(catc, USB_DIR_IN, GetReg, 0, reg, NULL, 1, cb)
|
||||
#define catc_write_mem_async(catc, addr, buf, size) catc_ctrl_async(catc, USB_DIR_OUT, WriteMem, 0, addr, buf, size, NULL)
|
||||
|
||||
/*
|
||||
* Receive routines.
|
||||
*/
|
||||
|
||||
static void catc_rx_done(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
struct catc *catc = urb->context;
|
||||
u8 *pkt_start = urb->transfer_buffer;
|
||||
struct sk_buff *skb;
|
||||
int pkt_len, pkt_offset = 0;
|
||||
|
||||
if (!catc->is_f5u011) {
|
||||
clear_bit(RX_RUNNING, &catc->flags);
|
||||
pkt_offset = 2;
|
||||
}
|
||||
|
||||
if (urb->status) {
|
||||
dbg("rx_done, status %d, length %d", urb->status, urb->actual_length);
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
if(!catc->is_f5u011) {
|
||||
pkt_len = le16_to_cpup((__le16*)pkt_start);
|
||||
if (pkt_len > urb->actual_length) {
|
||||
catc->stats.rx_length_errors++;
|
||||
catc->stats.rx_errors++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pkt_len = urb->actual_length;
|
||||
}
|
||||
|
||||
if (!(skb = dev_alloc_skb(pkt_len)))
|
||||
return;
|
||||
|
||||
skb->dev = catc->netdev;
|
||||
eth_copy_and_sum(skb, pkt_start + pkt_offset, pkt_len, 0);
|
||||
skb_put(skb, pkt_len);
|
||||
|
||||
skb->protocol = eth_type_trans(skb, catc->netdev);
|
||||
netif_rx(skb);
|
||||
|
||||
catc->stats.rx_packets++;
|
||||
catc->stats.rx_bytes += pkt_len;
|
||||
|
||||
/* F5U011 only does one packet per RX */
|
||||
if (catc->is_f5u011)
|
||||
break;
|
||||
pkt_start += (((pkt_len + 1) >> 6) + 1) << 6;
|
||||
|
||||
} while (pkt_start - (u8 *) urb->transfer_buffer < urb->actual_length);
|
||||
|
||||
catc->netdev->last_rx = jiffies;
|
||||
|
||||
if (catc->is_f5u011) {
|
||||
if (atomic_read(&catc->recq_sz)) {
|
||||
int status;
|
||||
atomic_dec(&catc->recq_sz);
|
||||
dbg("getting extra packet");
|
||||
urb->dev = catc->usbdev;
|
||||
if ((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
|
||||
dbg("submit(rx_urb) status %d", status);
|
||||
}
|
||||
} else {
|
||||
clear_bit(RX_RUNNING, &catc->flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void catc_irq_done(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
struct catc *catc = urb->context;
|
||||
u8 *data = urb->transfer_buffer;
|
||||
int status;
|
||||
unsigned int hasdata = 0, linksts = LinkNoChange;
|
||||
|
||||
if (!catc->is_f5u011) {
|
||||
hasdata = data[1] & 0x80;
|
||||
if (data[1] & 0x40)
|
||||
linksts = LinkGood;
|
||||
else if (data[1] & 0x20)
|
||||
linksts = LinkBad;
|
||||
} else {
|
||||
hasdata = (unsigned int)(be16_to_cpup((__be16*)data) & 0x0fff);
|
||||
if (data[0] == 0x90)
|
||||
linksts = LinkGood;
|
||||
else if (data[0] == 0xA0)
|
||||
linksts = LinkBad;
|
||||
}
|
||||
|
||||
switch (urb->status) {
|
||||
case 0: /* success */
|
||||
break;
|
||||
case -ECONNRESET: /* unlink */
|
||||
case -ENOENT:
|
||||
case -ESHUTDOWN:
|
||||
return;
|
||||
/* -EPIPE: should clear the halt */
|
||||
default: /* error */
|
||||
dbg("irq_done, status %d, data %02x %02x.", urb->status, data[0], data[1]);
|
||||
goto resubmit;
|
||||
}
|
||||
|
||||
if (linksts == LinkGood) {
|
||||
netif_carrier_on(catc->netdev);
|
||||
dbg("link ok");
|
||||
}
|
||||
|
||||
if (linksts == LinkBad) {
|
||||
netif_carrier_off(catc->netdev);
|
||||
dbg("link bad");
|
||||
}
|
||||
|
||||
if (hasdata) {
|
||||
if (test_and_set_bit(RX_RUNNING, &catc->flags)) {
|
||||
if (catc->is_f5u011)
|
||||
atomic_inc(&catc->recq_sz);
|
||||
} else {
|
||||
catc->rx_urb->dev = catc->usbdev;
|
||||
if ((status = usb_submit_urb(catc->rx_urb, GFP_ATOMIC)) < 0) {
|
||||
err("submit(rx_urb) status %d", status);
|
||||
}
|
||||
}
|
||||
}
|
||||
resubmit:
|
||||
status = usb_submit_urb (urb, SLAB_ATOMIC);
|
||||
if (status)
|
||||
err ("can't resubmit intr, %s-%s, status %d",
|
||||
catc->usbdev->bus->bus_name,
|
||||
catc->usbdev->devpath, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transmit routines.
|
||||
*/
|
||||
|
||||
static void catc_tx_run(struct catc *catc)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (catc->is_f5u011)
|
||||
catc->tx_ptr = (catc->tx_ptr + 63) & ~63;
|
||||
|
||||
catc->tx_urb->transfer_buffer_length = catc->tx_ptr;
|
||||
catc->tx_urb->transfer_buffer = catc->tx_buf[catc->tx_idx];
|
||||
catc->tx_urb->dev = catc->usbdev;
|
||||
|
||||
if ((status = usb_submit_urb(catc->tx_urb, GFP_ATOMIC)) < 0)
|
||||
err("submit(tx_urb), status %d", status);
|
||||
|
||||
catc->tx_idx = !catc->tx_idx;
|
||||
catc->tx_ptr = 0;
|
||||
|
||||
catc->netdev->trans_start = jiffies;
|
||||
}
|
||||
|
||||
static void catc_tx_done(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
struct catc *catc = urb->context;
|
||||
unsigned long flags;
|
||||
|
||||
if (urb->status == -ECONNRESET) {
|
||||
dbg("Tx Reset.");
|
||||
urb->transfer_flags &= ~URB_ASYNC_UNLINK;
|
||||
urb->status = 0;
|
||||
catc->netdev->trans_start = jiffies;
|
||||
catc->stats.tx_errors++;
|
||||
clear_bit(TX_RUNNING, &catc->flags);
|
||||
netif_wake_queue(catc->netdev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (urb->status) {
|
||||
dbg("tx_done, status %d, length %d", urb->status, urb->actual_length);
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&catc->tx_lock, flags);
|
||||
|
||||
if (catc->tx_ptr)
|
||||
catc_tx_run(catc);
|
||||
else
|
||||
clear_bit(TX_RUNNING, &catc->flags);
|
||||
|
||||
netif_wake_queue(catc->netdev);
|
||||
|
||||
spin_unlock_irqrestore(&catc->tx_lock, flags);
|
||||
}
|
||||
|
||||
static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
unsigned long flags;
|
||||
char *tx_buf;
|
||||
|
||||
spin_lock_irqsave(&catc->tx_lock, flags);
|
||||
|
||||
catc->tx_ptr = (((catc->tx_ptr - 1) >> 6) + 1) << 6;
|
||||
tx_buf = catc->tx_buf[catc->tx_idx] + catc->tx_ptr;
|
||||
*((u16*)tx_buf) = (catc->is_f5u011) ? cpu_to_be16((u16)skb->len) : cpu_to_le16((u16)skb->len);
|
||||
memcpy(tx_buf + 2, skb->data, skb->len);
|
||||
catc->tx_ptr += skb->len + 2;
|
||||
|
||||
if (!test_and_set_bit(TX_RUNNING, &catc->flags))
|
||||
catc_tx_run(catc);
|
||||
|
||||
if ((catc->is_f5u011 && catc->tx_ptr)
|
||||
|| (catc->tx_ptr >= ((TX_MAX_BURST - 1) * (PKT_SZ + 2))))
|
||||
netif_stop_queue(netdev);
|
||||
|
||||
spin_unlock_irqrestore(&catc->tx_lock, flags);
|
||||
|
||||
catc->stats.tx_bytes += skb->len;
|
||||
catc->stats.tx_packets++;
|
||||
|
||||
dev_kfree_skb(skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void catc_tx_timeout(struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
|
||||
warn("Transmit timed out.");
|
||||
catc->tx_urb->transfer_flags |= URB_ASYNC_UNLINK;
|
||||
usb_unlink_urb(catc->tx_urb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Control messages.
|
||||
*/
|
||||
|
||||
static int catc_ctrl_msg(struct catc *catc, u8 dir, u8 request, u16 value, u16 index, void *buf, int len)
|
||||
{
|
||||
int retval = usb_control_msg(catc->usbdev,
|
||||
dir ? usb_rcvctrlpipe(catc->usbdev, 0) : usb_sndctrlpipe(catc->usbdev, 0),
|
||||
request, 0x40 | dir, value, index, buf, len, 1000);
|
||||
return retval < 0 ? retval : 0;
|
||||
}
|
||||
|
||||
static void catc_ctrl_run(struct catc *catc)
|
||||
{
|
||||
struct ctrl_queue *q = catc->ctrl_queue + catc->ctrl_tail;
|
||||
struct usb_device *usbdev = catc->usbdev;
|
||||
struct urb *urb = catc->ctrl_urb;
|
||||
struct usb_ctrlrequest *dr = &catc->ctrl_dr;
|
||||
int status;
|
||||
|
||||
dr->bRequest = q->request;
|
||||
dr->bRequestType = 0x40 | q->dir;
|
||||
dr->wValue = cpu_to_le16(q->value);
|
||||
dr->wIndex = cpu_to_le16(q->index);
|
||||
dr->wLength = cpu_to_le16(q->len);
|
||||
|
||||
urb->pipe = q->dir ? usb_rcvctrlpipe(usbdev, 0) : usb_sndctrlpipe(usbdev, 0);
|
||||
urb->transfer_buffer_length = q->len;
|
||||
urb->transfer_buffer = catc->ctrl_buf;
|
||||
urb->setup_packet = (void *) dr;
|
||||
urb->dev = usbdev;
|
||||
|
||||
if (!q->dir && q->buf && q->len)
|
||||
memcpy(catc->ctrl_buf, q->buf, q->len);
|
||||
|
||||
if ((status = usb_submit_urb(catc->ctrl_urb, GFP_KERNEL)))
|
||||
err("submit(ctrl_urb) status %d", status);
|
||||
}
|
||||
|
||||
static void catc_ctrl_done(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
struct catc *catc = urb->context;
|
||||
struct ctrl_queue *q;
|
||||
unsigned long flags;
|
||||
|
||||
if (urb->status)
|
||||
dbg("ctrl_done, status %d, len %d.", urb->status, urb->actual_length);
|
||||
|
||||
spin_lock_irqsave(&catc->ctrl_lock, flags);
|
||||
|
||||
q = catc->ctrl_queue + catc->ctrl_tail;
|
||||
|
||||
if (q->dir) {
|
||||
if (q->buf && q->len)
|
||||
memcpy(q->buf, catc->ctrl_buf, q->len);
|
||||
else
|
||||
q->buf = catc->ctrl_buf;
|
||||
}
|
||||
|
||||
if (q->callback)
|
||||
q->callback(catc, q);
|
||||
|
||||
catc->ctrl_tail = (catc->ctrl_tail + 1) & (CTRL_QUEUE - 1);
|
||||
|
||||
if (catc->ctrl_head != catc->ctrl_tail)
|
||||
catc_ctrl_run(catc);
|
||||
else
|
||||
clear_bit(CTRL_RUNNING, &catc->flags);
|
||||
|
||||
spin_unlock_irqrestore(&catc->ctrl_lock, flags);
|
||||
}
|
||||
|
||||
static int catc_ctrl_async(struct catc *catc, u8 dir, u8 request, u16 value,
|
||||
u16 index, void *buf, int len, void (*callback)(struct catc *catc, struct ctrl_queue *q))
|
||||
{
|
||||
struct ctrl_queue *q;
|
||||
int retval = 0;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&catc->ctrl_lock, flags);
|
||||
|
||||
q = catc->ctrl_queue + catc->ctrl_head;
|
||||
|
||||
q->dir = dir;
|
||||
q->request = request;
|
||||
q->value = value;
|
||||
q->index = index;
|
||||
q->buf = buf;
|
||||
q->len = len;
|
||||
q->callback = callback;
|
||||
|
||||
catc->ctrl_head = (catc->ctrl_head + 1) & (CTRL_QUEUE - 1);
|
||||
|
||||
if (catc->ctrl_head == catc->ctrl_tail) {
|
||||
err("ctrl queue full");
|
||||
catc->ctrl_tail = (catc->ctrl_tail + 1) & (CTRL_QUEUE - 1);
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
if (!test_and_set_bit(CTRL_RUNNING, &catc->flags))
|
||||
catc_ctrl_run(catc);
|
||||
|
||||
spin_unlock_irqrestore(&catc->ctrl_lock, flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Statistics.
|
||||
*/
|
||||
|
||||
static void catc_stats_done(struct catc *catc, struct ctrl_queue *q)
|
||||
{
|
||||
int index = q->index - EthStats;
|
||||
u16 data, last;
|
||||
|
||||
catc->stats_buf[index] = *((char *)q->buf);
|
||||
|
||||
if (index & 1)
|
||||
return;
|
||||
|
||||
data = ((u16)catc->stats_buf[index] << 8) | catc->stats_buf[index + 1];
|
||||
last = catc->stats_vals[index >> 1];
|
||||
|
||||
switch (index) {
|
||||
case TxSingleColl:
|
||||
case TxMultiColl:
|
||||
catc->stats.collisions += data - last;
|
||||
break;
|
||||
case TxExcessColl:
|
||||
catc->stats.tx_aborted_errors += data - last;
|
||||
catc->stats.tx_errors += data - last;
|
||||
break;
|
||||
case RxFramErr:
|
||||
catc->stats.rx_frame_errors += data - last;
|
||||
catc->stats.rx_errors += data - last;
|
||||
break;
|
||||
}
|
||||
|
||||
catc->stats_vals[index >> 1] = data;
|
||||
}
|
||||
|
||||
static void catc_stats_timer(unsigned long data)
|
||||
{
|
||||
struct catc *catc = (void *) data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
catc_get_reg_async(catc, EthStats + 7 - i, catc_stats_done);
|
||||
|
||||
mod_timer(&catc->timer, jiffies + STATS_UPDATE);
|
||||
}
|
||||
|
||||
static struct net_device_stats *catc_get_stats(struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
return &catc->stats;
|
||||
}
|
||||
|
||||
/*
|
||||
* Receive modes. Broadcast, Multicast, Promisc.
|
||||
*/
|
||||
|
||||
static void catc_multicast(unsigned char *addr, u8 *multicast)
|
||||
{
|
||||
u32 crc;
|
||||
|
||||
crc = ether_crc_le(6, addr);
|
||||
multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
|
||||
}
|
||||
|
||||
static void catc_set_multicast_list(struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
struct dev_mc_list *mc;
|
||||
u8 broadcast[6];
|
||||
u8 rx = RxEnable | RxPolarity | RxMultiCast;
|
||||
int i;
|
||||
|
||||
memset(broadcast, 0xff, 6);
|
||||
memset(catc->multicast, 0, 64);
|
||||
|
||||
catc_multicast(broadcast, catc->multicast);
|
||||
catc_multicast(netdev->dev_addr, catc->multicast);
|
||||
|
||||
if (netdev->flags & IFF_PROMISC) {
|
||||
memset(catc->multicast, 0xff, 64);
|
||||
rx |= (!catc->is_f5u011) ? RxPromisc : AltRxPromisc;
|
||||
}
|
||||
|
||||
if (netdev->flags & IFF_ALLMULTI) {
|
||||
memset(catc->multicast, 0xff, 64);
|
||||
} else {
|
||||
for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next) {
|
||||
u32 crc = ether_crc_le(6, mc->dmi_addr);
|
||||
if (!catc->is_f5u011) {
|
||||
catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
|
||||
} else {
|
||||
catc->multicast[7-(crc >> 29)] |= 1 << ((crc >> 26) & 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!catc->is_f5u011) {
|
||||
catc_set_reg_async(catc, RxUnit, rx);
|
||||
catc_write_mem_async(catc, 0xfa80, catc->multicast, 64);
|
||||
} else {
|
||||
f5u011_mchash_async(catc, catc->multicast);
|
||||
if (catc->rxmode[0] != rx) {
|
||||
catc->rxmode[0] = rx;
|
||||
dbg("Setting RX mode to %2.2X %2.2X", catc->rxmode[0], catc->rxmode[1]);
|
||||
f5u011_rxmode_async(catc, catc->rxmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void catc_get_drvinfo(struct net_device *dev,
|
||||
struct ethtool_drvinfo *info)
|
||||
{
|
||||
struct catc *catc = netdev_priv(dev);
|
||||
strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);
|
||||
strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
|
||||
usb_make_path (catc->usbdev, info->bus_info, sizeof info->bus_info);
|
||||
}
|
||||
|
||||
static int catc_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct catc *catc = netdev_priv(dev);
|
||||
if (!catc->is_f5u011)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_TP;
|
||||
cmd->advertising = ADVERTISED_10baseT_Half | ADVERTISED_TP;
|
||||
cmd->speed = SPEED_10;
|
||||
cmd->duplex = DUPLEX_HALF;
|
||||
cmd->port = PORT_TP;
|
||||
cmd->phy_address = 0;
|
||||
cmd->transceiver = XCVR_INTERNAL;
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
cmd->maxtxpkt = 1;
|
||||
cmd->maxrxpkt = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ethtool_ops ops = {
|
||||
.get_drvinfo = catc_get_drvinfo,
|
||||
.get_settings = catc_get_settings,
|
||||
.get_link = ethtool_op_get_link
|
||||
};
|
||||
|
||||
/*
|
||||
* Open, close.
|
||||
*/
|
||||
|
||||
static int catc_open(struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
int status;
|
||||
|
||||
catc->irq_urb->dev = catc->usbdev;
|
||||
if ((status = usb_submit_urb(catc->irq_urb, GFP_KERNEL)) < 0) {
|
||||
err("submit(irq_urb) status %d", status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
netif_start_queue(netdev);
|
||||
|
||||
if (!catc->is_f5u011)
|
||||
mod_timer(&catc->timer, jiffies + STATS_UPDATE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int catc_stop(struct net_device *netdev)
|
||||
{
|
||||
struct catc *catc = netdev_priv(netdev);
|
||||
|
||||
netif_stop_queue(netdev);
|
||||
|
||||
if (!catc->is_f5u011)
|
||||
del_timer_sync(&catc->timer);
|
||||
|
||||
usb_kill_urb(catc->rx_urb);
|
||||
usb_kill_urb(catc->tx_urb);
|
||||
usb_kill_urb(catc->irq_urb);
|
||||
usb_kill_urb(catc->ctrl_urb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* USB probe, disconnect.
|
||||
*/
|
||||
|
||||
static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||
{
|
||||
struct usb_device *usbdev = interface_to_usbdev(intf);
|
||||
struct net_device *netdev;
|
||||
struct catc *catc;
|
||||
u8 broadcast[6];
|
||||
int i, pktsz;
|
||||
|
||||
if (usb_set_interface(usbdev,
|
||||
intf->altsetting->desc.bInterfaceNumber, 1)) {
|
||||
err("Can't set altsetting 1.");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
netdev = alloc_etherdev(sizeof(struct catc));
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
catc = netdev_priv(netdev);
|
||||
|
||||
netdev->open = catc_open;
|
||||
netdev->hard_start_xmit = catc_hard_start_xmit;
|
||||
netdev->stop = catc_stop;
|
||||
netdev->get_stats = catc_get_stats;
|
||||
netdev->tx_timeout = catc_tx_timeout;
|
||||
netdev->watchdog_timeo = TX_TIMEOUT;
|
||||
netdev->set_multicast_list = catc_set_multicast_list;
|
||||
SET_ETHTOOL_OPS(netdev, &ops);
|
||||
|
||||
catc->usbdev = usbdev;
|
||||
catc->netdev = netdev;
|
||||
|
||||
spin_lock_init(&catc->tx_lock);
|
||||
spin_lock_init(&catc->ctrl_lock);
|
||||
|
||||
init_timer(&catc->timer);
|
||||
catc->timer.data = (long) catc;
|
||||
catc->timer.function = catc_stats_timer;
|
||||
|
||||
catc->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
catc->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
catc->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if ((!catc->ctrl_urb) || (!catc->tx_urb) ||
|
||||
(!catc->rx_urb) || (!catc->irq_urb)) {
|
||||
err("No free urbs available.");
|
||||
if (catc->ctrl_urb)
|
||||
usb_free_urb(catc->ctrl_urb);
|
||||
if (catc->tx_urb)
|
||||
usb_free_urb(catc->tx_urb);
|
||||
if (catc->rx_urb)
|
||||
usb_free_urb(catc->rx_urb);
|
||||
if (catc->irq_urb)
|
||||
usb_free_urb(catc->irq_urb);
|
||||
free_netdev(netdev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */
|
||||
if (le16_to_cpu(usbdev->descriptor.idVendor) == 0x0423 &&
|
||||
le16_to_cpu(usbdev->descriptor.idProduct) == 0xa &&
|
||||
le16_to_cpu(catc->usbdev->descriptor.bcdDevice) == 0x0130) {
|
||||
dbg("Testing for f5u011");
|
||||
catc->is_f5u011 = 1;
|
||||
atomic_set(&catc->recq_sz, 0);
|
||||
pktsz = RX_PKT_SZ;
|
||||
} else {
|
||||
pktsz = RX_MAX_BURST * (PKT_SZ + 2);
|
||||
}
|
||||
|
||||
usb_fill_control_urb(catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0),
|
||||
NULL, NULL, 0, catc_ctrl_done, catc);
|
||||
|
||||
usb_fill_bulk_urb(catc->tx_urb, usbdev, usb_sndbulkpipe(usbdev, 1),
|
||||
NULL, 0, catc_tx_done, catc);
|
||||
|
||||
usb_fill_bulk_urb(catc->rx_urb, usbdev, usb_rcvbulkpipe(usbdev, 1),
|
||||
catc->rx_buf, pktsz, catc_rx_done, catc);
|
||||
|
||||
usb_fill_int_urb(catc->irq_urb, usbdev, usb_rcvintpipe(usbdev, 2),
|
||||
catc->irq_buf, 2, catc_irq_done, catc, 1);
|
||||
|
||||
if (!catc->is_f5u011) {
|
||||
dbg("Checking memory size\n");
|
||||
|
||||
i = 0x12345678;
|
||||
catc_write_mem(catc, 0x7a80, &i, 4);
|
||||
i = 0x87654321;
|
||||
catc_write_mem(catc, 0xfa80, &i, 4);
|
||||
catc_read_mem(catc, 0x7a80, &i, 4);
|
||||
|
||||
switch (i) {
|
||||
case 0x12345678:
|
||||
catc_set_reg(catc, TxBufCount, 8);
|
||||
catc_set_reg(catc, RxBufCount, 32);
|
||||
dbg("64k Memory\n");
|
||||
break;
|
||||
default:
|
||||
warn("Couldn't detect memory size, assuming 32k");
|
||||
case 0x87654321:
|
||||
catc_set_reg(catc, TxBufCount, 4);
|
||||
catc_set_reg(catc, RxBufCount, 16);
|
||||
dbg("32k Memory\n");
|
||||
break;
|
||||
}
|
||||
|
||||
dbg("Getting MAC from SEEROM.");
|
||||
|
||||
catc_get_mac(catc, netdev->dev_addr);
|
||||
|
||||
dbg("Setting MAC into registers.");
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]);
|
||||
|
||||
dbg("Filling the multicast list.");
|
||||
|
||||
memset(broadcast, 0xff, 6);
|
||||
catc_multicast(broadcast, catc->multicast);
|
||||
catc_multicast(netdev->dev_addr, catc->multicast);
|
||||
catc_write_mem(catc, 0xfa80, catc->multicast, 64);
|
||||
|
||||
dbg("Clearing error counters.");
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
catc_set_reg(catc, EthStats + i, 0);
|
||||
catc->last_stats = jiffies;
|
||||
|
||||
dbg("Enabling.");
|
||||
|
||||
catc_set_reg(catc, MaxBurst, RX_MAX_BURST);
|
||||
catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits);
|
||||
catc_set_reg(catc, LEDCtrl, LEDLink);
|
||||
catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast);
|
||||
} else {
|
||||
dbg("Performing reset\n");
|
||||
catc_reset(catc);
|
||||
catc_get_mac(catc, netdev->dev_addr);
|
||||
|
||||
dbg("Setting RX Mode");
|
||||
catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast;
|
||||
catc->rxmode[1] = 0;
|
||||
f5u011_rxmode(catc, catc->rxmode);
|
||||
}
|
||||
dbg("Init done.");
|
||||
printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s, ",
|
||||
netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A NetMate",
|
||||
usbdev->bus->bus_name, usbdev->devpath);
|
||||
for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
|
||||
printk("%2.2x.\n", netdev->dev_addr[i]);
|
||||
usb_set_intfdata(intf, catc);
|
||||
|
||||
SET_NETDEV_DEV(netdev, &intf->dev);
|
||||
if (register_netdev(netdev) != 0) {
|
||||
usb_set_intfdata(intf, NULL);
|
||||
usb_free_urb(catc->ctrl_urb);
|
||||
usb_free_urb(catc->tx_urb);
|
||||
usb_free_urb(catc->rx_urb);
|
||||
usb_free_urb(catc->irq_urb);
|
||||
free_netdev(netdev);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void catc_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
struct catc *catc = usb_get_intfdata(intf);
|
||||
|
||||
usb_set_intfdata(intf, NULL);
|
||||
if (catc) {
|
||||
unregister_netdev(catc->netdev);
|
||||
usb_free_urb(catc->ctrl_urb);
|
||||
usb_free_urb(catc->tx_urb);
|
||||
usb_free_urb(catc->rx_urb);
|
||||
usb_free_urb(catc->irq_urb);
|
||||
free_netdev(catc->netdev);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Module functions and tables.
|
||||
*/
|
||||
|
||||
static struct usb_device_id catc_id_table [] = {
|
||||
{ USB_DEVICE(0x0423, 0xa) }, /* CATC Netmate, Belkin F5U011 */
|
||||
{ USB_DEVICE(0x0423, 0xc) }, /* CATC Netmate II, Belkin F5U111 */
|
||||
{ USB_DEVICE(0x08d1, 0x1) }, /* smartBridges smartNIC */
|
||||
{ }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(usb, catc_id_table);
|
||||
|
||||
static struct usb_driver catc_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = driver_name,
|
||||
.probe = catc_probe,
|
||||
.disconnect = catc_disconnect,
|
||||
.id_table = catc_id_table,
|
||||
};
|
||||
|
||||
static int __init catc_init(void)
|
||||
{
|
||||
int result = usb_register(&catc_driver);
|
||||
if (result == 0)
|
||||
info(DRIVER_VERSION " " DRIVER_DESC);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __exit catc_exit(void)
|
||||
{
|
||||
usb_deregister(&catc_driver);
|
||||
}
|
||||
|
||||
module_init(catc_init);
|
||||
module_exit(catc_exit);
|
1271
drivers/usb/net/kaweth.c
Ficheiro normal
1271
drivers/usb/net/kaweth.c
Ficheiro normal
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Carregar diff
557
drivers/usb/net/kawethfw.h
Ficheiro normal
557
drivers/usb/net/kawethfw.h
Ficheiro normal
@@ -0,0 +1,557 @@
|
||||
/******************************************/
|
||||
/* NOTE: B6/C3 is data header signature */
|
||||
/* 0xAA/0xBB is data length = total */
|
||||
/* bytes - 7, 0xCC is type, 0xDD is */
|
||||
/* interrupt to use. */
|
||||
/******************************************/
|
||||
|
||||
/****************************************************************
|
||||
* kaweth_trigger_code
|
||||
****************************************************************/
|
||||
static __u8 kaweth_trigger_code[] =
|
||||
{
|
||||
0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
|
||||
0xc8, 0x07, 0xa0, 0x00, 0xf0, 0x07, 0x5e, 0x00,
|
||||
0x06, 0x00, 0xf0, 0x07, 0x0a, 0x00, 0x08, 0x00,
|
||||
0xf0, 0x09, 0x00, 0x00, 0x02, 0x00, 0xe7, 0x07,
|
||||
0x36, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00,
|
||||
0x04, 0x00, 0xe7, 0x07, 0x50, 0xc3, 0x10, 0xc0,
|
||||
0xf0, 0x09, 0x0e, 0xc0, 0x00, 0x00, 0xe7, 0x87,
|
||||
0x01, 0x00, 0x0e, 0xc0, 0x97, 0xcf, 0xd7, 0x09,
|
||||
0x00, 0xc0, 0x17, 0x02, 0xc8, 0x07, 0xa0, 0x00,
|
||||
0xe7, 0x17, 0x50, 0xc3, 0x10, 0xc0, 0x30, 0xd8,
|
||||
0x04, 0x00, 0x30, 0x5c, 0x08, 0x00, 0x04, 0x00,
|
||||
0xb0, 0xc0, 0x06, 0x00, 0xc8, 0x05, 0xe7, 0x05,
|
||||
0x00, 0xc0, 0xc0, 0xdf, 0x97, 0xcf, 0x49, 0xaf,
|
||||
0xc0, 0x07, 0x00, 0x00, 0x60, 0xaf, 0x4a, 0xaf,
|
||||
0x00, 0x0c, 0x0c, 0x00, 0x40, 0xd2, 0x00, 0x1c,
|
||||
0x0c, 0x00, 0x40, 0xd2, 0x30, 0x00, 0x08, 0x00,
|
||||
0xf0, 0x07, 0x00, 0x00, 0x04, 0x00, 0xf0, 0x07,
|
||||
0x86, 0x00, 0x06, 0x00, 0x67, 0xcf, 0x27, 0x0c,
|
||||
0x02, 0x00, 0x00, 0x00, 0x27, 0x0c, 0x00, 0x00,
|
||||
0x0e, 0xc0, 0x49, 0xaf, 0x64, 0xaf, 0xc0, 0x07,
|
||||
0x00, 0x00, 0x4b, 0xaf, 0x4a, 0xaf, 0x5a, 0xcf,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x94, 0x00, 0x05, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
/****************************************************************
|
||||
* kaweth_trigger_code_fix
|
||||
****************************************************************/
|
||||
static __u8 kaweth_trigger_code_fix[] =
|
||||
{
|
||||
0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
|
||||
0x02, 0x00, 0x06, 0x00, 0x18, 0x00, 0x3e, 0x00,
|
||||
0x80, 0x00, 0x98, 0x00, 0xaa, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
/****************************************************************
|
||||
* kaweth_new_code
|
||||
****************************************************************/
|
||||
static __u8 kaweth_new_code[] =
|
||||
{
|
||||
0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
|
||||
0x9f, 0xcf, 0xde, 0x06, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xc4, 0x06, 0x97, 0xc1, 0xe7, 0x67, 0xff, 0x1f,
|
||||
0x28, 0xc0, 0xe7, 0x87, 0x00, 0x04, 0x24, 0xc0,
|
||||
0xe7, 0x67, 0xff, 0xf9, 0x22, 0xc0, 0x97, 0xcf,
|
||||
0xd7, 0x09, 0x00, 0xc0, 0xe7, 0x09, 0xa2, 0xc0,
|
||||
0xbe, 0x06, 0x9f, 0xaf, 0x36, 0x00, 0xe7, 0x05,
|
||||
0x00, 0xc0, 0xa7, 0xcf, 0xbc, 0x06, 0x97, 0xcf,
|
||||
0xe7, 0x57, 0x00, 0x00, 0xb8, 0x06, 0xa7, 0xa1,
|
||||
0xb8, 0x06, 0x97, 0xcf, 0xe7, 0x57, 0x00, 0x00,
|
||||
0x14, 0x08, 0x0a, 0xc0, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xa4, 0xc0, 0xa7, 0xc0, 0x7a, 0x06, 0x9f, 0xaf,
|
||||
0x92, 0x07, 0xe7, 0x07, 0x00, 0x00, 0x14, 0x08,
|
||||
0xe7, 0x57, 0xff, 0xff, 0xba, 0x06, 0x9f, 0xa0,
|
||||
0x38, 0x00, 0xe7, 0x59, 0xba, 0x06, 0xbe, 0x06,
|
||||
0x9f, 0xa0, 0x38, 0x00, 0xc8, 0x09, 0xca, 0x06,
|
||||
0x08, 0x62, 0x9f, 0xa1, 0x36, 0x08, 0xc0, 0x09,
|
||||
0x76, 0x06, 0x00, 0x60, 0xa7, 0xc0, 0x7a, 0x06,
|
||||
0x9f, 0xaf, 0xcc, 0x02, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xb8, 0x06, 0xa7, 0xc1, 0x7a, 0x06, 0x9f, 0xaf,
|
||||
0x04, 0x00, 0xe7, 0x57, 0x00, 0x00, 0x8e, 0x06,
|
||||
0x0a, 0xc1, 0xe7, 0x09, 0x20, 0xc0, 0x10, 0x08,
|
||||
0xe7, 0xd0, 0x10, 0x08, 0xe7, 0x67, 0x40, 0x00,
|
||||
0x10, 0x08, 0x9f, 0xaf, 0x92, 0x0c, 0xc0, 0x09,
|
||||
0xd0, 0x06, 0x00, 0x60, 0x05, 0xc4, 0xc0, 0x59,
|
||||
0xbe, 0x06, 0x02, 0xc0, 0x9f, 0xaf, 0xec, 0x00,
|
||||
0x9f, 0xaf, 0x34, 0x02, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xa6, 0x06, 0x9f, 0xa0, 0x7a, 0x02, 0xa7, 0xcf,
|
||||
0x7a, 0x06, 0x48, 0x02, 0xe7, 0x09, 0xbe, 0x06,
|
||||
0xd0, 0x06, 0xc8, 0x37, 0x04, 0x00, 0x9f, 0xaf,
|
||||
0x08, 0x03, 0x97, 0xcf, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xce, 0x06, 0x97, 0xc0, 0xd7, 0x09, 0x00, 0xc0,
|
||||
0xc1, 0xdf, 0xc8, 0x09, 0xc6, 0x06, 0x08, 0x62,
|
||||
0x14, 0xc0, 0x27, 0x04, 0xc6, 0x06, 0x10, 0x94,
|
||||
0xf0, 0x07, 0x10, 0x08, 0x02, 0x00, 0xc1, 0x07,
|
||||
0x01, 0x00, 0x70, 0x00, 0x04, 0x00, 0xf0, 0x07,
|
||||
0x30, 0x01, 0x06, 0x00, 0x50, 0xaf, 0xe7, 0x07,
|
||||
0xff, 0xff, 0xd0, 0x06, 0xe7, 0x07, 0x00, 0x00,
|
||||
0xce, 0x06, 0xe7, 0x05, 0x00, 0xc0, 0x97, 0xcf,
|
||||
0xd7, 0x09, 0x00, 0xc0, 0xc1, 0xdf, 0x48, 0x02,
|
||||
0xd0, 0x09, 0xc6, 0x06, 0x27, 0x02, 0xc6, 0x06,
|
||||
0xe7, 0x05, 0x00, 0xc0, 0x97, 0xcf, 0x48, 0x02,
|
||||
0xc8, 0x37, 0x04, 0x00, 0x00, 0x0c, 0x0c, 0x00,
|
||||
0x00, 0x60, 0x21, 0xc0, 0xc0, 0x37, 0x3e, 0x00,
|
||||
0x23, 0xc9, 0xc0, 0x57, 0xb4, 0x05, 0x1b, 0xc8,
|
||||
0xc0, 0x17, 0x3f, 0x00, 0xc0, 0x67, 0xc0, 0xff,
|
||||
0x30, 0x00, 0x08, 0x00, 0xf0, 0x07, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x02, 0xc0, 0x17, 0x4c, 0x00,
|
||||
0x30, 0x00, 0x06, 0x00, 0xf0, 0x07, 0xa0, 0x01,
|
||||
0x0a, 0x00, 0x48, 0x02, 0xc1, 0x07, 0x02, 0x00,
|
||||
0xd7, 0x09, 0x00, 0xc0, 0xc1, 0xdf, 0x51, 0xaf,
|
||||
0xe7, 0x05, 0x00, 0xc0, 0x97, 0xcf, 0x9f, 0xaf,
|
||||
0x08, 0x03, 0x9f, 0xaf, 0x7a, 0x02, 0x97, 0xcf,
|
||||
0x9f, 0xaf, 0x7a, 0x02, 0xc9, 0x37, 0x04, 0x00,
|
||||
0xc1, 0xdf, 0xc8, 0x09, 0xa2, 0x06, 0x50, 0x02,
|
||||
0x67, 0x02, 0xa2, 0x06, 0xd1, 0x07, 0x00, 0x00,
|
||||
0x27, 0xd8, 0xaa, 0x06, 0xc0, 0xdf, 0x9f, 0xaf,
|
||||
0xc4, 0x01, 0x97, 0xcf, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xd2, 0x06, 0x97, 0xc1, 0xe7, 0x57, 0x01, 0x00,
|
||||
0xa8, 0x06, 0x97, 0xc0, 0xc8, 0x09, 0xa0, 0x06,
|
||||
0x08, 0x62, 0x97, 0xc0, 0x00, 0x02, 0xc0, 0x17,
|
||||
0x0e, 0x00, 0x27, 0x00, 0x34, 0x01, 0x27, 0x0c,
|
||||
0x0c, 0x00, 0x36, 0x01, 0xe7, 0x07, 0x50, 0xc3,
|
||||
0x12, 0xc0, 0xe7, 0x07, 0xcc, 0x0b, 0x02, 0x00,
|
||||
0xe7, 0x07, 0x01, 0x00, 0xa8, 0x06, 0xe7, 0x07,
|
||||
0x05, 0x00, 0x90, 0xc0, 0x97, 0xcf, 0xc8, 0x09,
|
||||
0xa4, 0x06, 0x08, 0x62, 0x02, 0xc0, 0x10, 0x64,
|
||||
0x07, 0xc1, 0xe7, 0x07, 0x00, 0x00, 0x9e, 0x06,
|
||||
0xe7, 0x07, 0x72, 0x04, 0x24, 0x00, 0x97, 0xcf,
|
||||
0x27, 0x04, 0xa4, 0x06, 0xc8, 0x17, 0x0e, 0x00,
|
||||
0x27, 0x02, 0x9e, 0x06, 0xe7, 0x07, 0x80, 0x04,
|
||||
0x24, 0x00, 0x97, 0xcf, 0xd7, 0x09, 0x00, 0xc0,
|
||||
0xc1, 0xdf, 0xe7, 0x57, 0x00, 0x00, 0x90, 0x06,
|
||||
0x13, 0xc1, 0x9f, 0xaf, 0x06, 0x02, 0xe7, 0x57,
|
||||
0x00, 0x00, 0x9e, 0x06, 0x13, 0xc0, 0xe7, 0x09,
|
||||
0x9e, 0x06, 0x30, 0x01, 0xe7, 0x07, 0xf2, 0x05,
|
||||
0x32, 0x01, 0xe7, 0x07, 0x10, 0x00, 0x96, 0xc0,
|
||||
0xe7, 0x09, 0x9e, 0x06, 0x90, 0x06, 0x04, 0xcf,
|
||||
0xe7, 0x57, 0x00, 0x00, 0x9e, 0x06, 0x02, 0xc1,
|
||||
0x9f, 0xaf, 0x06, 0x02, 0xe7, 0x05, 0x00, 0xc0,
|
||||
0x97, 0xcf, 0xd7, 0x09, 0x00, 0xc0, 0xc1, 0xdf,
|
||||
0x08, 0x92, 0xe7, 0x57, 0x02, 0x00, 0xaa, 0x06,
|
||||
0x02, 0xc3, 0xc8, 0x09, 0xa4, 0x06, 0x27, 0x02,
|
||||
0xa6, 0x06, 0x08, 0x62, 0x03, 0xc1, 0xe7, 0x05,
|
||||
0x00, 0xc0, 0x97, 0xcf, 0x27, 0x04, 0xa4, 0x06,
|
||||
0xe7, 0x05, 0x00, 0xc0, 0xf0, 0x07, 0x40, 0x00,
|
||||
0x08, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x04, 0x00,
|
||||
0x00, 0x02, 0xc0, 0x17, 0x0c, 0x00, 0x30, 0x00,
|
||||
0x06, 0x00, 0xf0, 0x07, 0x46, 0x01, 0x0a, 0x00,
|
||||
0xc8, 0x17, 0x04, 0x00, 0xc1, 0x07, 0x02, 0x00,
|
||||
0x51, 0xaf, 0x97, 0xcf, 0xe7, 0x57, 0x00, 0x00,
|
||||
0x96, 0x06, 0x97, 0xc0, 0xc1, 0xdf, 0xc8, 0x09,
|
||||
0x96, 0x06, 0x27, 0x04, 0x96, 0x06, 0x27, 0x52,
|
||||
0x98, 0x06, 0x03, 0xc1, 0xe7, 0x07, 0x96, 0x06,
|
||||
0x98, 0x06, 0xc0, 0xdf, 0x17, 0x02, 0xc8, 0x17,
|
||||
0x0e, 0x00, 0x9f, 0xaf, 0xba, 0x03, 0xc8, 0x05,
|
||||
0x00, 0x60, 0x03, 0xc0, 0x9f, 0xaf, 0x24, 0x03,
|
||||
0x97, 0xcf, 0x9f, 0xaf, 0x08, 0x03, 0x97, 0xcf,
|
||||
0x57, 0x02, 0xc9, 0x07, 0xa4, 0x06, 0xd7, 0x09,
|
||||
0x00, 0xc0, 0xc1, 0xdf, 0x08, 0x62, 0x1b, 0xc0,
|
||||
0x50, 0x04, 0x11, 0x02, 0xe7, 0x05, 0x00, 0xc0,
|
||||
0xc9, 0x05, 0x97, 0xcf, 0x97, 0x02, 0xca, 0x09,
|
||||
0xd6, 0x06, 0xf2, 0x17, 0x01, 0x00, 0x04, 0x00,
|
||||
0xf2, 0x27, 0x00, 0x00, 0x06, 0x00, 0xca, 0x17,
|
||||
0x2c, 0x00, 0xf8, 0x77, 0x01, 0x00, 0x0e, 0x00,
|
||||
0x06, 0xc0, 0xca, 0xd9, 0xf8, 0x57, 0xff, 0x00,
|
||||
0x0e, 0x00, 0x01, 0xc1, 0xca, 0xd9, 0x22, 0x1c,
|
||||
0x0c, 0x00, 0xe2, 0x27, 0x00, 0x00, 0xe2, 0x17,
|
||||
0x01, 0x00, 0xe2, 0x27, 0x00, 0x00, 0xca, 0x05,
|
||||
0x00, 0x0c, 0x0c, 0x00, 0xc0, 0x17, 0x41, 0x00,
|
||||
0xc0, 0x67, 0xc0, 0xff, 0x30, 0x00, 0x08, 0x00,
|
||||
0x00, 0x02, 0xc0, 0x17, 0x0c, 0x00, 0x30, 0x00,
|
||||
0x06, 0x00, 0xf0, 0x07, 0xda, 0x00, 0x0a, 0x00,
|
||||
0xf0, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0c,
|
||||
0x08, 0x00, 0x40, 0xd1, 0x01, 0x00, 0xc0, 0x19,
|
||||
0xce, 0x06, 0xc0, 0x59, 0xc2, 0x06, 0x04, 0xc9,
|
||||
0x49, 0xaf, 0x9f, 0xaf, 0xec, 0x00, 0x4a, 0xaf,
|
||||
0x67, 0x10, 0xce, 0x06, 0xc8, 0x17, 0x04, 0x00,
|
||||
0xc1, 0x07, 0x01, 0x00, 0xd7, 0x09, 0x00, 0xc0,
|
||||
0xc1, 0xdf, 0x50, 0xaf, 0xe7, 0x05, 0x00, 0xc0,
|
||||
0x97, 0xcf, 0xc0, 0x07, 0x01, 0x00, 0xc1, 0x09,
|
||||
0xac, 0x06, 0xc1, 0x77, 0x01, 0x00, 0x97, 0xc1,
|
||||
0xd8, 0x77, 0x01, 0x00, 0x12, 0xc0, 0xc9, 0x07,
|
||||
0x6a, 0x06, 0x9f, 0xaf, 0x08, 0x04, 0x04, 0xc1,
|
||||
0xc1, 0x77, 0x08, 0x00, 0x13, 0xc0, 0x97, 0xcf,
|
||||
0xc1, 0x77, 0x02, 0x00, 0x97, 0xc1, 0xc1, 0x77,
|
||||
0x10, 0x00, 0x0c, 0xc0, 0x9f, 0xaf, 0x2c, 0x04,
|
||||
0x97, 0xcf, 0xc1, 0x77, 0x04, 0x00, 0x06, 0xc0,
|
||||
0xc9, 0x07, 0x70, 0x06, 0x9f, 0xaf, 0x08, 0x04,
|
||||
0x97, 0xc0, 0x00, 0xcf, 0x00, 0x90, 0x97, 0xcf,
|
||||
0x50, 0x54, 0x97, 0xc1, 0x70, 0x5c, 0x02, 0x00,
|
||||
0x02, 0x00, 0x97, 0xc1, 0x70, 0x5c, 0x04, 0x00,
|
||||
0x04, 0x00, 0x97, 0xcf, 0x80, 0x01, 0xc0, 0x00,
|
||||
0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x00,
|
||||
0x06, 0x00, 0x00, 0x00, 0xcb, 0x09, 0xb2, 0x06,
|
||||
0xcc, 0x09, 0xb4, 0x06, 0x0b, 0x53, 0x11, 0xc0,
|
||||
0xc9, 0x02, 0xca, 0x07, 0x1c, 0x04, 0x9f, 0xaf,
|
||||
0x08, 0x04, 0x97, 0xc0, 0x0a, 0xc8, 0x82, 0x08,
|
||||
0x0a, 0xcf, 0x82, 0x08, 0x9f, 0xaf, 0x08, 0x04,
|
||||
0x97, 0xc0, 0x05, 0xc2, 0x89, 0x30, 0x82, 0x60,
|
||||
0x78, 0xc1, 0x00, 0x90, 0x97, 0xcf, 0x89, 0x10,
|
||||
0x09, 0x53, 0x79, 0xc2, 0x89, 0x30, 0x82, 0x08,
|
||||
0x7a, 0xcf, 0xc0, 0xdf, 0x97, 0xcf, 0xc0, 0xdf,
|
||||
0x97, 0xcf, 0xe7, 0x09, 0x96, 0xc0, 0x92, 0x06,
|
||||
0xe7, 0x09, 0x98, 0xc0, 0x94, 0x06, 0x0f, 0xcf,
|
||||
0xe7, 0x09, 0x96, 0xc0, 0x92, 0x06, 0xe7, 0x09,
|
||||
0x98, 0xc0, 0x94, 0x06, 0xe7, 0x09, 0x9e, 0x06,
|
||||
0x30, 0x01, 0xe7, 0x07, 0xf2, 0x05, 0x32, 0x01,
|
||||
0xe7, 0x07, 0x10, 0x00, 0x96, 0xc0, 0xd7, 0x09,
|
||||
0x00, 0xc0, 0x17, 0x02, 0xc8, 0x09, 0x90, 0x06,
|
||||
0xc8, 0x37, 0x0e, 0x00, 0xe7, 0x77, 0x2a, 0x00,
|
||||
0x92, 0x06, 0x30, 0xc0, 0x97, 0x02, 0xca, 0x09,
|
||||
0xd6, 0x06, 0xe7, 0x77, 0x20, 0x00, 0x92, 0x06,
|
||||
0x0e, 0xc0, 0xf2, 0x17, 0x01, 0x00, 0x10, 0x00,
|
||||
0xf2, 0x27, 0x00, 0x00, 0x12, 0x00, 0xe7, 0x77,
|
||||
0x0a, 0x00, 0x92, 0x06, 0xca, 0x05, 0x1e, 0xc0,
|
||||
0x97, 0x02, 0xca, 0x09, 0xd6, 0x06, 0xf2, 0x17,
|
||||
0x01, 0x00, 0x0c, 0x00, 0xf2, 0x27, 0x00, 0x00,
|
||||
0x0e, 0x00, 0xe7, 0x77, 0x02, 0x00, 0x92, 0x06,
|
||||
0x07, 0xc0, 0xf2, 0x17, 0x01, 0x00, 0x44, 0x00,
|
||||
0xf2, 0x27, 0x00, 0x00, 0x46, 0x00, 0x06, 0xcf,
|
||||
0xf2, 0x17, 0x01, 0x00, 0x60, 0x00, 0xf2, 0x27,
|
||||
0x00, 0x00, 0x62, 0x00, 0xca, 0x05, 0x9f, 0xaf,
|
||||
0x08, 0x03, 0x0f, 0xcf, 0x57, 0x02, 0x09, 0x02,
|
||||
0xf1, 0x09, 0x94, 0x06, 0x0c, 0x00, 0xf1, 0xda,
|
||||
0x0c, 0x00, 0xc8, 0x09, 0x98, 0x06, 0x50, 0x02,
|
||||
0x67, 0x02, 0x98, 0x06, 0xd1, 0x07, 0x00, 0x00,
|
||||
0xc9, 0x05, 0xe7, 0x09, 0x9e, 0x06, 0x90, 0x06,
|
||||
0xe7, 0x57, 0x00, 0x00, 0x90, 0x06, 0x02, 0xc0,
|
||||
0x9f, 0xaf, 0x06, 0x02, 0xc8, 0x05, 0xe7, 0x05,
|
||||
0x00, 0xc0, 0xc0, 0xdf, 0x97, 0xcf, 0xd7, 0x09,
|
||||
0x00, 0xc0, 0x17, 0x00, 0x17, 0x02, 0x97, 0x02,
|
||||
0xc0, 0x09, 0x92, 0xc0, 0xe7, 0x07, 0x04, 0x00,
|
||||
0x90, 0xc0, 0xca, 0x09, 0xd6, 0x06, 0xe7, 0x07,
|
||||
0x00, 0x00, 0xa8, 0x06, 0xe7, 0x07, 0x6a, 0x04,
|
||||
0x02, 0x00, 0xc0, 0x77, 0x02, 0x00, 0x08, 0xc0,
|
||||
0xf2, 0x17, 0x01, 0x00, 0x50, 0x00, 0xf2, 0x27,
|
||||
0x00, 0x00, 0x52, 0x00, 0x9f, 0xcf, 0x24, 0x06,
|
||||
0xc0, 0x77, 0x10, 0x00, 0x06, 0xc0, 0xf2, 0x17,
|
||||
0x01, 0x00, 0x58, 0x00, 0xf2, 0x27, 0x00, 0x00,
|
||||
0x5a, 0x00, 0xc0, 0x77, 0x80, 0x00, 0x06, 0xc0,
|
||||
0xf2, 0x17, 0x01, 0x00, 0x70, 0x00, 0xf2, 0x27,
|
||||
0x00, 0x00, 0x72, 0x00, 0xc0, 0x77, 0x08, 0x00,
|
||||
0x1d, 0xc1, 0xf2, 0x17, 0x01, 0x00, 0x08, 0x00,
|
||||
0xf2, 0x27, 0x00, 0x00, 0x0a, 0x00, 0xc0, 0x77,
|
||||
0x00, 0x02, 0x06, 0xc0, 0xf2, 0x17, 0x01, 0x00,
|
||||
0x64, 0x00, 0xf2, 0x27, 0x00, 0x00, 0x66, 0x00,
|
||||
0xc0, 0x77, 0x40, 0x00, 0x06, 0xc0, 0xf2, 0x17,
|
||||
0x01, 0x00, 0x5c, 0x00, 0xf2, 0x27, 0x00, 0x00,
|
||||
0x5e, 0x00, 0xc0, 0x77, 0x01, 0x00, 0x01, 0xc0,
|
||||
0x1b, 0xcf, 0x1a, 0xcf, 0xf2, 0x17, 0x01, 0x00,
|
||||
0x00, 0x00, 0xf2, 0x27, 0x00, 0x00, 0x02, 0x00,
|
||||
0xc8, 0x09, 0x34, 0x01, 0xca, 0x17, 0x14, 0x00,
|
||||
0xd8, 0x77, 0x01, 0x00, 0x05, 0xc0, 0xca, 0xd9,
|
||||
0xd8, 0x57, 0xff, 0x00, 0x01, 0xc0, 0xca, 0xd9,
|
||||
0xe2, 0x19, 0x94, 0xc0, 0xe2, 0x27, 0x00, 0x00,
|
||||
0xe2, 0x17, 0x01, 0x00, 0xe2, 0x27, 0x00, 0x00,
|
||||
0x9f, 0xaf, 0x40, 0x06, 0x9f, 0xaf, 0xc4, 0x01,
|
||||
0xe7, 0x57, 0x00, 0x00, 0xd2, 0x06, 0x9f, 0xa1,
|
||||
0x0e, 0x0a, 0xca, 0x05, 0xc8, 0x05, 0xc0, 0x05,
|
||||
0xe7, 0x05, 0x00, 0xc0, 0xc0, 0xdf, 0x97, 0xcf,
|
||||
0xc8, 0x09, 0xa0, 0x06, 0x08, 0x62, 0x97, 0xc0,
|
||||
0x27, 0x04, 0xa0, 0x06, 0x27, 0x52, 0xa2, 0x06,
|
||||
0x03, 0xc1, 0xe7, 0x07, 0xa0, 0x06, 0xa2, 0x06,
|
||||
0x9f, 0xaf, 0x08, 0x03, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xaa, 0x06, 0x02, 0xc0, 0x27, 0xda, 0xaa, 0x06,
|
||||
0x97, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xfb, 0x13, 0xe7, 0x57,
|
||||
0x00, 0x80, 0xb2, 0x00, 0x06, 0xc2, 0xe7, 0x07,
|
||||
0xee, 0x0b, 0x12, 0x00, 0xe7, 0x07, 0x34, 0x0c,
|
||||
0xb2, 0x00, 0xe7, 0x07, 0xc6, 0x07, 0xf2, 0x02,
|
||||
0xc8, 0x09, 0xb4, 0x00, 0xf8, 0x07, 0x02, 0x00,
|
||||
0x0d, 0x00, 0xd7, 0x09, 0x0e, 0xc0, 0xe7, 0x07,
|
||||
0x00, 0x00, 0x0e, 0xc0, 0xc8, 0x09, 0xde, 0x00,
|
||||
0xc8, 0x17, 0x09, 0x00, 0xc9, 0x07, 0xda, 0x06,
|
||||
0xc0, 0x07, 0x04, 0x00, 0x68, 0x0a, 0x00, 0xda,
|
||||
0x7d, 0xc1, 0xe7, 0x09, 0xc0, 0x00, 0x7c, 0x06,
|
||||
0xe7, 0x09, 0xbe, 0x00, 0x78, 0x06, 0xe7, 0x09,
|
||||
0x10, 0x00, 0xbc, 0x06, 0xc8, 0x07, 0xd6, 0x07,
|
||||
0x9f, 0xaf, 0xae, 0x07, 0x9f, 0xaf, 0x00, 0x0a,
|
||||
0xc8, 0x09, 0xde, 0x00, 0x00, 0x0e, 0x0f, 0x00,
|
||||
0x41, 0x90, 0x9f, 0xde, 0x06, 0x00, 0x44, 0xaf,
|
||||
0x27, 0x00, 0xb2, 0x06, 0x27, 0x00, 0xb4, 0x06,
|
||||
0x27, 0x00, 0xb6, 0x06, 0xc0, 0x07, 0x74, 0x00,
|
||||
0x44, 0xaf, 0x27, 0x00, 0xd6, 0x06, 0x08, 0x00,
|
||||
0x00, 0x90, 0xc1, 0x07, 0x3a, 0x00, 0x20, 0x00,
|
||||
0x01, 0xda, 0x7d, 0xc1, 0x9f, 0xaf, 0xba, 0x09,
|
||||
0xc0, 0x07, 0x44, 0x00, 0x48, 0xaf, 0x27, 0x00,
|
||||
0x7a, 0x06, 0x9f, 0xaf, 0x96, 0x0a, 0xe7, 0x07,
|
||||
0x01, 0x00, 0xc0, 0x06, 0xe7, 0x05, 0x0e, 0xc0,
|
||||
0x97, 0xcf, 0x49, 0xaf, 0xe7, 0x87, 0x43, 0x00,
|
||||
0x0e, 0xc0, 0xe7, 0x07, 0xff, 0xff, 0xbe, 0x06,
|
||||
0x9f, 0xaf, 0xae, 0x0a, 0xc0, 0x07, 0x01, 0x00,
|
||||
0x60, 0xaf, 0x4a, 0xaf, 0x97, 0xcf, 0x00, 0x08,
|
||||
0x09, 0x08, 0x11, 0x08, 0x00, 0xda, 0x7c, 0xc1,
|
||||
0x97, 0xcf, 0x67, 0x04, 0xcc, 0x02, 0xc0, 0xdf,
|
||||
0x51, 0x94, 0xb1, 0xaf, 0x06, 0x00, 0xc1, 0xdf,
|
||||
0xc9, 0x09, 0xcc, 0x02, 0x49, 0x62, 0x75, 0xc1,
|
||||
0xc0, 0xdf, 0xa7, 0xcf, 0xd6, 0x02, 0x0e, 0x00,
|
||||
0x24, 0x00, 0x80, 0x04, 0x22, 0x00, 0x4e, 0x05,
|
||||
0xd0, 0x00, 0x0e, 0x0a, 0xaa, 0x00, 0x30, 0x08,
|
||||
0xbe, 0x00, 0x4a, 0x0a, 0x10, 0x00, 0x20, 0x00,
|
||||
0x04, 0x00, 0x6e, 0x04, 0x02, 0x00, 0x6a, 0x04,
|
||||
0x06, 0x00, 0x00, 0x00, 0x24, 0xc0, 0x04, 0x04,
|
||||
0x28, 0xc0, 0xfe, 0xfb, 0x1e, 0xc0, 0x00, 0x04,
|
||||
0x22, 0xc0, 0xff, 0xf4, 0xc0, 0x00, 0x90, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0x08,
|
||||
0x60, 0x08, 0xd0, 0x08, 0xda, 0x08, 0x00, 0x09,
|
||||
0x04, 0x09, 0x08, 0x09, 0x32, 0x09, 0x42, 0x09,
|
||||
0x50, 0x09, 0x52, 0x09, 0x5a, 0x09, 0x5a, 0x09,
|
||||
0x27, 0x02, 0xca, 0x06, 0x97, 0xcf, 0xe7, 0x07,
|
||||
0x00, 0x00, 0xca, 0x06, 0x0a, 0x0e, 0x01, 0x00,
|
||||
0xca, 0x57, 0x0e, 0x00, 0x9f, 0xc3, 0x5a, 0x09,
|
||||
0xca, 0x37, 0x00, 0x00, 0x9f, 0xc2, 0x5a, 0x09,
|
||||
0x0a, 0xd2, 0xb2, 0xcf, 0x16, 0x08, 0xc8, 0x09,
|
||||
0xde, 0x00, 0x07, 0x06, 0x9f, 0xcf, 0x6c, 0x09,
|
||||
0x17, 0x02, 0xc8, 0x09, 0xde, 0x00, 0x00, 0x0e,
|
||||
0x0f, 0x00, 0x41, 0x90, 0x9f, 0xde, 0x06, 0x00,
|
||||
0xc8, 0x05, 0x30, 0x50, 0x06, 0x00, 0x9f, 0xc8,
|
||||
0x5a, 0x09, 0x27, 0x0c, 0x02, 0x00, 0xb0, 0x06,
|
||||
0xc0, 0x09, 0xb2, 0x06, 0x27, 0x00, 0xb4, 0x06,
|
||||
0xe7, 0x07, 0x00, 0x00, 0xae, 0x06, 0x27, 0x00,
|
||||
0x80, 0x06, 0x00, 0x1c, 0x06, 0x00, 0x27, 0x00,
|
||||
0xb6, 0x06, 0x41, 0x90, 0x67, 0x50, 0xb0, 0x06,
|
||||
0x0d, 0xc0, 0x67, 0x00, 0x7e, 0x06, 0x27, 0x0c,
|
||||
0x06, 0x00, 0x82, 0x06, 0xe7, 0x07, 0xbc, 0x08,
|
||||
0x84, 0x06, 0xc8, 0x07, 0x7e, 0x06, 0x41, 0x90,
|
||||
0x51, 0xaf, 0x97, 0xcf, 0x9f, 0xaf, 0x48, 0x0c,
|
||||
0xe7, 0x09, 0xb6, 0x06, 0xb4, 0x06, 0xe7, 0x09,
|
||||
0xb0, 0x06, 0xae, 0x06, 0x59, 0xaf, 0x97, 0xcf,
|
||||
0x27, 0x0c, 0x02, 0x00, 0xac, 0x06, 0x59, 0xaf,
|
||||
0x97, 0xcf, 0x09, 0x0c, 0x02, 0x00, 0x09, 0xda,
|
||||
0x49, 0xd2, 0xc9, 0x19, 0xd6, 0x06, 0xc8, 0x07,
|
||||
0x7e, 0x06, 0xe0, 0x07, 0x00, 0x00, 0x60, 0x02,
|
||||
0xe0, 0x07, 0x04, 0x00, 0xd0, 0x07, 0xcc, 0x08,
|
||||
0x48, 0xdb, 0x41, 0x90, 0x50, 0xaf, 0x97, 0xcf,
|
||||
0x59, 0xaf, 0x97, 0xcf, 0x59, 0xaf, 0x97, 0xcf,
|
||||
0xf0, 0x57, 0x06, 0x00, 0x06, 0x00, 0x25, 0xc1,
|
||||
0xe7, 0x07, 0x70, 0x06, 0x80, 0x06, 0x41, 0x90,
|
||||
0x67, 0x00, 0x7e, 0x06, 0x27, 0x0c, 0x06, 0x00,
|
||||
0x82, 0x06, 0xe7, 0x07, 0x8c, 0x09, 0x84, 0x06,
|
||||
0xc8, 0x07, 0x7e, 0x06, 0x41, 0x90, 0x51, 0xaf,
|
||||
0x97, 0xcf, 0x07, 0x0c, 0x06, 0x00, 0xc7, 0x57,
|
||||
0x06, 0x00, 0x0f, 0xc1, 0xc8, 0x07, 0x70, 0x06,
|
||||
0x15, 0xcf, 0x00, 0x0c, 0x02, 0x00, 0x00, 0xda,
|
||||
0x40, 0xd1, 0x27, 0x00, 0xc2, 0x06, 0x1e, 0xcf,
|
||||
0x1d, 0xcf, 0x27, 0x0c, 0x02, 0x00, 0xcc, 0x06,
|
||||
0x19, 0xcf, 0x27, 0x02, 0x20, 0x01, 0xe7, 0x07,
|
||||
0x08, 0x00, 0x22, 0x01, 0xe7, 0x07, 0x13, 0x00,
|
||||
0xb0, 0xc0, 0x97, 0xcf, 0x41, 0x90, 0x67, 0x00,
|
||||
0x7e, 0x06, 0xe7, 0x01, 0x82, 0x06, 0x27, 0x02,
|
||||
0x80, 0x06, 0xe7, 0x07, 0x8c, 0x09, 0x84, 0x06,
|
||||
0xc8, 0x07, 0x7e, 0x06, 0xc1, 0x07, 0x00, 0x80,
|
||||
0x50, 0xaf, 0x97, 0xcf, 0x59, 0xaf, 0x97, 0xcf,
|
||||
0x00, 0x60, 0x05, 0xc0, 0xe7, 0x07, 0x00, 0x00,
|
||||
0xc4, 0x06, 0xa7, 0xcf, 0x7c, 0x06, 0x9f, 0xaf,
|
||||
0x00, 0x0a, 0xe7, 0x07, 0x01, 0x00, 0xc4, 0x06,
|
||||
0x49, 0xaf, 0xd7, 0x09, 0x00, 0xc0, 0x07, 0xaf,
|
||||
0xe7, 0x05, 0x00, 0xc0, 0x4a, 0xaf, 0xa7, 0xcf,
|
||||
0x7c, 0x06, 0xc0, 0x07, 0xfe, 0x7f, 0x44, 0xaf,
|
||||
0x40, 0x00, 0xc0, 0x37, 0x00, 0x01, 0x41, 0x90,
|
||||
0xc0, 0x37, 0x08, 0x00, 0xdf, 0xde, 0x50, 0x06,
|
||||
0xc0, 0x57, 0x10, 0x00, 0x02, 0xc2, 0xc0, 0x07,
|
||||
0x10, 0x00, 0x27, 0x00, 0x9a, 0x06, 0x41, 0x90,
|
||||
0x9f, 0xde, 0x40, 0x06, 0x44, 0xaf, 0x27, 0x00,
|
||||
0x9c, 0x06, 0xc0, 0x09, 0x9a, 0x06, 0x41, 0x90,
|
||||
0x00, 0xd2, 0x00, 0xd8, 0x9f, 0xde, 0x08, 0x00,
|
||||
0x44, 0xaf, 0x27, 0x00, 0xc8, 0x06, 0x97, 0xcf,
|
||||
0xe7, 0x87, 0x00, 0x84, 0x28, 0xc0, 0xe7, 0x67,
|
||||
0xff, 0xfb, 0x24, 0xc0, 0x97, 0xcf, 0xe7, 0x87,
|
||||
0x01, 0x00, 0xd2, 0x06, 0xe7, 0x57, 0x00, 0x00,
|
||||
0xa8, 0x06, 0x97, 0xc1, 0x9f, 0xaf, 0x00, 0x0a,
|
||||
0xe7, 0x87, 0x00, 0x06, 0x22, 0xc0, 0xe7, 0x07,
|
||||
0x00, 0x00, 0x90, 0xc0, 0xe7, 0x67, 0xfe, 0xff,
|
||||
0x3e, 0xc0, 0xe7, 0x07, 0x26, 0x00, 0x0a, 0xc0,
|
||||
0xe7, 0x87, 0x01, 0x00, 0x3e, 0xc0, 0xe7, 0x07,
|
||||
0xff, 0xff, 0xbe, 0x06, 0x9f, 0xaf, 0x10, 0x0b,
|
||||
0x97, 0xcf, 0x17, 0x00, 0xa7, 0xaf, 0x78, 0x06,
|
||||
0xc0, 0x05, 0x27, 0x00, 0x76, 0x06, 0xe7, 0x87,
|
||||
0x01, 0x00, 0xd2, 0x06, 0x9f, 0xaf, 0x00, 0x0a,
|
||||
0xe7, 0x07, 0x0c, 0x00, 0x40, 0xc0, 0x9f, 0xaf,
|
||||
0x10, 0x0b, 0x00, 0x90, 0x27, 0x00, 0xa6, 0x06,
|
||||
0x27, 0x00, 0xaa, 0x06, 0xe7, 0x09, 0xb2, 0x06,
|
||||
0xb4, 0x06, 0x27, 0x00, 0xae, 0x06, 0x27, 0x00,
|
||||
0xac, 0x06, 0x9f, 0xaf, 0xae, 0x0a, 0xc0, 0x07,
|
||||
0x00, 0x00, 0x27, 0x00, 0xb2, 0x02, 0x27, 0x00,
|
||||
0xb4, 0x02, 0x27, 0x00, 0x8e, 0x06, 0xc0, 0x07,
|
||||
0x06, 0x00, 0xc8, 0x09, 0xde, 0x00, 0xc8, 0x17,
|
||||
0x03, 0x00, 0xc9, 0x07, 0x70, 0x06, 0x29, 0x0a,
|
||||
0x00, 0xda, 0x7d, 0xc1, 0x97, 0xcf, 0xd7, 0x09,
|
||||
0x00, 0xc0, 0xc1, 0xdf, 0x00, 0x90, 0x27, 0x00,
|
||||
0x96, 0x06, 0xe7, 0x07, 0x96, 0x06, 0x98, 0x06,
|
||||
0x27, 0x00, 0xa0, 0x06, 0xe7, 0x07, 0xa0, 0x06,
|
||||
0xa2, 0x06, 0x27, 0x00, 0xa6, 0x06, 0x27, 0x00,
|
||||
0x90, 0x06, 0x27, 0x00, 0x9e, 0x06, 0xc8, 0x09,
|
||||
0x9c, 0x06, 0xc1, 0x09, 0x9a, 0x06, 0xc9, 0x07,
|
||||
0xa4, 0x06, 0x11, 0x02, 0x09, 0x02, 0xc8, 0x17,
|
||||
0x40, 0x06, 0x01, 0xda, 0x7a, 0xc1, 0x51, 0x94,
|
||||
0xc8, 0x09, 0xc8, 0x06, 0xc9, 0x07, 0xc6, 0x06,
|
||||
0xc1, 0x09, 0x9a, 0x06, 0x11, 0x02, 0x09, 0x02,
|
||||
0xc8, 0x17, 0x08, 0x00, 0x01, 0xda, 0x7a, 0xc1,
|
||||
0x51, 0x94, 0xe7, 0x05, 0x00, 0xc0, 0x97, 0xcf,
|
||||
0xe7, 0x57, 0x00, 0x00, 0x76, 0x06, 0x97, 0xc0,
|
||||
0x9f, 0xaf, 0x04, 0x00, 0xe7, 0x09, 0xbe, 0x06,
|
||||
0xba, 0x06, 0xe7, 0x57, 0xff, 0xff, 0xba, 0x06,
|
||||
0x04, 0xc1, 0xe7, 0x07, 0x10, 0x0b, 0xb8, 0x06,
|
||||
0x97, 0xcf, 0xe7, 0x17, 0x32, 0x00, 0xba, 0x06,
|
||||
0xe7, 0x67, 0xff, 0x07, 0xba, 0x06, 0xe7, 0x07,
|
||||
0x46, 0x0b, 0xb8, 0x06, 0x97, 0xcf, 0xe7, 0x57,
|
||||
0x00, 0x00, 0xc0, 0x06, 0x23, 0xc0, 0xe7, 0x07,
|
||||
0x04, 0x00, 0x90, 0xc0, 0xe7, 0x07, 0x00, 0x80,
|
||||
0x80, 0xc0, 0xe7, 0x07, 0x00, 0x00, 0x80, 0xc0,
|
||||
0xe7, 0x07, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0x07,
|
||||
0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07,
|
||||
0x00, 0x00, 0xe7, 0x07, 0x00, 0x00, 0x80, 0xc0,
|
||||
0xe7, 0x07, 0x00, 0x80, 0x80, 0xc0, 0xe7, 0x07,
|
||||
0x00, 0x80, 0x40, 0xc0, 0xc0, 0x07, 0x00, 0x00,
|
||||
0xe7, 0x07, 0x00, 0x00, 0x40, 0xc0, 0xe7, 0x07,
|
||||
0x00, 0x00, 0x80, 0xc0, 0xe7, 0x07, 0x04, 0x00,
|
||||
0x90, 0xc0, 0xe7, 0x07, 0x00, 0x02, 0x40, 0xc0,
|
||||
0xe7, 0x07, 0x0c, 0x02, 0x40, 0xc0, 0xe7, 0x07,
|
||||
0x00, 0x00, 0xc0, 0x06, 0xe7, 0x07, 0x00, 0x00,
|
||||
0xb8, 0x06, 0xe7, 0x07, 0x00, 0x00, 0xd2, 0x06,
|
||||
0xd7, 0x09, 0x00, 0xc0, 0xc1, 0xdf, 0x9f, 0xaf,
|
||||
0x34, 0x02, 0xe7, 0x05, 0x00, 0xc0, 0x9f, 0xaf,
|
||||
0xc4, 0x01, 0x97, 0xcf, 0xd7, 0x09, 0x00, 0xc0,
|
||||
0x17, 0x00, 0x17, 0x02, 0x97, 0x02, 0xe7, 0x57,
|
||||
0x00, 0x00, 0xa8, 0x06, 0x06, 0xc0, 0xc0, 0x09,
|
||||
0x92, 0xc0, 0xc0, 0x77, 0x09, 0x02, 0x9f, 0xc1,
|
||||
0x5c, 0x05, 0x9f, 0xcf, 0x32, 0x06, 0xd7, 0x09,
|
||||
0x0e, 0xc0, 0xe7, 0x07, 0x00, 0x00, 0x0e, 0xc0,
|
||||
0x9f, 0xaf, 0x02, 0x0c, 0xe7, 0x05, 0x0e, 0xc0,
|
||||
0x97, 0xcf, 0xd7, 0x09, 0x00, 0xc0, 0x17, 0x02,
|
||||
0xc8, 0x09, 0xb0, 0xc0, 0xe7, 0x67, 0xfe, 0x7f,
|
||||
0xb0, 0xc0, 0xc8, 0x77, 0x00, 0x20, 0x9f, 0xc1,
|
||||
0x64, 0xeb, 0xe7, 0x57, 0x00, 0x00, 0xc8, 0x02,
|
||||
0x9f, 0xc1, 0x80, 0xeb, 0xc8, 0x99, 0xca, 0x02,
|
||||
0xc8, 0x67, 0x04, 0x00, 0x9f, 0xc1, 0x96, 0xeb,
|
||||
0x9f, 0xcf, 0x4c, 0xeb, 0xe7, 0x07, 0x00, 0x00,
|
||||
0xa6, 0xc0, 0xe7, 0x09, 0xb0, 0xc0, 0xc8, 0x02,
|
||||
0xe7, 0x07, 0x03, 0x00, 0xb0, 0xc0, 0x97, 0xcf,
|
||||
0xc0, 0x09, 0xb0, 0x06, 0xc0, 0x37, 0x01, 0x00,
|
||||
0x97, 0xc9, 0xc9, 0x09, 0xb2, 0x06, 0x02, 0x00,
|
||||
0x41, 0x90, 0x48, 0x02, 0xc9, 0x17, 0x06, 0x00,
|
||||
0x9f, 0xaf, 0x08, 0x04, 0x9f, 0xa2, 0x72, 0x0c,
|
||||
0x02, 0xda, 0x77, 0xc1, 0x41, 0x60, 0x71, 0xc1,
|
||||
0x97, 0xcf, 0x17, 0x02, 0x57, 0x02, 0x43, 0x04,
|
||||
0x21, 0x04, 0xe0, 0x00, 0x43, 0x04, 0x21, 0x04,
|
||||
0xe0, 0x00, 0x43, 0x04, 0x21, 0x04, 0xe0, 0x00,
|
||||
0xc1, 0x07, 0x01, 0x00, 0xc9, 0x05, 0xc8, 0x05,
|
||||
0x97, 0xcf, 0xe7, 0x07, 0x01, 0x00, 0x8e, 0x06,
|
||||
0xc8, 0x07, 0x86, 0x06, 0xe7, 0x07, 0x00, 0x00,
|
||||
0x86, 0x06, 0xe7, 0x07, 0x10, 0x08, 0x88, 0x06,
|
||||
0xe7, 0x07, 0x04, 0x00, 0x8a, 0x06, 0xe7, 0x07,
|
||||
0xbc, 0x0c, 0x8c, 0x06, 0xc1, 0x07, 0x03, 0x80,
|
||||
0x50, 0xaf, 0x97, 0xcf, 0xe7, 0x07, 0x00, 0x00,
|
||||
0x8e, 0x06, 0x97, 0xcf,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
/****************************************************************
|
||||
* kaweth_new_code_fix
|
||||
****************************************************************/
|
||||
static __u8 kaweth_new_code_fix[] =
|
||||
{
|
||||
0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
|
||||
0x02, 0x00, 0x08, 0x00, 0x28, 0x00, 0x2c, 0x00,
|
||||
0x34, 0x00, 0x3c, 0x00, 0x40, 0x00, 0x48, 0x00,
|
||||
0x54, 0x00, 0x58, 0x00, 0x5e, 0x00, 0x64, 0x00,
|
||||
0x68, 0x00, 0x6e, 0x00, 0x6c, 0x00, 0x72, 0x00,
|
||||
0x76, 0x00, 0x7c, 0x00, 0x80, 0x00, 0x86, 0x00,
|
||||
0x8a, 0x00, 0x90, 0x00, 0x94, 0x00, 0x98, 0x00,
|
||||
0x9e, 0x00, 0xa6, 0x00, 0xaa, 0x00, 0xb0, 0x00,
|
||||
0xb4, 0x00, 0xb8, 0x00, 0xc0, 0x00, 0xc6, 0x00,
|
||||
0xca, 0x00, 0xd0, 0x00, 0xd4, 0x00, 0xd8, 0x00,
|
||||
0xe0, 0x00, 0xde, 0x00, 0xe8, 0x00, 0xf0, 0x00,
|
||||
0xfc, 0x00, 0x04, 0x01, 0x0a, 0x01, 0x18, 0x01,
|
||||
0x22, 0x01, 0x28, 0x01, 0x3a, 0x01, 0x3e, 0x01,
|
||||
0x7e, 0x01, 0x98, 0x01, 0x9c, 0x01, 0xa2, 0x01,
|
||||
0xac, 0x01, 0xb2, 0x01, 0xba, 0x01, 0xc0, 0x01,
|
||||
0xc8, 0x01, 0xd0, 0x01, 0xd6, 0x01, 0xf4, 0x01,
|
||||
0xfc, 0x01, 0x08, 0x02, 0x16, 0x02, 0x1a, 0x02,
|
||||
0x22, 0x02, 0x2a, 0x02, 0x2e, 0x02, 0x3e, 0x02,
|
||||
0x44, 0x02, 0x4a, 0x02, 0x50, 0x02, 0x64, 0x02,
|
||||
0x62, 0x02, 0x6c, 0x02, 0x72, 0x02, 0x86, 0x02,
|
||||
0x8c, 0x02, 0x90, 0x02, 0x9e, 0x02, 0xbc, 0x02,
|
||||
0xd0, 0x02, 0xd8, 0x02, 0xdc, 0x02, 0xe0, 0x02,
|
||||
0xe8, 0x02, 0xe6, 0x02, 0xf4, 0x02, 0xfe, 0x02,
|
||||
0x04, 0x03, 0x0c, 0x03, 0x28, 0x03, 0x7c, 0x03,
|
||||
0x90, 0x03, 0x94, 0x03, 0x9c, 0x03, 0xa2, 0x03,
|
||||
0xc0, 0x03, 0xd0, 0x03, 0xd4, 0x03, 0xee, 0x03,
|
||||
0xfa, 0x03, 0xfe, 0x03, 0x2e, 0x04, 0x32, 0x04,
|
||||
0x3c, 0x04, 0x40, 0x04, 0x4e, 0x04, 0x76, 0x04,
|
||||
0x7c, 0x04, 0x84, 0x04, 0x8a, 0x04, 0x8e, 0x04,
|
||||
0xa6, 0x04, 0xb0, 0x04, 0xb8, 0x04, 0xbe, 0x04,
|
||||
0xd2, 0x04, 0xdc, 0x04, 0xee, 0x04, 0x10, 0x05,
|
||||
0x1a, 0x05, 0x24, 0x05, 0x2a, 0x05, 0x36, 0x05,
|
||||
0x34, 0x05, 0x3c, 0x05, 0x42, 0x05, 0x64, 0x05,
|
||||
0x6a, 0x05, 0x6e, 0x05, 0x86, 0x05, 0x22, 0x06,
|
||||
0x26, 0x06, 0x2c, 0x06, 0x30, 0x06, 0x42, 0x06,
|
||||
0x4a, 0x06, 0x4e, 0x06, 0x56, 0x06, 0x54, 0x06,
|
||||
0x5a, 0x06, 0x60, 0x06, 0x66, 0x06, 0xe8, 0x06,
|
||||
0xee, 0x06, 0xf4, 0x06, 0x16, 0x07, 0x26, 0x07,
|
||||
0x2c, 0x07, 0x32, 0x07, 0x36, 0x07, 0x3a, 0x07,
|
||||
0x3e, 0x07, 0x52, 0x07, 0x56, 0x07, 0x5a, 0x07,
|
||||
0x64, 0x07, 0x76, 0x07, 0x7a, 0x07, 0x80, 0x07,
|
||||
0x84, 0x07, 0x8a, 0x07, 0x9e, 0x07, 0xa2, 0x07,
|
||||
0xda, 0x07, 0xde, 0x07, 0xe2, 0x07, 0xe6, 0x07,
|
||||
0xea, 0x07, 0xee, 0x07, 0xf2, 0x07, 0xf6, 0x07,
|
||||
0x0e, 0x08, 0x16, 0x08, 0x18, 0x08, 0x1a, 0x08,
|
||||
0x1c, 0x08, 0x1e, 0x08, 0x20, 0x08, 0x22, 0x08,
|
||||
0x24, 0x08, 0x26, 0x08, 0x28, 0x08, 0x2a, 0x08,
|
||||
0x2c, 0x08, 0x2e, 0x08, 0x32, 0x08, 0x3a, 0x08,
|
||||
0x46, 0x08, 0x4e, 0x08, 0x54, 0x08, 0x5e, 0x08,
|
||||
0x78, 0x08, 0x7e, 0x08, 0x82, 0x08, 0x86, 0x08,
|
||||
0x8c, 0x08, 0x90, 0x08, 0x98, 0x08, 0x9e, 0x08,
|
||||
0xa4, 0x08, 0xaa, 0x08, 0xb0, 0x08, 0xae, 0x08,
|
||||
0xb4, 0x08, 0xbe, 0x08, 0xc4, 0x08, 0xc2, 0x08,
|
||||
0xca, 0x08, 0xc8, 0x08, 0xd4, 0x08, 0xe4, 0x08,
|
||||
0xe8, 0x08, 0xf6, 0x08, 0x14, 0x09, 0x12, 0x09,
|
||||
0x1a, 0x09, 0x20, 0x09, 0x26, 0x09, 0x24, 0x09,
|
||||
0x2a, 0x09, 0x3e, 0x09, 0x4c, 0x09, 0x56, 0x09,
|
||||
0x70, 0x09, 0x74, 0x09, 0x78, 0x09, 0x7e, 0x09,
|
||||
0x7c, 0x09, 0x82, 0x09, 0x98, 0x09, 0x9c, 0x09,
|
||||
0xa0, 0x09, 0xa6, 0x09, 0xb8, 0x09, 0xdc, 0x09,
|
||||
0xe8, 0x09, 0xec, 0x09, 0xfc, 0x09, 0x12, 0x0a,
|
||||
0x18, 0x0a, 0x1e, 0x0a, 0x42, 0x0a, 0x46, 0x0a,
|
||||
0x4e, 0x0a, 0x54, 0x0a, 0x5a, 0x0a, 0x5e, 0x0a,
|
||||
0x68, 0x0a, 0x6e, 0x0a, 0x72, 0x0a, 0x78, 0x0a,
|
||||
0x76, 0x0a, 0x7c, 0x0a, 0x80, 0x0a, 0x84, 0x0a,
|
||||
0x94, 0x0a, 0xa4, 0x0a, 0xb8, 0x0a, 0xbe, 0x0a,
|
||||
0xbc, 0x0a, 0xc2, 0x0a, 0xc8, 0x0a, 0xc6, 0x0a,
|
||||
0xcc, 0x0a, 0xd0, 0x0a, 0xd4, 0x0a, 0xd8, 0x0a,
|
||||
0xdc, 0x0a, 0xe0, 0x0a, 0xf2, 0x0a, 0xf6, 0x0a,
|
||||
0xfa, 0x0a, 0x14, 0x0b, 0x1a, 0x0b, 0x20, 0x0b,
|
||||
0x1e, 0x0b, 0x26, 0x0b, 0x2e, 0x0b, 0x2c, 0x0b,
|
||||
0x36, 0x0b, 0x3c, 0x0b, 0x42, 0x0b, 0x40, 0x0b,
|
||||
0x4a, 0x0b, 0xaa, 0x0b, 0xb0, 0x0b, 0xb6, 0x0b,
|
||||
0xc0, 0x0b, 0xc8, 0x0b, 0xda, 0x0b, 0xe8, 0x0b,
|
||||
0xec, 0x0b, 0xfa, 0x0b, 0x4a, 0x0c, 0x54, 0x0c,
|
||||
0x62, 0x0c, 0x66, 0x0c, 0x96, 0x0c, 0x9a, 0x0c,
|
||||
0xa0, 0x0c, 0xa6, 0x0c, 0xa4, 0x0c, 0xac, 0x0c,
|
||||
0xb2, 0x0c, 0xb0, 0x0c, 0xc0, 0x0c,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
static const int len_kaweth_trigger_code = sizeof(kaweth_trigger_code);
|
||||
static const int len_kaweth_trigger_code_fix = sizeof(kaweth_trigger_code_fix);
|
||||
static const int len_kaweth_new_code = sizeof(kaweth_new_code);
|
||||
static const int len_kaweth_new_code_fix = sizeof(kaweth_new_code_fix);
|
1408
drivers/usb/net/pegasus.c
Ficheiro normal
1408
drivers/usb/net/pegasus.c
Ficheiro normal
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Carregar diff
298
drivers/usb/net/pegasus.h
Ficheiro normal
298
drivers/usb/net/pegasus.h
Ficheiro normal
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Petko Manolov - Petkan (petkan@users.sourceforge.net)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PEGASUS_DEV
|
||||
|
||||
#define PEGASUS_II 0x80000000
|
||||
#define HAS_HOME_PNA 0x40000000
|
||||
|
||||
#define PEGASUS_MTU 1536
|
||||
#define RX_SKBS 4
|
||||
|
||||
#define EPROM_WRITE 0x01
|
||||
#define EPROM_READ 0x02
|
||||
#define EPROM_DONE 0x04
|
||||
#define EPROM_WR_ENABLE 0x10
|
||||
#define EPROM_LOAD 0x20
|
||||
|
||||
#define PHY_DONE 0x80
|
||||
#define PHY_READ 0x40
|
||||
#define PHY_WRITE 0x20
|
||||
#define DEFAULT_GPIO_RESET 0x24
|
||||
#define LINKSYS_GPIO_RESET 0x24
|
||||
#define DEFAULT_GPIO_SET 0x26
|
||||
|
||||
#define PEGASUS_PRESENT 0x00000001
|
||||
#define PEGASUS_TX_BUSY 0x00000004
|
||||
#define PEGASUS_RX_BUSY 0x00000008
|
||||
#define CTRL_URB_RUNNING 0x00000010
|
||||
#define CTRL_URB_SLEEP 0x00000020
|
||||
#define PEGASUS_UNPLUG 0x00000040
|
||||
#define PEGASUS_RX_URB_FAIL 0x00000080
|
||||
#define ETH_REGS_CHANGE 0x40000000
|
||||
#define ETH_REGS_CHANGED 0x80000000
|
||||
|
||||
#define RX_MULTICAST 2
|
||||
#define RX_PROMISCUOUS 4
|
||||
|
||||
#define REG_TIMEOUT (HZ)
|
||||
#define PEGASUS_TX_TIMEOUT (HZ*10)
|
||||
|
||||
#define TX_UNDERRUN 0x80
|
||||
#define EXCESSIVE_COL 0x40
|
||||
#define LATE_COL 0x20
|
||||
#define NO_CARRIER 0x10
|
||||
#define LOSS_CARRIER 0x08
|
||||
#define JABBER_TIMEOUT 0x04
|
||||
|
||||
#define LINK_STATUS 0x01
|
||||
|
||||
#define PEGASUS_REQT_READ 0xc0
|
||||
#define PEGASUS_REQT_WRITE 0x40
|
||||
#define PEGASUS_REQ_GET_REGS 0xf0
|
||||
#define PEGASUS_REQ_SET_REGS 0xf1
|
||||
#define PEGASUS_REQ_SET_REG PEGASUS_REQ_SET_REGS
|
||||
|
||||
enum pegasus_registers {
|
||||
EthCtrl0 = 0,
|
||||
EthCtrl1 = 1,
|
||||
EthCtrl2 = 2,
|
||||
EthID = 0x10,
|
||||
Reg1d = 0x1d,
|
||||
EpromOffset = 0x20,
|
||||
EpromData = 0x21, /* 0x21 low, 0x22 high byte */
|
||||
EpromCtrl = 0x23,
|
||||
PhyAddr = 0x25,
|
||||
PhyData = 0x26, /* 0x26 low, 0x27 high byte */
|
||||
PhyCtrl = 0x28,
|
||||
UsbStst = 0x2a,
|
||||
EthTxStat0 = 0x2b,
|
||||
EthTxStat1 = 0x2c,
|
||||
EthRxStat = 0x2d,
|
||||
WakeupControl = 0x78,
|
||||
Reg7b = 0x7b,
|
||||
Gpio0 = 0x7e,
|
||||
Gpio1 = 0x7f,
|
||||
Reg81 = 0x81,
|
||||
};
|
||||
|
||||
|
||||
typedef struct pegasus {
|
||||
struct usb_device *usb;
|
||||
struct usb_interface *intf;
|
||||
struct net_device *net;
|
||||
struct net_device_stats stats;
|
||||
struct mii_if_info mii;
|
||||
unsigned flags;
|
||||
unsigned features;
|
||||
u32 msg_enable;
|
||||
u32 wolopts;
|
||||
int dev_index;
|
||||
int intr_interval;
|
||||
struct tasklet_struct rx_tl;
|
||||
struct work_struct carrier_check;
|
||||
struct urb *ctrl_urb, *rx_urb, *tx_urb, *intr_urb;
|
||||
struct sk_buff *rx_pool[RX_SKBS];
|
||||
struct sk_buff *rx_skb;
|
||||
struct usb_ctrlrequest dr;
|
||||
wait_queue_head_t ctrl_wait;
|
||||
spinlock_t rx_pool_lock;
|
||||
int chip;
|
||||
unsigned char intr_buff[8];
|
||||
__u8 tx_buff[PEGASUS_MTU];
|
||||
__u8 eth_regs[4];
|
||||
__u8 phy;
|
||||
__u8 gpio_res;
|
||||
} pegasus_t;
|
||||
|
||||
|
||||
struct usb_eth_dev {
|
||||
char *name;
|
||||
__u16 vendor;
|
||||
__u16 device;
|
||||
__u32 private; /* LSB is gpio reset value */
|
||||
};
|
||||
|
||||
#define VENDOR_3COM 0x0506
|
||||
#define VENDOR_ABOCOM 0x07b8
|
||||
#define VENDOR_ACCTON 0x083a
|
||||
#define VENDOR_ADMTEK 0x07a6
|
||||
#define VENDOR_AEILAB 0x3334
|
||||
#define VENDOR_ALLIEDTEL 0x07c9
|
||||
#define VENDOR_ATEN 0x0557
|
||||
#define VENDOR_BELKIN 0x050d
|
||||
#define VENDOR_BILLIONTON 0x08dd
|
||||
#define VENDOR_COMPAQ 0x049f
|
||||
#define VENDOR_COREGA 0x07aa
|
||||
#define VENDOR_DLINK 0x2001
|
||||
#define VENDOR_ELCON 0x0db7
|
||||
#define VENDOR_ELSA 0x05cc
|
||||
#define VENDOR_GIGABYTE 0x1044
|
||||
#define VENDOR_HAWKING 0x0e66
|
||||
#define VENDOR_HP 0x03f0
|
||||
#define VENDOR_IODATA 0x04bb
|
||||
#define VENDOR_KINGSTON 0x0951
|
||||
#define VENDOR_LANEED 0x056e
|
||||
#define VENDOR_LINKSYS 0x066b
|
||||
#define VENDOR_MELCO 0x0411
|
||||
#define VENDOR_MICROSOFT 0x045e
|
||||
#define VENDOR_MOBILITY 0x1342
|
||||
#define VENDOR_NETGEAR 0x0846
|
||||
#define VENDOR_OCT 0x0b39
|
||||
#define VENDOR_SMARTBRIDGES 0x08d1
|
||||
#define VENDOR_SMC 0x0707
|
||||
#define VENDOR_SOHOWARE 0x15e8
|
||||
#define VENDOR_SIEMENS 0x067c
|
||||
|
||||
|
||||
#else /* PEGASUS_DEV */
|
||||
|
||||
PEGASUS_DEV( "3Com USB Ethernet 3C460B", VENDOR_3COM, 0x4601,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "ATEN USB Ethernet UC-110T", VENDOR_ATEN, 0x2007,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x110c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4104,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4004,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "USB HPNA/Ethernet", VENDOR_ABOCOM, 0x4007,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4102,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x4002,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400b,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "ADMtek ADM8511 \"Pegasus II\" USB Ethernet",
|
||||
VENDOR_ADMTEK, 0x8511,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "ADMtek ADM8513 \"Pegasus II\" USB Ethernet",
|
||||
VENDOR_ADMTEK, 0x8513,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "ADMtek ADM8515 \"Pegasus II\" USB-2.0 Ethernet",
|
||||
VENDOR_ADMTEK, 0x8515,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "ADMtek AN986 \"Pegasus\" USB Ethernet (evaluation board)",
|
||||
VENDOR_ADMTEK, 0x0986,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "AN986A USB MAC", VENDOR_ADMTEK, 1986,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "iPAQ Networking 10/100 USB", VENDOR_COMPAQ, 0x8511,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Billionton USBEL-100", VENDOR_BILLIONTON, 0x0988,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "Billionton USBE-100", VENDOR_BILLIONTON, 0x8511,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Corega FEter USB-TX", VENDOR_COREGA, 0x0004,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "Corega FEter USB-TXS", VENDOR_COREGA, 0x000d,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4001,
|
||||
LINKSYS_GPIO_RESET )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4002,
|
||||
LINKSYS_GPIO_RESET )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x4102,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x400b,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX", VENDOR_DLINK, 0x200c,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "D-Link DSB-650TX(PNA)", VENDOR_DLINK, 0x4003,
|
||||
DEFAULT_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "D-Link DSB-650", VENDOR_DLINK, 0xabc1,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "GOLDPFEIL USB Adapter", VENDOR_ELCON, 0x0002,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "EasiDock Ethernet", VENDOR_MOBILITY, 0x0304,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "Elsa Micolink USB2Ethernet", VENDOR_ELSA, 0x3000,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
|
||||
DEFAULT_GPIO_RESET)
|
||||
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x200c,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x2202,
|
||||
LINKSYS_GPIO_RESET )
|
||||
PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2203,
|
||||
LINKSYS_GPIO_RESET )
|
||||
PEGASUS_DEV( "Linksys USB100TX", VENDOR_LINKSYS, 0x2204,
|
||||
LINKSYS_GPIO_RESET | HAS_HOME_PNA )
|
||||
PEGASUS_DEV( "Linksys USB10T Ethernet Adapter", VENDOR_LINKSYS, 0x2206,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II)
|
||||
PEGASUS_DEV( "Linksys USB USB100TX", VENDOR_LINKSYS, 0x400b,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Linksys USB10TX", VENDOR_LINKSYS, 0x200c,
|
||||
LINKSYS_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0001,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "OCT Inc.", VENDOR_OCT, 0x0109,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "OCT USB TO Ethernet", VENDOR_OCT, 0x0901,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "smartNIC 2 PnP Adapter", VENDOR_SMARTBRIDGES, 0x0003,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "SMC 202 USB Ethernet", VENDOR_SMC, 0x0200,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "SMC 2206 USB Ethernet", VENDOR_SMC, 0x0201,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II)
|
||||
PEGASUS_DEV( "SOHOware NUB100 Ethernet", VENDOR_SOHOWARE, 0x9100,
|
||||
DEFAULT_GPIO_RESET )
|
||||
PEGASUS_DEV( "SOHOware NUB110 Ethernet", VENDOR_SOHOWARE, 0x9110,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_SIEMENS, 0x1001,
|
||||
DEFAULT_GPIO_RESET | PEGASUS_II )
|
||||
|
||||
|
||||
#endif /* PEGASUS_DEV */
|
942
drivers/usb/net/rtl8150.c
Ficheiro normal
942
drivers/usb/net/rtl8150.c
Ficheiro normal
@@ -0,0 +1,942 @@
|
||||
/*
|
||||
* Copyright (c) 2002 Petko Manolov (petkan@users.sourceforge.net)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/usb.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
/* Version Information */
|
||||
#define DRIVER_VERSION "v0.6.2 (2004/08/27)"
|
||||
#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
|
||||
#define DRIVER_DESC "rtl8150 based usb-ethernet driver"
|
||||
|
||||
#define IDR 0x0120
|
||||
#define MAR 0x0126
|
||||
#define CR 0x012e
|
||||
#define TCR 0x012f
|
||||
#define RCR 0x0130
|
||||
#define TSR 0x0132
|
||||
#define RSR 0x0133
|
||||
#define CON0 0x0135
|
||||
#define CON1 0x0136
|
||||
#define MSR 0x0137
|
||||
#define PHYADD 0x0138
|
||||
#define PHYDAT 0x0139
|
||||
#define PHYCNT 0x013b
|
||||
#define GPPC 0x013d
|
||||
#define BMCR 0x0140
|
||||
#define BMSR 0x0142
|
||||
#define ANAR 0x0144
|
||||
#define ANLP 0x0146
|
||||
#define AER 0x0148
|
||||
#define CSCR 0x014C /* This one has the link status */
|
||||
#define CSCR_LINK_STATUS (1 << 3)
|
||||
|
||||
#define IDR_EEPROM 0x1202
|
||||
|
||||
#define PHY_READ 0
|
||||
#define PHY_WRITE 0x20
|
||||
#define PHY_GO 0x40
|
||||
|
||||
#define MII_TIMEOUT 10
|
||||
#define INTBUFSIZE 8
|
||||
|
||||
#define RTL8150_REQT_READ 0xc0
|
||||
#define RTL8150_REQT_WRITE 0x40
|
||||
#define RTL8150_REQ_GET_REGS 0x05
|
||||
#define RTL8150_REQ_SET_REGS 0x05
|
||||
|
||||
|
||||
/* Transmit status register errors */
|
||||
#define TSR_ECOL (1<<5)
|
||||
#define TSR_LCOL (1<<4)
|
||||
#define TSR_LOSS_CRS (1<<3)
|
||||
#define TSR_JBR (1<<2)
|
||||
#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
|
||||
/* Receive status register errors */
|
||||
#define RSR_CRC (1<<2)
|
||||
#define RSR_FAE (1<<1)
|
||||
#define RSR_ERRORS (RSR_CRC | RSR_FAE)
|
||||
|
||||
/* Media status register definitions */
|
||||
#define MSR_DUPLEX (1<<4)
|
||||
#define MSR_SPEED (1<<3)
|
||||
#define MSR_LINK (1<<2)
|
||||
|
||||
/* Interrupt pipe data */
|
||||
#define INT_TSR 0x00
|
||||
#define INT_RSR 0x01
|
||||
#define INT_MSR 0x02
|
||||
#define INT_WAKSR 0x03
|
||||
#define INT_TXOK_CNT 0x04
|
||||
#define INT_RXLOST_CNT 0x05
|
||||
#define INT_CRERR_CNT 0x06
|
||||
#define INT_COL_CNT 0x07
|
||||
|
||||
/* Transmit status register errors */
|
||||
#define TSR_ECOL (1<<5)
|
||||
#define TSR_LCOL (1<<4)
|
||||
#define TSR_LOSS_CRS (1<<3)
|
||||
#define TSR_JBR (1<<2)
|
||||
#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
|
||||
/* Receive status register errors */
|
||||
#define RSR_CRC (1<<2)
|
||||
#define RSR_FAE (1<<1)
|
||||
#define RSR_ERRORS (RSR_CRC | RSR_FAE)
|
||||
|
||||
/* Media status register definitions */
|
||||
#define MSR_DUPLEX (1<<4)
|
||||
#define MSR_SPEED (1<<3)
|
||||
#define MSR_LINK (1<<2)
|
||||
|
||||
/* Interrupt pipe data */
|
||||
#define INT_TSR 0x00
|
||||
#define INT_RSR 0x01
|
||||
#define INT_MSR 0x02
|
||||
#define INT_WAKSR 0x03
|
||||
#define INT_TXOK_CNT 0x04
|
||||
#define INT_RXLOST_CNT 0x05
|
||||
#define INT_CRERR_CNT 0x06
|
||||
#define INT_COL_CNT 0x07
|
||||
|
||||
|
||||
#define RTL8150_MTU 1540
|
||||
#define RTL8150_TX_TIMEOUT (HZ)
|
||||
#define RX_SKB_POOL_SIZE 4
|
||||
|
||||
/* rtl8150 flags */
|
||||
#define RTL8150_HW_CRC 0
|
||||
#define RX_REG_SET 1
|
||||
#define RTL8150_UNPLUG 2
|
||||
#define RX_URB_FAIL 3
|
||||
|
||||
/* Define these values to match your device */
|
||||
#define VENDOR_ID_REALTEK 0x0bda
|
||||
#define VENDOR_ID_MELCO 0x0411
|
||||
#define VENDOR_ID_MICRONET 0x3980
|
||||
#define VENDOR_ID_LONGSHINE 0x07b8
|
||||
|
||||
#define PRODUCT_ID_RTL8150 0x8150
|
||||
#define PRODUCT_ID_LUAKTX 0x0012
|
||||
#define PRODUCT_ID_LCS8138TX 0x401a
|
||||
#define PRODUCT_ID_SP128AR 0x0003
|
||||
|
||||
#undef EEPROM_WRITE
|
||||
|
||||
/* table of devices that work with this driver */
|
||||
static struct usb_device_id rtl8150_table[] = {
|
||||
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
|
||||
{USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
|
||||
{USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
|
||||
{USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
|
||||
{}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(usb, rtl8150_table);
|
||||
|
||||
struct rtl8150 {
|
||||
unsigned long flags;
|
||||
struct usb_device *udev;
|
||||
struct tasklet_struct tl;
|
||||
struct net_device_stats stats;
|
||||
struct net_device *netdev;
|
||||
struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
|
||||
struct sk_buff *tx_skb, *rx_skb;
|
||||
struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
|
||||
spinlock_t rx_pool_lock;
|
||||
struct usb_ctrlrequest dr;
|
||||
int intr_interval;
|
||||
__le16 rx_creg;
|
||||
u8 *intr_buff;
|
||||
u8 phy;
|
||||
};
|
||||
|
||||
typedef struct rtl8150 rtl8150_t;
|
||||
|
||||
static unsigned long multicast_filter_limit = 32;
|
||||
|
||||
static void fill_skb_pool(rtl8150_t *);
|
||||
static void free_skb_pool(rtl8150_t *);
|
||||
static inline struct sk_buff *pull_skb(rtl8150_t *);
|
||||
static void rtl8150_disconnect(struct usb_interface *intf);
|
||||
static int rtl8150_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id);
|
||||
|
||||
static const char driver_name [] = "rtl8150";
|
||||
|
||||
static struct usb_driver rtl8150_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = driver_name,
|
||||
.probe = rtl8150_probe,
|
||||
.disconnect = rtl8150_disconnect,
|
||||
.id_table = rtl8150_table,
|
||||
};
|
||||
|
||||
/*
|
||||
**
|
||||
** device related part of the code
|
||||
**
|
||||
*/
|
||||
static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
|
||||
{
|
||||
return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
|
||||
RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
|
||||
indx, 0, data, size, 500);
|
||||
}
|
||||
|
||||
static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
|
||||
{
|
||||
return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
|
||||
RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
|
||||
indx, 0, data, size, 500);
|
||||
}
|
||||
|
||||
static void ctrl_callback(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
rtl8150_t *dev;
|
||||
|
||||
switch (urb->status) {
|
||||
case 0:
|
||||
break;
|
||||
case -EINPROGRESS:
|
||||
break;
|
||||
case -ENOENT:
|
||||
break;
|
||||
default:
|
||||
warn("ctrl urb status %d", urb->status);
|
||||
}
|
||||
dev = urb->context;
|
||||
clear_bit(RX_REG_SET, &dev->flags);
|
||||
}
|
||||
|
||||
static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (test_bit(RX_REG_SET, &dev->flags))
|
||||
return -EAGAIN;
|
||||
|
||||
dev->dr.bRequestType = RTL8150_REQT_WRITE;
|
||||
dev->dr.bRequest = RTL8150_REQ_SET_REGS;
|
||||
dev->dr.wValue = cpu_to_le16(indx);
|
||||
dev->dr.wIndex = 0;
|
||||
dev->dr.wLength = cpu_to_le16(size);
|
||||
dev->ctrl_urb->transfer_buffer_length = size;
|
||||
usb_fill_control_urb(dev->ctrl_urb, dev->udev,
|
||||
usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr,
|
||||
&dev->rx_creg, size, ctrl_callback, dev);
|
||||
if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC)))
|
||||
err("control request submission failed: %d", ret);
|
||||
else
|
||||
set_bit(RX_REG_SET, &dev->flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
|
||||
{
|
||||
int i;
|
||||
u8 data[3], tmp;
|
||||
|
||||
data[0] = phy;
|
||||
data[1] = data[2] = 0;
|
||||
tmp = indx | PHY_READ | PHY_GO;
|
||||
i = 0;
|
||||
|
||||
set_registers(dev, PHYADD, sizeof(data), data);
|
||||
set_registers(dev, PHYCNT, 1, &tmp);
|
||||
do {
|
||||
get_registers(dev, PHYCNT, 1, data);
|
||||
} while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
|
||||
|
||||
if (i < MII_TIMEOUT) {
|
||||
get_registers(dev, PHYDAT, 2, data);
|
||||
*reg = data[0] | (data[1] << 8);
|
||||
return 0;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
|
||||
{
|
||||
int i;
|
||||
u8 data[3], tmp;
|
||||
|
||||
data[0] = phy;
|
||||
*(data + 1) = cpu_to_le16p(®);
|
||||
tmp = indx | PHY_WRITE | PHY_GO;
|
||||
i = 0;
|
||||
|
||||
set_registers(dev, PHYADD, sizeof(data), data);
|
||||
set_registers(dev, PHYCNT, 1, &tmp);
|
||||
do {
|
||||
get_registers(dev, PHYCNT, 1, data);
|
||||
} while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));
|
||||
|
||||
if (i < MII_TIMEOUT)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline void set_ethernet_addr(rtl8150_t * dev)
|
||||
{
|
||||
u8 node_id[6];
|
||||
|
||||
get_registers(dev, IDR, sizeof(node_id), node_id);
|
||||
memcpy(dev->netdev->dev_addr, node_id, sizeof(node_id));
|
||||
}
|
||||
|
||||
static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
|
||||
{
|
||||
struct sockaddr *addr = p;
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
int i;
|
||||
|
||||
if (netif_running(netdev))
|
||||
return -EBUSY;
|
||||
|
||||
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
|
||||
dbg("%s: Setting MAC address to ", netdev->name);
|
||||
for (i = 0; i < 5; i++)
|
||||
dbg("%02X:", netdev->dev_addr[i]);
|
||||
dbg("%02X\n", netdev->dev_addr[i]);
|
||||
/* Set the IDR registers. */
|
||||
set_registers(dev, IDR, sizeof(netdev->dev_addr), netdev->dev_addr);
|
||||
#ifdef EEPROM_WRITE
|
||||
{
|
||||
u8 cr;
|
||||
/* Get the CR contents. */
|
||||
get_registers(dev, CR, 1, &cr);
|
||||
/* Set the WEPROM bit (eeprom write enable). */
|
||||
cr |= 0x20;
|
||||
set_registers(dev, CR, 1, &cr);
|
||||
/* Write the MAC address into eeprom. Eeprom writes must be word-sized,
|
||||
so we need to split them up. */
|
||||
for (i = 0; i * 2 < netdev->addr_len; i++) {
|
||||
set_registers(dev, IDR_EEPROM + (i * 2), 2,
|
||||
netdev->dev_addr + (i * 2));
|
||||
}
|
||||
/* Clear the WEPROM bit (preventing accidental eeprom writes). */
|
||||
cr &= 0xdf;
|
||||
set_registers(dev, CR, 1, &cr);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl8150_reset(rtl8150_t * dev)
|
||||
{
|
||||
u8 data = 0x10;
|
||||
int i = HZ;
|
||||
|
||||
set_registers(dev, CR, 1, &data);
|
||||
do {
|
||||
get_registers(dev, CR, 1, &data);
|
||||
} while ((data & 0x10) && --i);
|
||||
|
||||
return (i > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int alloc_all_urbs(rtl8150_t * dev)
|
||||
{
|
||||
dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!dev->rx_urb)
|
||||
return 0;
|
||||
dev->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!dev->tx_urb) {
|
||||
usb_free_urb(dev->rx_urb);
|
||||
return 0;
|
||||
}
|
||||
dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!dev->intr_urb) {
|
||||
usb_free_urb(dev->rx_urb);
|
||||
usb_free_urb(dev->tx_urb);
|
||||
return 0;
|
||||
}
|
||||
dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!dev->intr_urb) {
|
||||
usb_free_urb(dev->rx_urb);
|
||||
usb_free_urb(dev->tx_urb);
|
||||
usb_free_urb(dev->intr_urb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void free_all_urbs(rtl8150_t * dev)
|
||||
{
|
||||
usb_free_urb(dev->rx_urb);
|
||||
usb_free_urb(dev->tx_urb);
|
||||
usb_free_urb(dev->intr_urb);
|
||||
usb_free_urb(dev->ctrl_urb);
|
||||
}
|
||||
|
||||
static void unlink_all_urbs(rtl8150_t * dev)
|
||||
{
|
||||
usb_kill_urb(dev->rx_urb);
|
||||
usb_kill_urb(dev->tx_urb);
|
||||
usb_kill_urb(dev->intr_urb);
|
||||
usb_kill_urb(dev->ctrl_urb);
|
||||
}
|
||||
|
||||
static inline struct sk_buff *pull_skb(rtl8150_t *dev)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
|
||||
if (dev->rx_skb_pool[i]) {
|
||||
skb = dev->rx_skb_pool[i];
|
||||
dev->rx_skb_pool[i] = NULL;
|
||||
return skb;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
rtl8150_t *dev;
|
||||
unsigned pkt_len, res;
|
||||
struct sk_buff *skb;
|
||||
struct net_device *netdev;
|
||||
u16 rx_stat;
|
||||
|
||||
dev = urb->context;
|
||||
if (!dev)
|
||||
return;
|
||||
if (test_bit(RTL8150_UNPLUG, &dev->flags))
|
||||
return;
|
||||
netdev = dev->netdev;
|
||||
if (!netif_device_present(netdev))
|
||||
return;
|
||||
|
||||
switch (urb->status) {
|
||||
case 0:
|
||||
break;
|
||||
case -ENOENT:
|
||||
return; /* the urb is in unlink state */
|
||||
case -ETIMEDOUT:
|
||||
warn("may be reset is needed?..");
|
||||
goto goon;
|
||||
default:
|
||||
warn("Rx status %d", urb->status);
|
||||
goto goon;
|
||||
}
|
||||
|
||||
if (!dev->rx_skb)
|
||||
goto resched;
|
||||
/* protect against short packets (tell me why we got some?!?) */
|
||||
if (urb->actual_length < 4)
|
||||
goto goon;
|
||||
|
||||
res = urb->actual_length;
|
||||
rx_stat = le16_to_cpu(*(__le16 *)(urb->transfer_buffer + res - 4));
|
||||
pkt_len = res - 4;
|
||||
|
||||
skb_put(dev->rx_skb, pkt_len);
|
||||
dev->rx_skb->protocol = eth_type_trans(dev->rx_skb, netdev);
|
||||
netif_rx(dev->rx_skb);
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += pkt_len;
|
||||
|
||||
spin_lock(&dev->rx_pool_lock);
|
||||
skb = pull_skb(dev);
|
||||
spin_unlock(&dev->rx_pool_lock);
|
||||
if (!skb)
|
||||
goto resched;
|
||||
|
||||
dev->rx_skb = skb;
|
||||
goon:
|
||||
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
||||
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
||||
if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) {
|
||||
set_bit(RX_URB_FAIL, &dev->flags);
|
||||
goto resched;
|
||||
} else {
|
||||
clear_bit(RX_URB_FAIL, &dev->flags);
|
||||
}
|
||||
|
||||
return;
|
||||
resched:
|
||||
tasklet_schedule(&dev->tl);
|
||||
}
|
||||
|
||||
static void rx_fixup(unsigned long data)
|
||||
{
|
||||
rtl8150_t *dev;
|
||||
struct sk_buff *skb;
|
||||
|
||||
dev = (rtl8150_t *)data;
|
||||
|
||||
spin_lock_irq(&dev->rx_pool_lock);
|
||||
fill_skb_pool(dev);
|
||||
spin_unlock_irq(&dev->rx_pool_lock);
|
||||
if (test_bit(RX_URB_FAIL, &dev->flags))
|
||||
if (dev->rx_skb)
|
||||
goto try_again;
|
||||
spin_lock_irq(&dev->rx_pool_lock);
|
||||
skb = pull_skb(dev);
|
||||
spin_unlock_irq(&dev->rx_pool_lock);
|
||||
if (skb == NULL)
|
||||
goto tlsched;
|
||||
dev->rx_skb = skb;
|
||||
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
||||
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
||||
try_again:
|
||||
if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) {
|
||||
set_bit(RX_URB_FAIL, &dev->flags);
|
||||
goto tlsched;
|
||||
} else {
|
||||
clear_bit(RX_URB_FAIL, &dev->flags);
|
||||
}
|
||||
|
||||
return;
|
||||
tlsched:
|
||||
tasklet_schedule(&dev->tl);
|
||||
}
|
||||
|
||||
static void write_bulk_callback(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
rtl8150_t *dev;
|
||||
|
||||
dev = urb->context;
|
||||
if (!dev)
|
||||
return;
|
||||
dev_kfree_skb_irq(dev->tx_skb);
|
||||
if (!netif_device_present(dev->netdev))
|
||||
return;
|
||||
if (urb->status)
|
||||
info("%s: Tx status %d", dev->netdev->name, urb->status);
|
||||
dev->netdev->trans_start = jiffies;
|
||||
netif_wake_queue(dev->netdev);
|
||||
}
|
||||
|
||||
static void intr_callback(struct urb *urb, struct pt_regs *regs)
|
||||
{
|
||||
rtl8150_t *dev;
|
||||
__u8 *d;
|
||||
int status;
|
||||
|
||||
dev = urb->context;
|
||||
if (!dev)
|
||||
return;
|
||||
switch (urb->status) {
|
||||
case 0: /* success */
|
||||
break;
|
||||
case -ECONNRESET: /* unlink */
|
||||
case -ENOENT:
|
||||
case -ESHUTDOWN:
|
||||
return;
|
||||
/* -EPIPE: should clear the halt */
|
||||
default:
|
||||
info("%s: intr status %d", dev->netdev->name, urb->status);
|
||||
goto resubmit;
|
||||
}
|
||||
|
||||
d = urb->transfer_buffer;
|
||||
if (d[0] & TSR_ERRORS) {
|
||||
dev->stats.tx_errors++;
|
||||
if (d[INT_TSR] & (TSR_ECOL | TSR_JBR))
|
||||
dev->stats.tx_aborted_errors++;
|
||||
if (d[INT_TSR] & TSR_LCOL)
|
||||
dev->stats.tx_window_errors++;
|
||||
if (d[INT_TSR] & TSR_LOSS_CRS)
|
||||
dev->stats.tx_carrier_errors++;
|
||||
}
|
||||
/* Report link status changes to the network stack */
|
||||
if ((d[INT_MSR] & MSR_LINK) == 0) {
|
||||
if (netif_carrier_ok(dev->netdev)) {
|
||||
netif_carrier_off(dev->netdev);
|
||||
dbg("%s: LINK LOST\n", __func__);
|
||||
}
|
||||
} else {
|
||||
if (!netif_carrier_ok(dev->netdev)) {
|
||||
netif_carrier_on(dev->netdev);
|
||||
dbg("%s: LINK CAME BACK\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
resubmit:
|
||||
status = usb_submit_urb (urb, SLAB_ATOMIC);
|
||||
if (status)
|
||||
err ("can't resubmit intr, %s-%s/input0, status %d",
|
||||
dev->udev->bus->bus_name,
|
||||
dev->udev->devpath, status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
**
|
||||
** network related part of the code
|
||||
**
|
||||
*/
|
||||
|
||||
static void fill_skb_pool(rtl8150_t *dev)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
|
||||
if (dev->rx_skb_pool[i])
|
||||
continue;
|
||||
skb = dev_alloc_skb(RTL8150_MTU + 2);
|
||||
if (!skb) {
|
||||
return;
|
||||
}
|
||||
skb->dev = dev->netdev;
|
||||
skb_reserve(skb, 2);
|
||||
dev->rx_skb_pool[i] = skb;
|
||||
}
|
||||
}
|
||||
|
||||
static void free_skb_pool(rtl8150_t *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RX_SKB_POOL_SIZE; i++)
|
||||
if (dev->rx_skb_pool[i])
|
||||
dev_kfree_skb(dev->rx_skb_pool[i]);
|
||||
}
|
||||
|
||||
static int enable_net_traffic(rtl8150_t * dev)
|
||||
{
|
||||
u8 cr, tcr, rcr, msr;
|
||||
|
||||
if (!rtl8150_reset(dev)) {
|
||||
warn("%s - device reset failed", __FUNCTION__);
|
||||
}
|
||||
/* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */
|
||||
rcr = 0x9e;
|
||||
dev->rx_creg = cpu_to_le16(rcr);
|
||||
tcr = 0xd8;
|
||||
cr = 0x0c;
|
||||
if (!(rcr & 0x80))
|
||||
set_bit(RTL8150_HW_CRC, &dev->flags);
|
||||
set_registers(dev, RCR, 1, &rcr);
|
||||
set_registers(dev, TCR, 1, &tcr);
|
||||
set_registers(dev, CR, 1, &cr);
|
||||
get_registers(dev, MSR, 1, &msr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void disable_net_traffic(rtl8150_t * dev)
|
||||
{
|
||||
u8 cr;
|
||||
|
||||
get_registers(dev, CR, 1, &cr);
|
||||
cr &= 0xf3;
|
||||
set_registers(dev, CR, 1, &cr);
|
||||
}
|
||||
|
||||
static struct net_device_stats *rtl8150_netdev_stats(struct net_device *dev)
|
||||
{
|
||||
return &((rtl8150_t *)netdev_priv(dev))->stats;
|
||||
}
|
||||
|
||||
static void rtl8150_tx_timeout(struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
warn("%s: Tx timeout.", netdev->name);
|
||||
dev->tx_urb->transfer_flags |= URB_ASYNC_UNLINK;
|
||||
usb_unlink_urb(dev->tx_urb);
|
||||
dev->stats.tx_errors++;
|
||||
}
|
||||
|
||||
static void rtl8150_set_multicast(struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
netif_stop_queue(netdev);
|
||||
if (netdev->flags & IFF_PROMISC) {
|
||||
dev->rx_creg |= cpu_to_le16(0x0001);
|
||||
info("%s: promiscuous mode", netdev->name);
|
||||
} else if ((netdev->mc_count > multicast_filter_limit) ||
|
||||
(netdev->flags & IFF_ALLMULTI)) {
|
||||
dev->rx_creg &= cpu_to_le16(0xfffe);
|
||||
dev->rx_creg |= cpu_to_le16(0x0002);
|
||||
info("%s: allmulti set", netdev->name);
|
||||
} else {
|
||||
/* ~RX_MULTICAST, ~RX_PROMISCUOUS */
|
||||
dev->rx_creg &= cpu_to_le16(0x00fc);
|
||||
}
|
||||
async_set_registers(dev, RCR, 2);
|
||||
netif_wake_queue(netdev);
|
||||
}
|
||||
|
||||
static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
int count, res;
|
||||
|
||||
netif_stop_queue(netdev);
|
||||
count = (skb->len < 60) ? 60 : skb->len;
|
||||
count = (count & 0x3f) ? count : count + 1;
|
||||
dev->tx_skb = skb;
|
||||
usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),
|
||||
skb->data, count, write_bulk_callback, dev);
|
||||
if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) {
|
||||
warn("failed tx_urb %d\n", res);
|
||||
dev->stats.tx_errors++;
|
||||
netif_start_queue(netdev);
|
||||
} else {
|
||||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
netdev->trans_start = jiffies;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void set_carrier(struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
short tmp;
|
||||
|
||||
get_registers(dev, CSCR, 2, &tmp);
|
||||
if (tmp & CSCR_LINK_STATUS)
|
||||
netif_carrier_on(netdev);
|
||||
else
|
||||
netif_carrier_off(netdev);
|
||||
}
|
||||
|
||||
static int rtl8150_open(struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
int res;
|
||||
|
||||
if (dev->rx_skb == NULL)
|
||||
dev->rx_skb = pull_skb(dev);
|
||||
if (!dev->rx_skb)
|
||||
return -ENOMEM;
|
||||
|
||||
set_registers(dev, IDR, 6, netdev->dev_addr);
|
||||
|
||||
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
|
||||
dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
|
||||
if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL)))
|
||||
warn("%s: rx_urb submit failed: %d", __FUNCTION__, res);
|
||||
usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3),
|
||||
dev->intr_buff, INTBUFSIZE, intr_callback,
|
||||
dev, dev->intr_interval);
|
||||
if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL)))
|
||||
warn("%s: intr_urb submit failed: %d", __FUNCTION__, res);
|
||||
netif_start_queue(netdev);
|
||||
enable_net_traffic(dev);
|
||||
set_carrier(netdev);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rtl8150_close(struct net_device *netdev)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
int res = 0;
|
||||
|
||||
netif_stop_queue(netdev);
|
||||
if (!test_bit(RTL8150_UNPLUG, &dev->flags))
|
||||
disable_net_traffic(dev);
|
||||
unlink_all_urbs(dev);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *info)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
|
||||
strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);
|
||||
strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
|
||||
usb_make_path(dev->udev, info->bus_info, sizeof info->bus_info);
|
||||
}
|
||||
|
||||
static int rtl8150_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
short lpa, bmcr;
|
||||
|
||||
ecmd->supported = (SUPPORTED_10baseT_Half |
|
||||
SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_100baseT_Half |
|
||||
SUPPORTED_100baseT_Full |
|
||||
SUPPORTED_Autoneg |
|
||||
SUPPORTED_TP | SUPPORTED_MII);
|
||||
ecmd->port = PORT_TP;
|
||||
ecmd->transceiver = XCVR_INTERNAL;
|
||||
ecmd->phy_address = dev->phy;
|
||||
get_registers(dev, BMCR, 2, &bmcr);
|
||||
get_registers(dev, ANLP, 2, &lpa);
|
||||
if (bmcr & BMCR_ANENABLE) {
|
||||
ecmd->autoneg = AUTONEG_ENABLE;
|
||||
ecmd->speed = (lpa & (LPA_100HALF | LPA_100FULL)) ?
|
||||
SPEED_100 : SPEED_10;
|
||||
if (ecmd->speed == SPEED_100)
|
||||
ecmd->duplex = (lpa & LPA_100FULL) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
else
|
||||
ecmd->duplex = (lpa & LPA_10FULL) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
} else {
|
||||
ecmd->autoneg = AUTONEG_DISABLE;
|
||||
ecmd->speed = (bmcr & BMCR_SPEED100) ?
|
||||
SPEED_100 : SPEED_10;
|
||||
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ethtool_ops ops = {
|
||||
.get_drvinfo = rtl8150_get_drvinfo,
|
||||
.get_settings = rtl8150_get_settings,
|
||||
.get_link = ethtool_op_get_link
|
||||
};
|
||||
|
||||
static int rtl8150_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
rtl8150_t *dev = netdev_priv(netdev);
|
||||
u16 *data = (u16 *) & rq->ifr_ifru;
|
||||
int res = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCDEVPRIVATE:
|
||||
data[0] = dev->phy;
|
||||
case SIOCDEVPRIVATE + 1:
|
||||
read_mii_word(dev, dev->phy, (data[1] & 0x1f), &data[3]);
|
||||
break;
|
||||
case SIOCDEVPRIVATE + 2:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
write_mii_word(dev, dev->phy, (data[1] & 0x1f), data[2]);
|
||||
break;
|
||||
default:
|
||||
res = -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rtl8150_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
rtl8150_t *dev;
|
||||
struct net_device *netdev;
|
||||
|
||||
netdev = alloc_etherdev(sizeof(rtl8150_t));
|
||||
if (!netdev) {
|
||||
err("Out of memory");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dev = netdev_priv(netdev);
|
||||
memset(dev, 0, sizeof(rtl8150_t));
|
||||
|
||||
dev->intr_buff = kmalloc(INTBUFSIZE, GFP_KERNEL);
|
||||
if (!dev->intr_buff) {
|
||||
free_netdev(netdev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev);
|
||||
spin_lock_init(&dev->rx_pool_lock);
|
||||
|
||||
dev->udev = udev;
|
||||
dev->netdev = netdev;
|
||||
SET_MODULE_OWNER(netdev);
|
||||
netdev->open = rtl8150_open;
|
||||
netdev->stop = rtl8150_close;
|
||||
netdev->do_ioctl = rtl8150_ioctl;
|
||||
netdev->watchdog_timeo = RTL8150_TX_TIMEOUT;
|
||||
netdev->tx_timeout = rtl8150_tx_timeout;
|
||||
netdev->hard_start_xmit = rtl8150_start_xmit;
|
||||
netdev->set_multicast_list = rtl8150_set_multicast;
|
||||
netdev->set_mac_address = rtl8150_set_mac_address;
|
||||
netdev->get_stats = rtl8150_netdev_stats;
|
||||
netdev->mtu = RTL8150_MTU;
|
||||
SET_ETHTOOL_OPS(netdev, &ops);
|
||||
dev->intr_interval = 100; /* 100ms */
|
||||
|
||||
if (!alloc_all_urbs(dev)) {
|
||||
err("out of memory");
|
||||
goto out;
|
||||
}
|
||||
if (!rtl8150_reset(dev)) {
|
||||
err("couldn't reset the device");
|
||||
goto out1;
|
||||
}
|
||||
fill_skb_pool(dev);
|
||||
set_ethernet_addr(dev);
|
||||
info("%s: rtl8150 is detected", netdev->name);
|
||||
|
||||
usb_set_intfdata(intf, dev);
|
||||
SET_NETDEV_DEV(netdev, &intf->dev);
|
||||
if (register_netdev(netdev) != 0) {
|
||||
err("couldn't register the device");
|
||||
goto out2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
usb_set_intfdata(intf, NULL);
|
||||
free_skb_pool(dev);
|
||||
out1:
|
||||
free_all_urbs(dev);
|
||||
out:
|
||||
kfree(dev->intr_buff);
|
||||
free_netdev(netdev);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
static void rtl8150_disconnect(struct usb_interface *intf)
|
||||
{
|
||||
rtl8150_t *dev = usb_get_intfdata(intf);
|
||||
|
||||
usb_set_intfdata(intf, NULL);
|
||||
if (dev) {
|
||||
set_bit(RTL8150_UNPLUG, &dev->flags);
|
||||
unregister_netdev(dev->netdev);
|
||||
unlink_all_urbs(dev);
|
||||
free_all_urbs(dev);
|
||||
free_skb_pool(dev);
|
||||
if (dev->rx_skb)
|
||||
dev_kfree_skb(dev->rx_skb);
|
||||
kfree(dev->intr_buff);
|
||||
free_netdev(dev->netdev);
|
||||
}
|
||||
}
|
||||
|
||||
static int __init usb_rtl8150_init(void)
|
||||
{
|
||||
info(DRIVER_DESC " " DRIVER_VERSION);
|
||||
return usb_register(&rtl8150_driver);
|
||||
}
|
||||
|
||||
static void __exit usb_rtl8150_exit(void)
|
||||
{
|
||||
usb_deregister(&rtl8150_driver);
|
||||
}
|
||||
|
||||
module_init(usb_rtl8150_init);
|
||||
module_exit(usb_rtl8150_exit);
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_LICENSE("GPL");
|
4106
drivers/usb/net/usbnet.c
Ficheiro normal
4106
drivers/usb/net/usbnet.c
Ficheiro normal
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Carregar diff
1905
drivers/usb/net/zd1201.c
Ficheiro normal
1905
drivers/usb/net/zd1201.c
Ficheiro normal
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Carregar diff
147
drivers/usb/net/zd1201.h
Ficheiro normal
147
drivers/usb/net/zd1201.h
Ficheiro normal
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* Parts of this driver have been derived from a wlan-ng version
|
||||
* modified by ZyDAS.
|
||||
* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_ZD1201_H_
|
||||
#define _INCLUDE_ZD1201_H_
|
||||
|
||||
#define ZD1201_NUMKEYS 4
|
||||
#define ZD1201_MAXKEYLEN 13
|
||||
#define ZD1201_MAXMULTI 16
|
||||
#define ZD1201_FRAGMAX 2500
|
||||
#define ZD1201_FRAGMIN 256
|
||||
#define ZD1201_RTSMAX 2500
|
||||
|
||||
#define ZD1201_RXSIZE 3000
|
||||
|
||||
struct zd1201 {
|
||||
struct usb_device *usb;
|
||||
int removed;
|
||||
struct net_device *dev;
|
||||
struct net_device_stats stats;
|
||||
struct iw_statistics iwstats;
|
||||
|
||||
int endp_in;
|
||||
int endp_out;
|
||||
int endp_out2;
|
||||
struct urb *rx_urb;
|
||||
struct urb *tx_urb;
|
||||
|
||||
unsigned char rxdata[ZD1201_RXSIZE];
|
||||
int rxlen;
|
||||
wait_queue_head_t rxdataq;
|
||||
int rxdatas;
|
||||
struct hlist_head fraglist;
|
||||
unsigned char txdata[ZD1201_RXSIZE];
|
||||
|
||||
int ap;
|
||||
char essid[IW_ESSID_MAX_SIZE+1];
|
||||
int essidlen;
|
||||
int mac_enabled;
|
||||
int monitor;
|
||||
int encode_enabled;
|
||||
int encode_restricted;
|
||||
unsigned char encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
|
||||
int encode_keylen[ZD1201_NUMKEYS];
|
||||
};
|
||||
|
||||
struct zd1201_frag {
|
||||
struct hlist_node fnode;
|
||||
int seq;
|
||||
struct sk_buff *skb;
|
||||
};
|
||||
|
||||
#define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
|
||||
#define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
|
||||
#define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
|
||||
#define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
|
||||
#define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
|
||||
|
||||
#define ZD1201_FW_TIMEOUT (1000)
|
||||
|
||||
#define ZD1201_TX_TIMEOUT (2000)
|
||||
|
||||
#define ZD1201_USB_CMDREQ 0
|
||||
#define ZD1201_USB_RESREQ 1
|
||||
|
||||
#define ZD1201_CMDCODE_INIT 0x00
|
||||
#define ZD1201_CMDCODE_ENABLE 0x01
|
||||
#define ZD1201_CMDCODE_DISABLE 0x02
|
||||
#define ZD1201_CMDCODE_ALLOC 0x0a
|
||||
#define ZD1201_CMDCODE_INQUIRE 0x11
|
||||
#define ZD1201_CMDCODE_SETRXRID 0x17
|
||||
#define ZD1201_CMDCODE_ACCESS 0x21
|
||||
|
||||
#define ZD1201_PACKET_EVENTSTAT 0x0
|
||||
#define ZD1201_PACKET_RXDATA 0x1
|
||||
#define ZD1201_PACKET_INQUIRE 0x2
|
||||
#define ZD1201_PACKET_RESOURCE 0x3
|
||||
|
||||
#define ZD1201_ACCESSBIT 0x0100
|
||||
|
||||
#define ZD1201_RID_CNFPORTTYPE 0xfc00
|
||||
#define ZD1201_RID_CNFOWNMACADDR 0xfc01
|
||||
#define ZD1201_RID_CNFDESIREDSSID 0xfc02
|
||||
#define ZD1201_RID_CNFOWNCHANNEL 0xfc03
|
||||
#define ZD1201_RID_CNFOWNSSID 0xfc04
|
||||
#define ZD1201_RID_CNFMAXDATALEN 0xfc07
|
||||
#define ZD1201_RID_CNFPMENABLED 0xfc09
|
||||
#define ZD1201_RID_CNFPMEPS 0xfc0a
|
||||
#define ZD1201_RID_CNFMAXSLEEPDURATION 0xfc0c
|
||||
#define ZD1201_RID_CNFDEFAULTKEYID 0xfc23
|
||||
#define ZD1201_RID_CNFDEFAULTKEY0 0xfc24
|
||||
#define ZD1201_RID_CNFDEFAULTKEY1 0xfc25
|
||||
#define ZD1201_RID_CNFDEFAULTKEY2 0xfc26
|
||||
#define ZD1201_RID_CNFDEFAULTKEY3 0xfc27
|
||||
#define ZD1201_RID_CNFWEBFLAGS 0xfc28
|
||||
#define ZD1201_RID_CNFAUTHENTICATION 0xfc2a
|
||||
#define ZD1201_RID_CNFMAXASSOCSTATIONS 0xfc2b
|
||||
#define ZD1201_RID_CNFHOSTAUTH 0xfc2e
|
||||
#define ZD1201_RID_CNFGROUPADDRESS 0xfc80
|
||||
#define ZD1201_RID_CNFFRAGTHRESHOLD 0xfc82
|
||||
#define ZD1201_RID_CNFRTSTHRESHOLD 0xfc83
|
||||
#define ZD1201_RID_TXRATECNTL 0xfc84
|
||||
#define ZD1201_RID_PROMISCUOUSMODE 0xfc85
|
||||
#define ZD1201_RID_CNFBASICRATES 0xfcb3
|
||||
#define ZD1201_RID_AUTHENTICATESTA 0xfce3
|
||||
#define ZD1201_RID_CURRENTBSSID 0xfd42
|
||||
#define ZD1201_RID_COMMSQUALITY 0xfd43
|
||||
#define ZD1201_RID_CURRENTTXRATE 0xfd44
|
||||
#define ZD1201_RID_CNFMAXTXBUFFERNUMBER 0xfda0
|
||||
#define ZD1201_RID_CURRENTCHANNEL 0xfdc1
|
||||
|
||||
#define ZD1201_INQ_SCANRESULTS 0xf101
|
||||
|
||||
#define ZD1201_INF_LINKSTATUS 0xf200
|
||||
#define ZD1201_INF_ASSOCSTATUS 0xf201
|
||||
#define ZD1201_INF_AUTHREQ 0xf202
|
||||
|
||||
#define ZD1201_ASSOCSTATUS_STAASSOC 0x1
|
||||
#define ZD1201_ASSOCSTATUS_REASSOC 0x2
|
||||
#define ZD1201_ASSOCSTATUS_DISASSOC 0x3
|
||||
#define ZD1201_ASSOCSTATUS_ASSOCFAIL 0x4
|
||||
#define ZD1201_ASSOCSTATUS_AUTHFAIL 0x5
|
||||
|
||||
#define ZD1201_PORTTYPE_IBSS 0
|
||||
#define ZD1201_PORTTYPE_BSS 1
|
||||
#define ZD1201_PORTTYPE_WDS 2
|
||||
#define ZD1201_PORTTYPE_PSEUDOIBSS 3
|
||||
#define ZD1201_PORTTYPE_AP 6
|
||||
|
||||
#define ZD1201_RATEB1 1
|
||||
#define ZD1201_RATEB2 2
|
||||
#define ZD1201_RATEB5 4 /* 5.5 really, but 5 is shorter :) */
|
||||
#define ZD1201_RATEB11 8
|
||||
|
||||
#define ZD1201_CNFAUTHENTICATION_OPENSYSTEM 0x0001
|
||||
#define ZD1201_CNFAUTHENTICATION_SHAREDKEY 0x0002
|
||||
|
||||
#endif /* _INCLUDE_ZD1201_H_ */
|
Criar uma nova questão referindo esta
Bloquear um utilizador