Commit ee446fd5 authored by Paul Gortmaker's avatar Paul Gortmaker
Browse files

tokenring: delete all remaining driver support


This represents the mass deletion of the of the tokenring support.

It gets rid of:
  - the net/tr.c which the drivers depended on
  - the drivers/net component
  - the Kbuild infrastructure around it
  - any tokenring related CONFIG_ settings in any defconfigs
  - the tokenring headers in the include/linux dir
  - the firmware associated with the tokenring drivers.
  - any associated token ring documentation.
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 211ed865
No related merge requests found
......@@ -996,7 +996,6 @@ Table 1-9: Network info in /proc/net
snmp SNMP data
sockstat Socket statistics
tcp TCP sockets
tr_rif Token ring RIF routing table
udp UDP sockets
unix UNIX domain sockets
wireless Wireless interface data (Wavelan etc)
......
00-INDEX
- this file
3c359.txt
- information on the 3Com TokenLink Velocity XL (3c5359) driver.
3c505.txt
- information on the 3Com EtherLink Plus (3c505) driver.
3c509.txt
......@@ -142,8 +140,6 @@ netif-msg.txt
- Design of the network interface message level setting (NETIF_MSG_*).
nfc.txt
- The Linux Near Field Communication (NFS) subsystem.
olympic.txt
- IBM PCI Pit/Pit-Phy/Olympic Token Ring driver info.
openvswitch.txt
- Open vSwitch developer documentation.
operstates.txt
......@@ -184,8 +180,6 @@ skfp.txt
- SysKonnect FDDI (SK-5xxx, Compaq Netelligent) driver info.
smc9.txt
- the driver for SMC's 9000 series of Ethernet cards
smctr.txt
- SMC TokenCard TokenRing Linux driver info.
spider-net.txt
- README for the Spidernet Driver (as found in PS3 / Cell BE).
stmmac.txt
......@@ -200,8 +194,6 @@ tcp-thin.txt
- kernel tuning options for low rate 'thin' TCP streams.
tlan.txt
- ThunderLAN (Compaq Netelligent 10/100, Olicom OC-2xxx) driver info.
tms380tr.txt
- SysKonnect Token Ring ISA/PCI adapter driver info.
tproxy.txt
- Transparent proxy support user guide.
tuntap.txt
......
3COM PCI TOKEN LINK VELOCITY XL TOKEN RING CARDS README
Release 0.9.0 - Release
Jul 17th 2000 Mike Phillips
1.2.0 - Final
Feb 17th 2002 Mike Phillips
Updated for submission to the 2.4.x kernel.
Thanks:
Terry Murphy from 3Com for tech docs and support,
Adam D. Ligas for testing the driver.
Note:
This driver will NOT work with the 3C339 Token Ring cards, you need
to use the tms380 driver instead.
Options:
The driver accepts three options: ringspeed, pkt_buf_sz and message_level.
These options can be specified differently for each card found.
ringspeed: Has one of three settings 0 (default), 4 or 16. 0 will
make the card autosense the ringspeed and join at the appropriate speed,
this will be the default option for most people. 4 or 16 allow you to
explicitly force the card to operate at a certain speed. The card will fail
if you try to insert it at the wrong speed. (Although some hubs will allow
this so be *very* careful). The main purpose for explicitly setting the ring
speed is for when the card is first on the ring. In autosense mode, if the card
cannot detect any active monitors on the ring it will open at the same speed as
its last opening. This can be hazardous if this speed does not match the speed
you want the ring to operate at.
pkt_buf_sz: This is this initial receive buffer allocation size. This will
default to 4096 if no value is entered. You may increase performance of the
driver by setting this to a value larger than the network packet size, although
the driver now re-sizes buffers based on MTU settings as well.
message_level: Controls level of messages created by the driver. Defaults to 0:
which only displays start-up and critical messages. Presently any non-zero
value will display all soft messages as well. NB This does not turn
debugging messages on, that must be done by modified the source code.
Variable MTU size:
The driver can handle a MTU size up to either 4500 or 18000 depending upon
ring speed. The driver also changes the size of the receive buffers as part
of the mtu re-sizing, so if you set mtu = 18000, you will need to be able
to allocate 16 * (sk_buff with 18000 buffer size) call it 18500 bytes per ring
position = 296,000 bytes of memory space, plus of course anything
necessary for the tx sk_buff's. Remember this is per card, so if you are
building routers, gateway's etc, you could start to use a lot of memory
real fast.
2/17/02 Mike Phillips
IBM PCI Pit/Pit-Phy/Olympic CHIPSET BASED TOKEN RING CARDS README
Release 0.2.0 - Release
June 8th 1999 Peter De Schrijver & Mike Phillips
Release 0.9.C - Release
April 18th 2001 Mike Phillips
Thanks:
Erik De Cock, Adrian Bridgett and Frank Fiene for their
patience and testing.
Donald Champion for the cardbus support
Kyle Lucke for the dma api changes.
Jonathon Bitner for hardware support.
Everybody on linux-tr for their continued support.
Options:
The driver accepts four options: ringspeed, pkt_buf_sz,
message_level and network_monitor.
These options can be specified differently for each card found.
ringspeed: Has one of three settings 0 (default), 4 or 16. 0 will
make the card autosense the ringspeed and join at the appropriate speed,
this will be the default option for most people. 4 or 16 allow you to
explicitly force the card to operate at a certain speed. The card will fail
if you try to insert it at the wrong speed. (Although some hubs will allow
this so be *very* careful). The main purpose for explicitly setting the ring
speed is for when the card is first on the ring. In autosense mode, if the card
cannot detect any active monitors on the ring it will not open, so you must
re-init the card at the appropriate speed. Unfortunately at present the only
way of doing this is rmmod and insmod which is a bit tough if it is compiled
in the kernel.
pkt_buf_sz: This is this initial receive buffer allocation size. This will
default to 4096 if no value is entered. You may increase performance of the
driver by setting this to a value larger than the network packet size, although
the driver now re-sizes buffers based on MTU settings as well.
message_level: Controls level of messages created by the driver. Defaults to 0:
which only displays start-up and critical messages. Presently any non-zero
value will display all soft messages as well. NB This does not turn
debugging messages on, that must be done by modified the source code.
network_monitor: Any non-zero value will provide a quasi network monitoring
mode. All unexpected MAC frames (beaconing etc.) will be received
by the driver and the source and destination addresses printed.
Also an entry will be added in /proc/net called olympic_tr%d, where tr%d
is the registered device name, i.e tr0, tr1, etc. This displays low
level information about the configuration of the ring and the adapter.
This feature has been designed for network administrators to assist in
the diagnosis of network / ring problems. (This used to OLYMPIC_NETWORK_MONITOR,
but has now changed to allow each adapter to be configured differently and
to alleviate the necessity to re-compile olympic to turn the option on).
Multi-card:
The driver will detect multiple cards and will work with shared interrupts,
each card is assigned the next token ring device, i.e. tr0 , tr1, tr2. The
driver should also happily reside in the system with other drivers. It has
been tested with ibmtr.c running, and I personally have had one Olicom PCI
card and two IBM olympic cards (all on the same interrupt), all running
together.
Variable MTU size:
The driver can handle a MTU size up to either 4500 or 18000 depending upon
ring speed. The driver also changes the size of the receive buffers as part
of the mtu re-sizing, so if you set mtu = 18000, you will need to be able
to allocate 16 * (sk_buff with 18000 buffer size) call it 18500 bytes per ring
position = 296,000 bytes of memory space, plus of course anything
necessary for the tx sk_buff's. Remember this is per card, so if you are
building routers, gateway's etc, you could start to use a lot of memory
real fast.
6/8/99 Peter De Schrijver and Mike Phillips
Text File for the SMC TokenCard TokenRing Linux driver (smctr.c).
By Jay Schulist <jschlst@samba.org>
The Linux SMC Token Ring driver works with the SMC TokenCard Elite (8115T)
ISA and SMC TokenCard Elite/A (8115T/A) MCA adapters.
Latest information on this driver can be obtained on the Linux-SNA WWW site.
Please point your browser to: http://www.linux-sna.org
This driver is rather simple to use. Select Y to Token Ring adapter support
in the kernel configuration. A choice for SMC Token Ring adapters will
appear. This drives supports all SMC ISA/MCA adapters. Choose this
option. I personally recommend compiling the driver as a module (M), but if you
you would like to compile it statically answer Y instead.
This driver supports multiple adapters without the need to load multiple copies
of the driver. You should be able to load up to 7 adapters without any kernel
modifications, if you are in need of more please contact the maintainer of this
driver.
Load the driver either by lilo/loadlin or as a module. When a module using the
following command will suffice for most:
# modprobe smctr
smctr.c: v1.00 12/6/99 by jschlst@samba.org
tr0: SMC TokenCard 8115T at Io 0x300, Irq 10, Rom 0xd8000, Ram 0xcc000.
Now just setup the device via ifconfig and set and routes you may have. After
this you are ready to start sending some tokens.
Errata:
1). For anyone wondering where to pick up the SMC adapters please browse
to http://www.smc.com
2). If you are the first/only Token Ring Client on a Token Ring LAN, please
specify the ringspeed with the ringspeed=[4/16] module option. If no
ringspeed is specified the driver will attempt to autodetect the ring
speed and/or if the adapter is the first/only station on the ring take
the appropriate actions.
NOTE: Default ring speed is 16MB UTP.
3). PnP support for this adapter sucks. I recommend hard setting the
IO/MEM/IRQ by the jumpers on the adapter. If this is not possible
load the module with the following io=[ioaddr] mem=[mem_addr]
irq=[irq_num].
The following IRQ, IO, and MEM settings are supported.
IO ports:
0x200, 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x2E0, 0x300,
0x320, 0x340, 0x360, 0x380.
IRQs:
2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15
Memory addresses:
0xA0000, 0xA4000, 0xA8000, 0xAC000, 0xB0000, 0xB4000,
0xB8000, 0xBC000, 0xC0000, 0xC4000, 0xC8000, 0xCC000,
0xD0000, 0xD4000, 0xD8000, 0xDC000, 0xE0000, 0xE4000,
0xE8000, 0xEC000, 0xF0000, 0xF4000, 0xF8000, 0xFC000
This driver is under the GNU General Public License. Its Firmware image is
included as an initialized C-array and is licensed by SMC to the Linux
users of this driver. However no warranty about its fitness is expressed or
implied by SMC.
Text file for the Linux SysKonnect Token Ring ISA/PCI Adapter Driver.
Text file by: Jay Schulist <jschlst@samba.org>
The Linux SysKonnect Token Ring driver works with the SysKonnect TR4/16(+) ISA,
SysKonnect TR4/16(+) PCI, SysKonnect TR4/16 PCI, and older revisions of the
SK NET TR4/16 ISA card.
Latest information on this driver can be obtained on the Linux-SNA WWW site.
Please point your browser to:
http://www.linux-sna.org
Many thanks to Christoph Goos for his excellent work on this driver and
SysKonnect for donating the adapters to Linux-SNA for the testing and
maintenance of this device driver.
Important information to be noted:
1. Adapters can be slow to open (~20 secs) and close (~5 secs), please be
patient.
2. This driver works very well when autoprobing for adapters. Why even
think about those nasty io/int/dma settings of modprobe when the driver
will do it all for you!
This driver is rather simple to use. Select Y to Token Ring adapter support
in the kernel configuration. A choice for SysKonnect Token Ring adapters will
appear. This drives supports all SysKonnect ISA and PCI adapters. Choose this
option. I personally recommend compiling the driver as a module (M), but if you
you would like to compile it statically answer Y instead.
This driver supports multiple adapters without the need to load multiple copies
of the driver. You should be able to load up to 7 adapters without any kernel
modifications, if you are in need of more please contact the maintainer of this
driver.
Load the driver either by lilo/loadlin or as a module. When a module using the
following command will suffice for most:
# modprobe sktr
This will produce output similar to the following: (Output is user specific)
sktr.c: v1.01 08/29/97 by Christoph Goos
tr0: SK NET TR 4/16 PCI found at 0x6100, using IRQ 17.
tr1: SK NET TR 4/16 PCI found at 0x6200, using IRQ 16.
tr2: SK NET TR 4/16 ISA found at 0xa20, using IRQ 10 and DMA 5.
Now just setup the device via ifconfig and set and routes you may have. After
this you are ready to start sending some tokens.
Errata:
For anyone wondering where to pick up the SysKonnect adapters please browse
to http://www.syskonnect.com
This driver is under the GNU General Public License. Its Firmware image is
included as an initialized C-array and is licensed by SysKonnect to the Linux
users of this driver. However no warranty about its fitness is expressed or
implied by SysKonnect.
Below find attached the setting for the SK NET TR 4/16 ISA adapters
-------------------------------------------------------------------
***************************
*** C O N T E N T S ***
***************************
1) Location of DIP-Switch W1
2) Default settings
3) DIP-Switch W1 description
==============================================================
CHAPTER 1 LOCATION OF DIP-SWITCH
==============================================================
UÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
þUÄÄÄÄÄÄ¿ UÄÄÄÄÄ¿ UÄÄÄ¿ þ
þAÄÄÄÄÄÄU W1 AÄÄÄÄÄU UÄÄÄÄ¿ þ þ þ
þUÄÄÄÄÄÄ¿ þ þ þ þ UÄÄÅ¿
þAÄÄÄÄÄÄU UÄÄÄÄÄÄÄÄÄÄÄ¿ AÄÄÄÄU þ þ þ þþ
þUÄÄÄÄÄÄ¿ þ þ UÄÄÄ¿ AÄÄÄU AÄÄÅU
þAÄÄÄÄÄÄU þ TMS380C26 þ þ þ þ
þUÄÄÄÄÄÄ¿ þ þ AÄÄÄU AÄ¿
þAÄÄÄÄÄÄU þ þ þ þ
þ AÄÄÄÄÄÄÄÄÄÄÄU þ þ
þ þ þ
þ AÄU
þ þ
þ þ
þ þ
þ þ
AÄÄÄÄÄÄÄÄÄÄÄÄAÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄAÄÄAÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄAÄÄÄÄÄÄÄÄÄU
AÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU AÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU
==============================================================
CHAPTER 2 DEFAULT SETTINGS
==============================================================
W1 1 2 3 4 5 6 7 8
+------------------------------+
| ON X |
| OFF X X X X X X X |
+------------------------------+
W1.1 = ON Adapter drives address lines SA17..19
W1.2 - 1.5 = OFF BootROM disabled
W1.6 - 1.8 = OFF I/O address 0A20h
==============================================================
CHAPTER 3 DIP SWITCH W1 DESCRIPTION
==============================================================
UÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄ¿ ON
þ 1 þ 2 þ 3 þ 4 þ 5 þ 6 þ 7 þ 8 þ
AÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄAÄÄÄU OFF
|AD | BootROM Addr. | I/O |
+-+-+-------+-------+-----+-----+
| | |
| | +------ 6 7 8
| | ON ON ON 1900h
| | ON ON OFF 0900h
| | ON OFF ON 1980h
| | ON OFF OFF 0980h
| | OFF ON ON 1b20h
| | OFF ON OFF 0b20h
| | OFF OFF ON 1a20h
| | OFF OFF OFF 0a20h (+)
| |
| |
| +-------- 2 3 4 5
| OFF x x x disabled (+)
| ON ON ON ON C0000
| ON ON ON OFF C4000
| ON ON OFF ON C8000
| ON ON OFF OFF CC000
| ON OFF ON ON D0000
| ON OFF ON OFF D4000
| ON OFF OFF ON D8000
| ON OFF OFF OFF DC000
|
|
+----- 1
OFF adapter does NOT drive SA<17..19>
ON adapter drives SA<17..19> (+)
(+) means default setting
********************************
......@@ -346,11 +346,8 @@ CONFIG_CHELSIO_T1=m
CONFIG_IXGB=m
CONFIG_S2IO=m
CONFIG_MYRI10GE=m
CONFIG_TR=y
CONFIG_IBMOL=m
CONFIG_IBMLS=m
CONFIG_3C359=m
CONFIG_TMS380TR=m
CONFIG_TMSPCI=m
CONFIG_ABYSS=m
CONFIG_USB_CATC=m
......@@ -376,7 +373,6 @@ CONFIG_PCMCIA_SMC91C92=m
CONFIG_PCMCIA_XIRC2PS=m
CONFIG_PCMCIA_AXNET=m
CONFIG_ARCNET_COM20020_CS=m
CONFIG_PCMCIA_IBMTR=m
CONFIG_WAN=y
CONFIG_LANMEDIA=m
CONFIG_HDLC=m
......
......@@ -332,11 +332,6 @@ CONFIG_XT2000_SONIC=y
# CONFIG_IXGB is not set
# CONFIG_S2IO is not set
#
# Token Ring devices
#
# CONFIG_TR is not set
#
# Wireless LAN (non-hamradio)
#
......
......@@ -69,7 +69,6 @@
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
// #include <linux/trdevice.h>
#include <asm/uaccess.h>
#include <asm/io.h>
......
......@@ -282,8 +282,6 @@ source "drivers/net/slip/Kconfig"
source "drivers/s390/net/Kconfig"
source "drivers/net/tokenring/Kconfig"
source "drivers/net/usb/Kconfig"
source "drivers/net/wireless/Kconfig"
......
......@@ -50,7 +50,6 @@ obj-$(CONFIG_SLIP) += slip/
obj-$(CONFIG_SLHC) += slip/
obj-$(CONFIG_NET_SB1000) += sb1000.o
obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o
obj-$(CONFIG_TR) += tokenring/
obj-$(CONFIG_WAN) += wan/
obj-$(CONFIG_WLAN) += wireless/
obj-$(CONFIG_WIMAX) += wimax/
......
......@@ -29,7 +29,6 @@
*/
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/trdevice.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/netlink.h>
......@@ -284,46 +283,6 @@ static void __init ethif_probe2(int unit)
probe_list2(unit, parport_probes, base_addr == 0));
}
#ifdef CONFIG_TR
/* Token-ring device probe */
extern int ibmtr_probe_card(struct net_device *);
extern struct net_device *smctr_probe(int unit);
static struct devprobe2 tr_probes2[] __initdata = {
#ifdef CONFIG_SMCTR
{smctr_probe, 0},
#endif
{NULL, 0},
};
static __init int trif_probe(int unit)
{
int err = -ENODEV;
#ifdef CONFIG_IBMTR
struct net_device *dev = alloc_trdev(0);
if (!dev)
return -ENOMEM;
sprintf(dev->name, "tr%d", unit);
netdev_boot_setup_check(dev);
err = ibmtr_probe_card(dev);
if (err)
free_netdev(dev);
#endif
return err;
}
static void __init trif_probe2(int unit)
{
unsigned long base_addr = netdev_boot_base("tr", unit);
if (base_addr == 1)
return;
probe_list2(unit, tr_probes2, base_addr == 0);
}
#endif
/* Statically configured drivers -- order matters here. */
static int __init net_olddevs_init(void)
{
......@@ -332,11 +291,6 @@ static int __init net_olddevs_init(void)
#ifdef CONFIG_SBNI
for (num = 0; num < 8; ++num)
sbni_probe(num);
#endif
#ifdef CONFIG_TR
for (num = 0; num < 8; ++num)
if (!trif_probe(num))
trif_probe2(num);
#endif
for (num = 0; num < 8; ++num)
ethif_probe2(num);
......
This diff is collapsed.
/*
* 3c359.h (c) 2000 Mike Phillips (mikep@linuxtr.net) All Rights Reserved
*
* Linux driver for 3Com 3C359 Token Link PCI XL cards.
*
* This software may be used and distributed according to the terms
* of the GNU General Public License Version 2 or (at your option)
* any later verion, incorporated herein by reference.
*/
/* Memory Access Commands */
#define IO_BYTE_READ 0x28 << 24
#define IO_BYTE_WRITE 0x18 << 24
#define IO_WORD_READ 0x20 << 24
#define IO_WORD_WRITE 0x10 << 24
#define MMIO_BYTE_READ 0x88 << 24
#define MMIO_BYTE_WRITE 0x48 << 24
#define MMIO_WORD_READ 0x80 << 24
#define MMIO_WORD_WRITE 0x40 << 24
#define MEM_BYTE_READ 0x8C << 24
#define MEM_BYTE_WRITE 0x4C << 24
#define MEM_WORD_READ 0x84 << 24
#define MEM_WORD_WRITE 0x44 << 24
#define PMBAR 0x1C80
#define PMB_CPHOLD (1<<10)
#define CPATTENTION 0x180D
#define CPA_PMBARVIS (1<<7)
#define CPA_MEMWREN (1<<6)
#define SWITCHSETTINGS 0x1C88
#define EECONTROL 0x1C8A
#define EEDATA 0x1C8C
#define EEREAD 0x0080
#define EEWRITE 0x0040
#define EEERASE 0x0060
#define EE_ENABLE_WRITE 0x0030
#define EEBUSY (1<<15)
#define WRBR 0xCDE02
#define WWOR 0xCDE04
#define WWCR 0xCDE06
#define MACSTATUS 0xCDE08
#define MISR_RW 0xCDE0B
#define MISR_AND 0xCDE2B
#define MISR_SET 0xCDE4B
#define RXBUFAREA 0xCDE10
#define RXEARLYTHRESH 0xCDE12
#define TXSTARTTHRESH 0x58
#define DNPRIREQTHRESH 0x2C
#define MISR_CSRB (1<<5)
#define MISR_RASB (1<<4)
#define MISR_SRBFR (1<<3)
#define MISR_ASBFR (1<<2)
#define MISR_ARBF (1<<1)
/* MISR Flags memory locations */
#define MF_SSBF 0xDFFE0
#define MF_ARBF 0xDFFE1
#define MF_ASBFR 0xDFFE2
#define MF_SRBFR 0xDFFE3
#define MF_RASB 0xDFFE4
#define MF_CSRB 0xDFFE5
#define MMIO_MACDATA 0x10
#define MMIO_MAC_ACCESS_CMD 0x14
#define MMIO_TIMER 0x1A
#define MMIO_DMA_CTRL 0x20
#define MMIO_DNLISTPTR 0x24
#define MMIO_HASHFILTER 0x28
#define MMIO_CONFIG 0x29
#define MMIO_DNPRIREQTHRESH 0x2C
#define MMIO_DNPOLL 0x2D
#define MMIO_UPPKTSTATUS 0x30
#define MMIO_FREETIMER 0x34
#define MMIO_COUNTDOWN 0x36
#define MMIO_UPLISTPTR 0x38
#define MMIO_UPPOLL 0x3C
#define MMIO_UPBURSTTHRESH 0x40
#define MMIO_DNBURSTTHRESH 0x41
#define MMIO_INTSTATUS_AUTO 0x56
#define MMIO_TXSTARTTHRESH 0x58
#define MMIO_INTERRUPTENABLE 0x5A
#define MMIO_INDICATIONENABLE 0x5C
#define MMIO_COMMAND 0x5E /* These two are meant to be the same */
#define MMIO_INTSTATUS 0x5E /* Makes the code more readable this way */
#define INTSTAT_CMD_IN_PROGRESS (1<<12)
#define INTSTAT_SRB (1<<14)
#define INTSTAT_INTLATCH (1<<0)
/* Indication / Interrupt Mask
* Annoyingly the bits to be set in the indication and interrupt enable
* do not match with the actual bits received in the interrupt, although
* they are in the same order.
* The mapping for the indication / interrupt are:
* Bit Indication / Interrupt
* 0 HostError
* 1 txcomplete
* 2 updneeded
* 3 rxcomplete
* 4 intrequested
* 5 macerror
* 6 dncomplete
* 7 upcomplete
* 8 txunderrun
* 9 asbf
* 10 srbr
* 11 arbc
*
* The only ones we don't want to receive are txcomplete and rxcomplete
* we use dncomplete and upcomplete instead.
*/
#define INT_MASK 0xFF5
/* Note the subtle difference here, IND and INT */
#define SETINDENABLE (8<<12)
#define SETINTENABLE (7<<12)
#define SRBBIT (1<<10)
#define ASBBIT (1<<9)
#define ARBBIT (1<<11)
#define SRB 0xDFE90
#define ASB 0xDFED0
#define ARB 0xD0000
#define SCRATCH 0xDFEF0
#define INT_REQUEST 0x6000 /* (6 << 12) */
#define ACK_INTERRUPT 0x6800 /* (13 <<11) */
#define GLOBAL_RESET 0x00
#define DNDISABLE 0x5000
#define DNENABLE 0x4800
#define DNSTALL 0x3002
#define DNRESET 0x5800
#define DNUNSTALL 0x3003
#define UPRESET 0x2800
#define UPSTALL 0x3000
#define UPUNSTALL 0x3001
#define SETCONFIG 0x4000
#define SETTXSTARTTHRESH 0x9800
/* Received Interrupts */
#define ASBFINT (1<<13)
#define SRBRINT (1<<14)
#define ARBCINT (1<<15)
#define TXUNDERRUN (1<<11)
#define UPCOMPINT (1<<10)
#define DNCOMPINT (1<<9)
#define HARDERRINT (1<<7)
#define RXCOMPLETE (1<<4)
#define TXCOMPINT (1<<2)
#define HOSTERRINT (1<<1)
/* Receive descriptor bits */
#define RXOVERRUN cpu_to_le32(1<<19)
#define RXFC cpu_to_le32(1<<21)
#define RXAR cpu_to_le32(1<<22)
#define RXUPDCOMPLETE cpu_to_le32(1<<23)
#define RXUPDFULL cpu_to_le32(1<<24)
#define RXUPLASTFRAG cpu_to_le32(1<<31)
/* Transmit descriptor bits */
#define TXDNCOMPLETE cpu_to_le32(1<<16)
#define TXTXINDICATE cpu_to_le32(1<<27)
#define TXDPDEMPTY cpu_to_le32(1<<29)
#define TXDNINDICATE cpu_to_le32(1<<31)
#define TXDNFRAGLAST cpu_to_le32(1<<31)
/* Interrupts to Acknowledge */
#define LATCH_ACK 1
#define TXCOMPACK (1<<1)
#define INTREQACK (1<<2)
#define DNCOMPACK (1<<3)
#define UPCOMPACK (1<<4)
#define ASBFACK (1<<5)
#define SRBRACK (1<<6)
#define ARBCACK (1<<7)
#define XL_IO_SPACE 128
#define SRB_COMMAND_SIZE 50
/* Adapter Commands */
#define REQUEST_INT 0x00
#define MODIFY_OPEN_PARMS 0x01
#define RESTORE_OPEN_PARMS 0x02
#define OPEN_NIC 0x03
#define CLOSE_NIC 0x04
#define SET_SLEEP_MODE 0x05
#define SET_GROUP_ADDRESS 0x06
#define SET_FUNC_ADDRESS 0x07
#define READ_LOG 0x08
#define SET_MULTICAST_MODE 0x0C
#define CHANGE_WAKEUP_PATTERN 0x0D
#define GET_STATISTICS 0x13
#define SET_RECEIVE_MODE 0x1F
/* ARB Commands */
#define RECEIVE_DATA 0x81
#define RING_STATUS_CHANGE 0x84
/* ASB Commands */
#define ASB_RECEIVE_DATE 0x81
/* Defines for LAN STATUS CHANGE reports */
#define LSC_SIG_LOSS 0x8000
#define LSC_HARD_ERR 0x4000
#define LSC_SOFT_ERR 0x2000
#define LSC_TRAN_BCN 0x1000
#define LSC_LWF 0x0800
#define LSC_ARW 0x0400
#define LSC_FPE 0x0200
#define LSC_RR 0x0100
#define LSC_CO 0x0080
#define LSC_SS 0x0040
#define LSC_RING_REC 0x0020
#define LSC_SR_CO 0x0010
#define LSC_FDX_MODE 0x0004
#define XL_MAX_ADAPTERS 8 /* 0x08 __MODULE_STRING can't hand 0xnn */
/* 3c359 defaults for buffers */
#define XL_RX_RING_SIZE 16 /* must be a power of 2 */
#define XL_TX_RING_SIZE 16 /* must be a power of 2 */
#define PKT_BUF_SZ 4096 /* Default packet size */
/* 3c359 data structures */
struct xl_tx_desc {
__le32 dnnextptr;
__le32 framestartheader;
__le32 buffer;
__le32 buffer_length;
};
struct xl_rx_desc {
__le32 upnextptr;
__le32 framestatus;
__le32 upfragaddr;
__le32 upfraglen;
};
struct xl_private {
/* These two structures must be aligned on 8 byte boundaries */
/* struct xl_rx_desc xl_rx_ring[XL_RX_RING_SIZE]; */
/* struct xl_tx_desc xl_tx_ring[XL_TX_RING_SIZE]; */
struct xl_rx_desc *xl_rx_ring ;
struct xl_tx_desc *xl_tx_ring ;
struct sk_buff *tx_ring_skb[XL_TX_RING_SIZE], *rx_ring_skb[XL_RX_RING_SIZE];
int tx_ring_head, tx_ring_tail ;
int rx_ring_tail, rx_ring_no ;
int free_ring_entries ;
u16 srb;
u16 arb;
u16 asb;
u8 __iomem *xl_mmio;
const char *xl_card_name;
struct pci_dev *pdev ;
spinlock_t xl_lock ;
volatile int srb_queued;
struct wait_queue *srb_wait;
volatile int asb_queued;
u16 mac_buffer ;
u16 xl_lan_status ;
u8 xl_ring_speed ;
u16 pkt_buf_sz ;
u8 xl_message_level;
u16 xl_copy_all_options ;
unsigned char xl_functional_addr[4] ;
u16 xl_addr_table_addr, xl_parms_addr ;
u8 xl_laa[6] ;
u32 rx_ring_dma_addr ;
u32 tx_ring_dma_addr ;
/* firmware section */
const struct firmware *fw;
};
#
# Token Ring driver configuration
#
# So far, we only have PCI, ISA, and MCA token ring devices
menuconfig TR
bool "Token Ring driver support"
depends on NETDEVICES && !UML
depends on (PCI || ISA || MCA || CCW || PCMCIA)
help
Token Ring is IBM's way of communication on a local network; the
rest of the world uses Ethernet. To participate on a Token Ring
network, you need a special Token ring network card. If you are
connected to such a Token Ring network and want to use your Token
Ring card under Linux, say Y here and to the driver for your
particular card below and read the Token-Ring mini-HOWTO, available
from <http://www.tldp.org/docs.html#howto>. Most people can
say N here.
if TR
config WANT_LLC
def_bool y
select LLC
config PCMCIA_IBMTR
tristate "IBM PCMCIA tokenring adapter support"
depends on IBMTR!=y && PCMCIA
---help---
Say Y here if you intend to attach this type of Token Ring PCMCIA
card to your computer. You then also need to say Y to "Token Ring
driver support".
To compile this driver as a module, choose M here: the module will be
called ibmtr_cs.
config IBMTR
tristate "IBM Tropic chipset based adapter support"
depends on ISA || MCA
---help---
This is support for all IBM Token Ring cards that don't use DMA. If
you have such a beast, say Y and read the Token-Ring mini-HOWTO,
available from <http://www.tldp.org/docs.html#howto>.
Warning: this driver will almost definitely fail if more than one
active Token Ring card is present.
To compile this driver as a module, choose M here: the module will be
called ibmtr.
config IBMOL
tristate "IBM Olympic chipset PCI adapter support"
depends on PCI
---help---
This is support for all non-Lanstreamer IBM PCI Token Ring Cards.
Specifically this is all IBM PCI, PCI Wake On Lan, PCI II, PCI II
Wake On Lan, and PCI 100/16/4 adapters.
If you have such an adapter, say Y and read the Token-Ring
mini-HOWTO, available from <http://www.tldp.org/docs.html#howto>.
To compile this driver as a module, choose M here: the module will be
called olympic.
Also read <file:Documentation/networking/olympic.txt> or check the
Linux Token Ring Project site for the latest information at
<http://www.linuxtr.net/>.
config IBMLS
tristate "IBM Lanstreamer chipset PCI adapter support"
depends on PCI && !64BIT
help
This is support for IBM Lanstreamer PCI Token Ring Cards.
If you have such an adapter, say Y and read the Token-Ring
mini-HOWTO, available from <http://www.tldp.org/docs.html#howto>.
To compile this driver as a module, choose M here: the module will be
called lanstreamer.
config 3C359
tristate "3Com 3C359 Token Link Velocity XL adapter support"
depends on PCI
---help---
This is support for the 3Com PCI Velocity XL cards, specifically
the 3Com 3C359, please note this is not for the 3C339 cards, you
should use the tms380 driver instead.
If you have such an adapter, say Y and read the Token-Ring
mini-HOWTO, available from <http://www.tldp.org/docs.html#howto>.
To compile this driver as a module, choose M here: the module will be
called 3c359.
Also read the file <file:Documentation/networking/3c359.txt> or check the
Linux Token Ring Project site for the latest information at
<http://www.linuxtr.net>
config TMS380TR
tristate "Generic TMS380 Token Ring ISA/PCI adapter support"
depends on PCI || ISA || MCA
select FW_LOADER
---help---
This driver provides generic support for token ring adapters
based on the Texas Instruments TMS380 series chipsets. This
includes the SysKonnect TR4/16(+) ISA (SK-4190), SysKonnect
TR4/16(+) PCI (SK-4590), SysKonnect TR4/16 PCI (SK-4591),
Compaq 4/16 PCI, Thomas-Conrad TC4048 4/16 PCI, and several
Madge adapters. If you say Y here, you will be asked to select
which cards to support below. If you're using modules, each
class of card will be supported by a separate module.
If you have such an adapter and would like to use it, say Y and
read the Token-Ring mini-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.
Also read the file <file:Documentation/networking/tms380tr.txt> or
check <http://www.auk.cx/tms380tr/>.
To compile this driver as a module, choose M here: the module will be
called tms380tr.
config TMSPCI
tristate "Generic TMS380 PCI support"
depends on TMS380TR && PCI
---help---
This tms380 module supports generic TMS380-based PCI cards.
These cards are known to work:
- Compaq 4/16 TR PCI
- SysKonnect TR4/16 PCI (SK-4590/SK-4591)
- Thomas-Conrad TC4048 PCI 4/16
- 3Com Token Link Velocity
To compile this driver as a module, choose M here: the module will be
called tmspci.
config SKISA
tristate "SysKonnect TR4/16 ISA support"
depends on TMS380TR && ISA && ISA_DMA_API
help
This tms380 module supports SysKonnect TR4/16 ISA cards.
These cards are known to work:
- SysKonnect TR4/16 ISA (SK-4190)
To compile this driver as a module, choose M here: the module will be
called skisa.
config PROTEON
tristate "Proteon ISA support"
depends on TMS380TR && ISA && ISA_DMA_API
help
This tms380 module supports Proteon ISA cards.
These cards are known to work:
- Proteon 1392
- Proteon 1392 plus
To compile this driver as a module, choose M here: the module will be
called proteon.
config ABYSS
tristate "Madge Smart 16/4 PCI Mk2 support"
depends on TMS380TR && PCI
help
This tms380 module supports the Madge Smart 16/4 PCI Mk2
cards (51-02).
To compile this driver as a module, choose M here: the module will be
called abyss.
config MADGEMC
tristate "Madge Smart 16/4 Ringnode MicroChannel"
depends on TMS380TR && MCA
help
This tms380 module supports the Madge Smart 16/4 MC16 and MC32
MicroChannel adapters.
To compile this driver as a module, choose M here: the module will be
called madgemc.
config SMCTR
tristate "SMC ISA/MCA adapter support"
depends on (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
---help---
This is support for the ISA and MCA SMC Token Ring cards,
specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A
(8115T/A) adapters.
If you have such an adapter and would like to use it, say Y or M and
read the Token-Ring mini-HOWTO, available from
<http://www.tldp.org/docs.html#howto> and the file
<file:Documentation/networking/smctr.txt>.
To compile this driver as a module, choose M here: the module will be
called smctr.
endif # TR
#
# Makefile for drivers/net/tokenring
#
obj-$(CONFIG_PCMCIA_IBMTR) += ibmtr_cs.o
obj-$(CONFIG_IBMTR) += ibmtr.o
obj-$(CONFIG_IBMOL) += olympic.o
obj-$(CONFIG_IBMLS) += lanstreamer.o
obj-$(CONFIG_TMS380TR) += tms380tr.o
obj-$(CONFIG_ABYSS) += abyss.o
obj-$(CONFIG_MADGEMC) += madgemc.o
obj-$(CONFIG_PROTEON) += proteon.o
obj-$(CONFIG_TMSPCI) += tmspci.o
obj-$(CONFIG_SKISA) += skisa.o
obj-$(CONFIG_SMCTR) += smctr.o
obj-$(CONFIG_3C359) += 3c359.o
/*
* abyss.c: Network driver for the Madge Smart 16/4 PCI Mk2 token ring card.
*
* Written 1999-2000 by Adam Fritzler
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* This driver module supports the following cards:
* - Madge Smart 16/4 PCI Mk2
*
* Maintainer(s):
* AF Adam Fritzler
*
* Modification History:
* 30-Dec-99 AF Split off from the tms380tr driver.
* 22-Jan-00 AF Updated to use indirect read/writes
* 23-Nov-00 JG New PCI API, cleanups
*
*
* TODO:
* 1. See if we can use MMIO instead of inb/outb/inw/outw
* 2. Add support for Mk1 (has AT24 attached to the PCI
* config registers)
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/trdevice.h>
#include <asm/io.h>
#include <asm/irq.h>
#include "tms380tr.h"
#include "abyss.h" /* Madge-specific constants */
static char version[] __devinitdata =
"abyss.c: v1.02 23/11/2000 by Adam Fritzler\n";
#define ABYSS_IO_EXTENT 64
static DEFINE_PCI_DEVICE_TABLE(abyss_pci_tbl) = {
{ PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_MK2,
PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_TOKEN_RING << 8, 0x00ffffff, },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(pci, abyss_pci_tbl);
MODULE_LICENSE("GPL");
static int abyss_open(struct net_device *dev);
static int abyss_close(struct net_device *dev);
static void abyss_enable(struct net_device *dev);
static int abyss_chipset_init(struct net_device *dev);
static void abyss_read_eeprom(struct net_device *dev);
static unsigned short abyss_setnselout_pins(struct net_device *dev);
static void at24_writedatabyte(unsigned long regaddr, unsigned char byte);
static int at24_sendfullcmd(unsigned long regaddr, unsigned char cmd, unsigned char addr);
static int at24_sendcmd(unsigned long regaddr, unsigned char cmd);
static unsigned char at24_readdatabit(unsigned long regaddr);
static unsigned char at24_readdatabyte(unsigned long regaddr);
static int at24_waitforack(unsigned long regaddr);
static int at24_waitfornack(unsigned long regaddr);
static void at24_setlines(unsigned long regaddr, unsigned char clock, unsigned char data);
static void at24_start(unsigned long regaddr);
static unsigned char at24_readb(unsigned long regaddr, unsigned char addr);
static unsigned short abyss_sifreadb(struct net_device *dev, unsigned short reg)
{
return inb(dev->base_addr + reg);
}
static unsigned short abyss_sifreadw(struct net_device *dev, unsigned short reg)
{
return inw(dev->base_addr + reg);
}
static void abyss_sifwriteb(struct net_device *dev, unsigned short val, unsigned short reg)
{
outb(val, dev->base_addr + reg);
}
static void abyss_sifwritew(struct net_device *dev, unsigned short val, unsigned short reg)
{
outw(val, dev->base_addr + reg);
}
static struct net_device_ops abyss_netdev_ops;
static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static int versionprinted;
struct net_device *dev;
struct net_local *tp;
int ret, pci_irq_line;
unsigned long pci_ioaddr;
if (versionprinted++ == 0)
printk("%s", version);
if (pci_enable_device(pdev))
return -EIO;
/* Remove I/O space marker in bit 0. */
pci_irq_line = pdev->irq;
pci_ioaddr = pci_resource_start (pdev, 0);
/* At this point we have found a valid card. */
dev = alloc_trdev(sizeof(struct net_local));
if (!dev)
return -ENOMEM;
if (!request_region(pci_ioaddr, ABYSS_IO_EXTENT, dev->name)) {
ret = -EBUSY;
goto err_out_trdev;
}
ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
dev->name, dev);
if (ret)
goto err_out_region;
dev->base_addr = pci_ioaddr;
dev->irq = pci_irq_line;
printk("%s: Madge Smart 16/4 PCI Mk2 (Abyss)\n", dev->name);
printk("%s: IO: %#4lx IRQ: %d\n",
dev->name, pci_ioaddr, dev->irq);
/*
* The TMS SIF registers lay 0x10 above the card base address.
*/
dev->base_addr += 0x10;
ret = tmsdev_init(dev, &pdev->dev);
if (ret) {
printk("%s: unable to get memory for dev->priv.\n",
dev->name);
goto err_out_irq;
}
abyss_read_eeprom(dev);
printk("%s: Ring Station Address: %pM\n", dev->name, dev->dev_addr);
tp = netdev_priv(dev);
tp->setnselout = abyss_setnselout_pins;
tp->sifreadb = abyss_sifreadb;
tp->sifreadw = abyss_sifreadw;
tp->sifwriteb = abyss_sifwriteb;
tp->sifwritew = abyss_sifwritew;
memcpy(tp->ProductID, "Madge PCI 16/4 Mk2", PROD_ID_SIZE + 1);
dev->netdev_ops = &abyss_netdev_ops;
pci_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);
ret = register_netdev(dev);
if (ret)
goto err_out_tmsdev;
return 0;
err_out_tmsdev:
pci_set_drvdata(pdev, NULL);
tmsdev_term(dev);
err_out_irq:
free_irq(pdev->irq, dev);
err_out_region:
release_region(pci_ioaddr, ABYSS_IO_EXTENT);
err_out_trdev:
free_netdev(dev);
return ret;
}
static unsigned short abyss_setnselout_pins(struct net_device *dev)
{
unsigned short val = 0;
struct net_local *tp = netdev_priv(dev);
if(tp->DataRate == SPEED_4)
val |= 0x01; /* Set 4Mbps */
else
val |= 0x00; /* Set 16Mbps */
return val;
}
/*
* The following Madge boards should use this code:
* - Smart 16/4 PCI Mk2 (Abyss)
* - Smart 16/4 PCI Mk1 (PCI T)
* - Smart 16/4 Client Plus PnP (Big Apple)
* - Smart 16/4 Cardbus Mk2
*
* These access an Atmel AT24 SEEPROM using their glue chip registers.
*
*/
static void at24_writedatabyte(unsigned long regaddr, unsigned char byte)
{
int i;
for (i = 0; i < 8; i++) {
at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
at24_setlines(regaddr, 1, (byte >> (7-i))&0x01);
at24_setlines(regaddr, 0, (byte >> (7-i))&0x01);
}
}
static int at24_sendfullcmd(unsigned long regaddr, unsigned char cmd, unsigned char addr)
{
if (at24_sendcmd(regaddr, cmd)) {
at24_writedatabyte(regaddr, addr);
return at24_waitforack(regaddr);
}
return 0;
}
static int at24_sendcmd(unsigned long regaddr, unsigned char cmd)
{
int i;
for (i = 0; i < 10; i++) {
at24_start(regaddr);
at24_writedatabyte(regaddr, cmd);
if (at24_waitforack(regaddr))
return 1;
}
return 0;
}
static unsigned char at24_readdatabit(unsigned long regaddr)
{
unsigned char val;
at24_setlines(regaddr, 0, 1);
at24_setlines(regaddr, 1, 1);
val = (inb(regaddr) & AT24_DATA)?1:0;
at24_setlines(regaddr, 1, 1);
at24_setlines(regaddr, 0, 1);
return val;
}
static unsigned char at24_readdatabyte(unsigned long regaddr)
{
unsigned char data = 0;
int i;
for (i = 0; i < 8; i++) {
data <<= 1;
data |= at24_readdatabit(regaddr);
}
return data;
}
static int at24_waitforack(unsigned long regaddr)
{
int i;
for (i = 0; i < 10; i++) {
if ((at24_readdatabit(regaddr) & 0x01) == 0x00)
return 1;
}
return 0;
}
static int at24_waitfornack(unsigned long regaddr)
{
int i;
for (i = 0; i < 10; i++) {
if ((at24_readdatabit(regaddr) & 0x01) == 0x01)
return 1;
}
return 0;
}
static void at24_setlines(unsigned long regaddr, unsigned char clock, unsigned char data)
{
unsigned char val = AT24_ENABLE;
if (clock)
val |= AT24_CLOCK;
if (data)
val |= AT24_DATA;
outb(val, regaddr);
tms380tr_wait(20); /* Very necessary. */
}
static void at24_start(unsigned long regaddr)
{
at24_setlines(regaddr, 0, 1);
at24_setlines(regaddr, 1, 1);
at24_setlines(regaddr, 1, 0);
at24_setlines(regaddr, 0, 1);
}
static unsigned char at24_readb(unsigned long regaddr, unsigned char addr)
{
unsigned char data = 0xff;
if (at24_sendfullcmd(regaddr, AT24_WRITE, addr)) {
if (at24_sendcmd(regaddr, AT24_READ)) {
data = at24_readdatabyte(regaddr);
if (!at24_waitfornack(regaddr))
data = 0xff;
}
}
return data;
}
/*
* Enable basic functions of the Madge chipset needed
* for initialization.
*/
static void abyss_enable(struct net_device *dev)
{
unsigned char reset_reg;
unsigned long ioaddr;
ioaddr = dev->base_addr;
reset_reg = inb(ioaddr + PCIBM2_RESET_REG);
reset_reg |= PCIBM2_RESET_REG_CHIP_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
tms380tr_wait(100);
}
/*
* Enable the functions of the Madge chipset needed for
* full working order.
*/
static int abyss_chipset_init(struct net_device *dev)
{
unsigned char reset_reg;
unsigned long ioaddr;
ioaddr = dev->base_addr;
reset_reg = inb(ioaddr + PCIBM2_RESET_REG);
reset_reg |= PCIBM2_RESET_REG_CHIP_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
reset_reg &= ~(PCIBM2_RESET_REG_CHIP_NRES |
PCIBM2_RESET_REG_FIFO_NRES |
PCIBM2_RESET_REG_SIF_NRES);
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
tms380tr_wait(100);
reset_reg |= PCIBM2_RESET_REG_CHIP_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
reset_reg |= PCIBM2_RESET_REG_SIF_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
reset_reg |= PCIBM2_RESET_REG_FIFO_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
outb(PCIBM2_INT_CONTROL_REG_SINTEN |
PCIBM2_INT_CONTROL_REG_PCI_ERR_ENABLE,
ioaddr + PCIBM2_INT_CONTROL_REG);
outb(30, ioaddr + PCIBM2_FIFO_THRESHOLD);
return 0;
}
static inline void abyss_chipset_close(struct net_device *dev)
{
unsigned long ioaddr;
ioaddr = dev->base_addr;
outb(0, ioaddr + PCIBM2_RESET_REG);
}
/*
* Read configuration data from the AT24 SEEPROM on Madge cards.
*
*/
static void abyss_read_eeprom(struct net_device *dev)
{
struct net_local *tp;
unsigned long ioaddr;
unsigned short val;
int i;
tp = netdev_priv(dev);
ioaddr = dev->base_addr;
/* Must enable glue chip first */
abyss_enable(dev);
val = at24_readb(ioaddr + PCIBM2_SEEPROM_REG,
PCIBM2_SEEPROM_RING_SPEED);
tp->DataRate = val?SPEED_4:SPEED_16; /* set open speed */
printk("%s: SEEPROM: ring speed: %dMb/sec\n", dev->name, tp->DataRate);
val = at24_readb(ioaddr + PCIBM2_SEEPROM_REG,
PCIBM2_SEEPROM_RAM_SIZE) * 128;
printk("%s: SEEPROM: adapter RAM: %dkb\n", dev->name, val);
dev->addr_len = 6;
for (i = 0; i < 6; i++)
dev->dev_addr[i] = at24_readb(ioaddr + PCIBM2_SEEPROM_REG,
PCIBM2_SEEPROM_BIA+i);
}
static int abyss_open(struct net_device *dev)
{
abyss_chipset_init(dev);
tms380tr_open(dev);
return 0;
}
static int abyss_close(struct net_device *dev)
{
tms380tr_close(dev);
abyss_chipset_close(dev);
return 0;
}
static void __devexit abyss_detach (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
BUG_ON(!dev);
unregister_netdev(dev);
release_region(dev->base_addr-0x10, ABYSS_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
free_netdev(dev);
pci_set_drvdata(pdev, NULL);
}
static struct pci_driver abyss_driver = {
.name = "abyss",
.id_table = abyss_pci_tbl,
.probe = abyss_attach,
.remove = __devexit_p(abyss_detach),
};
static int __init abyss_init (void)
{
abyss_netdev_ops = tms380tr_netdev_ops;
abyss_netdev_ops.ndo_open = abyss_open;
abyss_netdev_ops.ndo_stop = abyss_close;
return pci_register_driver(&abyss_driver);
}
static void __exit abyss_rmmod (void)
{
pci_unregister_driver (&abyss_driver);
}
module_init(abyss_init);
module_exit(abyss_rmmod);
/*
* abyss.h: Header for the abyss tms380tr module
*
* Authors:
* - Adam Fritzler
*/
#ifndef __LINUX_MADGETR_H
#define __LINUX_MADGETR_H
#ifdef __KERNEL__
/*
* For Madge Smart 16/4 PCI Mk2. Since we increment the base address
* to get everything correct for the TMS SIF, we do these as negatives
* as they fall below the SIF in addressing.
*/
#define PCIBM2_INT_STATUS_REG ((short)-15)/* 0x01 */
#define PCIBM2_INT_CONTROL_REG ((short)-14)/* 0x02 */
#define PCIBM2_RESET_REG ((short)-12)/* 0x04 */
#define PCIBM2_SEEPROM_REG ((short)-9) /* 0x07 */
#define PCIBM2_INT_CONTROL_REG_SINTEN 0x02
#define PCIBM2_INT_CONTROL_REG_PCI_ERR_ENABLE 0x80
#define PCIBM2_INT_STATUS_REG_PCI_ERR 0x80
#define PCIBM2_RESET_REG_CHIP_NRES 0x01
#define PCIBM2_RESET_REG_FIFO_NRES 0x02
#define PCIBM2_RESET_REG_SIF_NRES 0x04
#define PCIBM2_FIFO_THRESHOLD 0x21
#define PCIBM2_BURST_LENGTH 0x22
/*
* Bits in PCIBM2_SEEPROM_REG.
*/
#define AT24_ENABLE 0x04
#define AT24_DATA 0x02
#define AT24_CLOCK 0x01
/*
* AT24 Commands.
*/
#define AT24_WRITE 0xA0
#define AT24_READ 0xA1
/*
* Addresses in AT24 SEEPROM.
*/
#define PCIBM2_SEEPROM_BIA 0x12
#define PCIBM2_SEEPROM_RING_SPEED 0x18
#define PCIBM2_SEEPROM_RAM_SIZE 0x1A
#define PCIBM2_SEEPROM_HWF1 0x1C
#define PCIBM2_SEEPROM_HWF2 0x1E
#endif /* __KERNEL__ */
#endif /* __LINUX_MADGETR_H */
This diff is collapsed.
/*======================================================================
A PCMCIA token-ring driver for IBM-based cards
This driver supports the IBM PCMCIA Token-Ring Card.
Written by Steve Kipisz, kipisz@vnet.ibm.com or
bungy@ibm.net
Written 1995,1996.
This code is based on pcnet_cs.c from David Hinds.
V2.2.0 February 1999 - Mike Phillips phillim@amtrak.com
Linux V2.2.x presented significant changes to the underlying
ibmtr.c code. Mainly the code became a lot more organized and
modular.
This caused the old PCMCIA Token Ring driver to give up and go
home early. Instead of just patching the old code to make it
work, the PCMCIA code has been streamlined, updated and possibly
improved.
This code now only contains code required for the Card Services.
All we do here is set the card up enough so that the real ibmtr.c
driver can find it and work with it properly.
i.e. We set up the io port, irq, mmio memory and shared ram
memory. This enables ibmtr_probe in ibmtr.c to find the card and
configure it as though it was a normal ISA and/or PnP card.
CHANGES
v2.2.5 April 1999 Mike Phillips (phillim@amtrak.com)
Obscure bug fix, required changed to ibmtr.c not ibmtr_cs.c
v2.2.7 May 1999 Mike Phillips (phillim@amtrak.com)
Updated to version 2.2.7 to match the first version of the kernel
that the modification to ibmtr.c were incorporated into.
v2.2.17 July 2000 Burt Silverman (burts@us.ibm.com)
Address translation feature of PCMCIA controller is usable so
memory windows can be placed in High memory (meaning above
0xFFFFF.)
======================================================================*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/trdevice.h>
#include <linux/ibmtr.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#define PCMCIA
#include "ibmtr.c"
/*====================================================================*/
/* Parameters that can be set with 'insmod' */
/* MMIO base address */
static u_long mmiobase = 0xce000;
/* SRAM base address */
static u_long srambase = 0xd0000;
/* SRAM size 8,16,32,64 */
static u_long sramsize = 64;
/* Ringspeed 4,16 */
static int ringspeed = 16;
module_param(mmiobase, ulong, 0);
module_param(srambase, ulong, 0);
module_param(sramsize, ulong, 0);
module_param(ringspeed, int, 0);
MODULE_LICENSE("GPL");
/*====================================================================*/
static int ibmtr_config(struct pcmcia_device *link);
static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase);
static void ibmtr_release(struct pcmcia_device *link);
static void ibmtr_detach(struct pcmcia_device *p_dev);
/*====================================================================*/
typedef struct ibmtr_dev_t {
struct pcmcia_device *p_dev;
struct net_device *dev;
struct tok_info *ti;
} ibmtr_dev_t;
static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
ibmtr_dev_t *info = dev_id;
struct net_device *dev = info->dev;
return tok_interrupt(irq, dev);
};
static int __devinit ibmtr_attach(struct pcmcia_device *link)
{
ibmtr_dev_t *info;
struct net_device *dev;
dev_dbg(&link->dev, "ibmtr_attach()\n");
/* Create new token-ring device */
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) return -ENOMEM;
dev = alloc_trdev(sizeof(struct tok_info));
if (!dev) {
kfree(info);
return -ENOMEM;
}
info->p_dev = link;
link->priv = info;
info->ti = netdev_priv(dev);
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
link->resource[0]->end = 4;
link->config_flags |= CONF_ENABLE_IRQ;
link->config_regs = PRESENT_OPTION;
info->dev = dev;
return ibmtr_config(link);
} /* ibmtr_attach */
static void ibmtr_detach(struct pcmcia_device *link)
{
struct ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
struct tok_info *ti = netdev_priv(dev);
dev_dbg(&link->dev, "ibmtr_detach\n");
/*
* When the card removal interrupt hits tok_interrupt(),
* bail out early, so we don't crash the machine
*/
ti->sram_phys |= 1;
unregister_netdev(dev);
del_timer_sync(&(ti->tr_timer));
ibmtr_release(link);
free_netdev(dev);
kfree(info);
} /* ibmtr_detach */
static int __devinit ibmtr_config(struct pcmcia_device *link)
{
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
struct tok_info *ti = netdev_priv(dev);
int i, ret;
dev_dbg(&link->dev, "ibmtr_config\n");
link->io_lines = 16;
link->config_index = 0x61;
/* Determine if this is PRIMARY or ALTERNATE. */
/* Try PRIMARY card at 0xA20-0xA23 */
link->resource[0]->start = 0xA20;
i = pcmcia_request_io(link);
if (i != 0) {
/* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
link->resource[0]->start = 0xA24;
ret = pcmcia_request_io(link);
if (ret)
goto failed;
}
dev->base_addr = link->resource[0]->start;
ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt);
if (ret)
goto failed;
dev->irq = link->irq;
ti->irq = link->irq;
ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
/* Allocate the MMIO memory window */
link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
link->resource[2]->flags |= WIN_USE_WAIT;
link->resource[2]->start = 0;
link->resource[2]->end = 0x2000;
ret = pcmcia_request_window(link, link->resource[2], 250);
if (ret)
goto failed;
ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase);
if (ret)
goto failed;
ti->mmio = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
/* Allocate the SRAM memory window */
link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
link->resource[3]->flags |= WIN_USE_WAIT;
link->resource[3]->start = 0;
link->resource[3]->end = sramsize * 1024;
ret = pcmcia_request_window(link, link->resource[3], 250);
if (ret)
goto failed;
ret = pcmcia_map_mem_page(link, link->resource[3], srambase);
if (ret)
goto failed;
ti->sram_base = srambase >> 12;
ti->sram_virt = ioremap(link->resource[3]->start,
resource_size(link->resource[3]));
ti->sram_phys = link->resource[3]->start;
ret = pcmcia_enable_device(link);
if (ret)
goto failed;
/* Set up the Token-Ring Controller Configuration Register and
turn on the card. Check the "Local Area Network Credit Card
Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup(dev, mmiobase);
SET_NETDEV_DEV(dev, &link->dev);
i = ibmtr_probe_card(dev);
if (i != 0) {
pr_notice("register_netdev() failed\n");
goto failed;
}
netdev_info(dev, "port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n",
dev->base_addr, dev->irq,
(u_long)ti->mmio, (u_long)(ti->sram_base << 12),
dev->dev_addr);
return 0;
failed:
ibmtr_release(link);
return -ENODEV;
} /* ibmtr_config */
static void ibmtr_release(struct pcmcia_device *link)
{
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
dev_dbg(&link->dev, "ibmtr_release\n");
if (link->resource[2]->end) {
struct tok_info *ti = netdev_priv(dev);
iounmap(ti->mmio);
}
pcmcia_disable_device(link);
}
static int ibmtr_suspend(struct pcmcia_device *link)
{
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if (link->open)
netif_device_detach(dev);
return 0;
}
static int __devinit ibmtr_resume(struct pcmcia_device *link)
{
ibmtr_dev_t *info = link->priv;
struct net_device *dev = info->dev;
if (link->open) {
ibmtr_probe(dev); /* really? */
netif_device_attach(dev);
}
return 0;
}
/*====================================================================*/
static void ibmtr_hw_setup(struct net_device *dev, u_int mmiobase)
{
int i;
/* Bizarre IBM behavior, there are 16 bits of information we
need to set, but the card only allows us to send 4 bits at a
time. For each byte sent to base_addr, bits 7-4 tell the
card which part of the 16 bits we are setting, bits 3-0 contain
the actual information */
/* First nibble provides 4 bits of mmio */
i = (mmiobase >> 16) & 0x0F;
outb(i, dev->base_addr);
/* Second nibble provides 3 bits of mmio */
i = 0x10 | ((mmiobase >> 12) & 0x0E);
outb(i, dev->base_addr);
/* Third nibble, hard-coded values */
i = 0x26;
outb(i, dev->base_addr);
/* Fourth nibble sets shared ram page size */
/* 8 = 00, 16 = 01, 32 = 10, 64 = 11 */
i = (sramsize >> 4) & 0x07;
i = ((i == 4) ? 3 : i) << 2;
i |= 0x30;
if (ringspeed == 16)
i |= 2;
if (dev->base_addr == 0xA24)
i |= 1;
outb(i, dev->base_addr);
/* 0x40 will release the card for use */
outb(0x40, dev->base_addr);
}
static const struct pcmcia_device_id ibmtr_ids[] = {
PCMCIA_DEVICE_PROD_ID12("3Com", "TokenLink Velocity PC Card", 0x41240e5b, 0x82c3734e),
PCMCIA_DEVICE_PROD_ID12("IBM", "TOKEN RING", 0xb569a6e5, 0xbf8eed47),
PCMCIA_DEVICE_NULL,
};
MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
static struct pcmcia_driver ibmtr_cs_driver = {
.owner = THIS_MODULE,
.name = "ibmtr_cs",
.probe = ibmtr_attach,
.remove = ibmtr_detach,
.id_table = ibmtr_ids,
.suspend = ibmtr_suspend,
.resume = ibmtr_resume,
};
static int __init init_ibmtr_cs(void)
{
return pcmcia_register_driver(&ibmtr_cs_driver);
}
static void __exit exit_ibmtr_cs(void)
{
pcmcia_unregister_driver(&ibmtr_cs_driver);
}
module_init(init_ibmtr_cs);
module_exit(exit_ibmtr_cs);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment