Commit 064bff1c authored by Greg Ungerer's avatar Greg Ungerer Committed by David S. Miller

net: add support for NS8390 based eth controllers on some ColdFire CPU boards

A number of older ColdFire CPU based boards use NS8390 based network
controllers. Most use the Davicom 9008F or the UMC 9008F. This driver
provides the support code to get these devices working on these platforms.

Generally the NS8390 based eth device is direct connected via the general
purpose bus of the ColdFire CPU. So its addressing and interrupt setup is
fixed on each of the different platforms (classic platform setup).

This driver is based on the other drivers/net/ethernet/8390 drivers, and
includes the lib8390.c code. It uses the existing definitions of the
board NS8390 device addresses, interrupts and access types from the
arch/m68k/include/asm/mcf8390.h, but moves the IO access functions into
the driver code and out of that header.
Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c624880
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#if defined(CONFIG_ARN5206) #if defined(CONFIG_ARN5206)
#define NE2000_ADDR 0x40000300 #define NE2000_ADDR 0x40000300
#define NE2000_ODDOFFSET 0x00010000 #define NE2000_ODDOFFSET 0x00010000
#define NE2000_ADDRSIZE 0x00020000
#define NE2000_IRQ_VECTOR 0xf0 #define NE2000_IRQ_VECTOR 0xf0
#define NE2000_IRQ_PRIORITY 2 #define NE2000_IRQ_PRIORITY 2
#define NE2000_IRQ_LEVEL 4 #define NE2000_IRQ_LEVEL 4
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
#if defined(CONFIG_M5206eC3) #if defined(CONFIG_M5206eC3)
#define NE2000_ADDR 0x40000300 #define NE2000_ADDR 0x40000300
#define NE2000_ODDOFFSET 0x00010000 #define NE2000_ODDOFFSET 0x00010000
#define NE2000_ADDRSIZE 0x00020000
#define NE2000_IRQ_VECTOR 0x1c #define NE2000_IRQ_VECTOR 0x1c
#define NE2000_IRQ_PRIORITY 2 #define NE2000_IRQ_PRIORITY 2
#define NE2000_IRQ_LEVEL 4 #define NE2000_IRQ_LEVEL 4
...@@ -54,6 +56,7 @@ ...@@ -54,6 +56,7 @@
#if defined(CONFIG_M5206e) && defined(CONFIG_NETtel) #if defined(CONFIG_M5206e) && defined(CONFIG_NETtel)
#define NE2000_ADDR 0x30000300 #define NE2000_ADDR 0x30000300
#define NE2000_ADDRSIZE 0x00001000
#define NE2000_IRQ_VECTOR 25 #define NE2000_IRQ_VECTOR 25
#define NE2000_IRQ_PRIORITY 1 #define NE2000_IRQ_PRIORITY 1
#define NE2000_IRQ_LEVEL 3 #define NE2000_IRQ_LEVEL 3
...@@ -63,6 +66,7 @@ ...@@ -63,6 +66,7 @@
#if defined(CONFIG_M5307C3) #if defined(CONFIG_M5307C3)
#define NE2000_ADDR 0x40000300 #define NE2000_ADDR 0x40000300
#define NE2000_ODDOFFSET 0x00010000 #define NE2000_ODDOFFSET 0x00010000
#define NE2000_ADDRSIZE 0x00020000
#define NE2000_IRQ_VECTOR 0x1b #define NE2000_IRQ_VECTOR 0x1b
#define NE2000_BYTE volatile unsigned short #define NE2000_BYTE volatile unsigned short
#endif #endif
...@@ -70,6 +74,7 @@ ...@@ -70,6 +74,7 @@
#if defined(CONFIG_M5272) && defined(CONFIG_NETtel) #if defined(CONFIG_M5272) && defined(CONFIG_NETtel)
#define NE2000_ADDR 0x30600300 #define NE2000_ADDR 0x30600300
#define NE2000_ODDOFFSET 0x00008000 #define NE2000_ODDOFFSET 0x00008000
#define NE2000_ADDRSIZE 0x00010000
#define NE2000_IRQ_VECTOR 67 #define NE2000_IRQ_VECTOR 67
#undef BSWAP #undef BSWAP
#define BSWAP(w) (w) #define BSWAP(w) (w)
...@@ -82,6 +87,7 @@ ...@@ -82,6 +87,7 @@
#define NE2000_ADDR0 0x30600300 #define NE2000_ADDR0 0x30600300
#define NE2000_ADDR1 0x30800300 #define NE2000_ADDR1 0x30800300
#define NE2000_ODDOFFSET 0x00008000 #define NE2000_ODDOFFSET 0x00008000
#define NE2000_ADDRSIZE 0x00010000
#define NE2000_IRQ_VECTOR0 27 #define NE2000_IRQ_VECTOR0 27
#define NE2000_IRQ_VECTOR1 29 #define NE2000_IRQ_VECTOR1 29
#undef BSWAP #undef BSWAP
...@@ -94,6 +100,7 @@ ...@@ -94,6 +100,7 @@
#if defined(CONFIG_M5307) && defined(CONFIG_SECUREEDGEMP3) #if defined(CONFIG_M5307) && defined(CONFIG_SECUREEDGEMP3)
#define NE2000_ADDR 0x30600300 #define NE2000_ADDR 0x30600300
#define NE2000_ODDOFFSET 0x00008000 #define NE2000_ODDOFFSET 0x00008000
#define NE2000_ADDRSIZE 0x00010000
#define NE2000_IRQ_VECTOR 27 #define NE2000_IRQ_VECTOR 27
#undef BSWAP #undef BSWAP
#define BSWAP(w) (w) #define BSWAP(w) (w)
...@@ -105,6 +112,7 @@ ...@@ -105,6 +112,7 @@
#if defined(CONFIG_ARN5307) #if defined(CONFIG_ARN5307)
#define NE2000_ADDR 0xfe600300 #define NE2000_ADDR 0xfe600300
#define NE2000_ODDOFFSET 0x00010000 #define NE2000_ODDOFFSET 0x00010000
#define NE2000_ADDRSIZE 0x00020000
#define NE2000_IRQ_VECTOR 0x1b #define NE2000_IRQ_VECTOR 0x1b
#define NE2000_IRQ_PRIORITY 2 #define NE2000_IRQ_PRIORITY 2
#define NE2000_IRQ_LEVEL 3 #define NE2000_IRQ_LEVEL 3
...@@ -114,129 +122,10 @@ ...@@ -114,129 +122,10 @@
#if defined(CONFIG_M5407C3) #if defined(CONFIG_M5407C3)
#define NE2000_ADDR 0x40000300 #define NE2000_ADDR 0x40000300
#define NE2000_ODDOFFSET 0x00010000 #define NE2000_ODDOFFSET 0x00010000
#define NE2000_ADDRSIZE 0x00020000
#define NE2000_IRQ_VECTOR 0x1b #define NE2000_IRQ_VECTOR 0x1b
#define NE2000_BYTE volatile unsigned short #define NE2000_BYTE volatile unsigned short
#endif #endif
/****************************************************************************/
/*
* Side-band address space for odd address requires re-mapping
* many of the standard ISA access functions.
*/
#ifdef NE2000_ODDOFFSET
#undef outb
#undef outb_p
#undef inb
#undef inb_p
#undef outsb
#undef outsw
#undef insb
#undef insw
#define outb ne2000_outb
#define inb ne2000_inb
#define outb_p ne2000_outb
#define inb_p ne2000_inb
#define outsb ne2000_outsb
#define outsw ne2000_outsw
#define insb ne2000_insb
#define insw ne2000_insw
#ifndef COLDFIRE_NE2000_FUNCS
void ne2000_outb(unsigned int val, unsigned int addr);
int ne2000_inb(unsigned int addr);
void ne2000_insb(unsigned int addr, void *vbuf, int unsigned long len);
void ne2000_insw(unsigned int addr, void *vbuf, unsigned long len);
void ne2000_outsb(unsigned int addr, void *vbuf, unsigned long len);
void ne2000_outsw(unsigned int addr, void *vbuf, unsigned long len);
#else
/*
* This macro converts a conventional register address into the
* real memory pointer of the mapped NE2000 device.
* On most NE2000 implementations on ColdFire boards the chip is
* mapped in kinda funny, due to its ISA heritage.
*/
#define NE2000_PTR(addr) ((addr&0x1)?(NE2000_ODDOFFSET+addr-1):(addr))
#define NE2000_DATA_PTR(addr) (addr)
void ne2000_outb(unsigned int val, unsigned int addr)
{
NE2000_BYTE *rp;
rp = (NE2000_BYTE *) NE2000_PTR(addr);
*rp = RSWAP(val);
}
int ne2000_inb(unsigned int addr)
{
NE2000_BYTE *rp, val;
rp = (NE2000_BYTE *) NE2000_PTR(addr);
val = *rp;
return((int) ((NE2000_BYTE) RSWAP(val)));
}
void ne2000_insb(unsigned int addr, void *vbuf, int unsigned long len)
{
NE2000_BYTE *rp, val;
unsigned char *buf;
buf = (unsigned char *) vbuf;
rp = (NE2000_BYTE *) NE2000_DATA_PTR(addr);
for (; (len > 0); len--) {
val = *rp;
*buf++ = RSWAP(val);
}
}
void ne2000_insw(unsigned int addr, void *vbuf, unsigned long len)
{
volatile unsigned short *rp;
unsigned short w, *buf;
buf = (unsigned short *) vbuf;
rp = (volatile unsigned short *) NE2000_DATA_PTR(addr);
for (; (len > 0); len--) {
w = *rp;
*buf++ = BSWAP(w);
}
}
void ne2000_outsb(unsigned int addr, const void *vbuf, unsigned long len)
{
NE2000_BYTE *rp, val;
unsigned char *buf;
buf = (unsigned char *) vbuf;
rp = (NE2000_BYTE *) NE2000_DATA_PTR(addr);
for (; (len > 0); len--) {
val = *buf++;
*rp = RSWAP(val);
}
}
void ne2000_outsw(unsigned int addr, const void *vbuf, unsigned long len)
{
volatile unsigned short *rp;
unsigned short w, *buf;
buf = (unsigned short *) vbuf;
rp = (volatile unsigned short *) NE2000_DATA_PTR(addr);
for (; (len > 0); len--) {
w = *buf++;
*rp = BSWAP(w);
}
}
#endif /* COLDFIRE_NE2000_FUNCS */
#endif /* NE2000_OFFOFFSET */
/****************************************************************************/ /****************************************************************************/
#endif /* mcf8390_h */ #endif /* mcf8390_h */
...@@ -162,6 +162,20 @@ config MAC8390 ...@@ -162,6 +162,20 @@ config MAC8390
and read the Ethernet-HOWTO, available from and read the Ethernet-HOWTO, available from
<http://www.tldp.org/docs.html#howto>. <http://www.tldp.org/docs.html#howto>.
config MCF8390
tristate "ColdFire NS8390 based Ethernet support"
depends on COLDFIRE
select CRC32
---help---
This driver is for Ethernet devices using an NS8390-compatible
chipset on many common ColdFire CPU based boards. Many of the older
Freescale dev boards use this, and some other common boards like
some SnapGear routers do as well.
If you have one of these boards and want to use the network interface
on them then choose Y. To compile this driver as a module, choose M
here, the module will be called mcf8390.
config NE2000 config NE2000
tristate "NE2000/NE1000 support" tristate "NE2000/NE1000 support"
depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX) depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX)
......
...@@ -14,6 +14,7 @@ obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390p.o ...@@ -14,6 +14,7 @@ obj-$(CONFIG_HPLAN_PLUS) += hp-plus.o 8390p.o
obj-$(CONFIG_HPLAN) += hp.o 8390p.o obj-$(CONFIG_HPLAN) += hp.o 8390p.o
obj-$(CONFIG_HYDRA) += hydra.o 8390.o obj-$(CONFIG_HYDRA) += hydra.o 8390.o
obj-$(CONFIG_LNE390) += lne390.o 8390.o obj-$(CONFIG_LNE390) += lne390.o 8390.o
obj-$(CONFIG_MCF8390) += mcf8390.o 8390.o
obj-$(CONFIG_NE2000) += ne.o 8390p.o obj-$(CONFIG_NE2000) += ne.o 8390p.o
obj-$(CONFIG_NE2_MCA) += ne2.o 8390p.o obj-$(CONFIG_NE2_MCA) += ne2.o 8390p.o
obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o
......
This diff is collapsed.
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