Commit 8502032b authored by Oskar Schirmer's avatar Oskar Schirmer Committed by Jeff Garzik

cs89x0 net driver minor fixes, SH4 support, and cmd line media support

parent ca685679
......@@ -51,7 +51,7 @@ TABLE OF CONTENTS
6.2 Information Required Before Contacting Technical Support
6.3 Obtaining the Latest Driver Version
6.4 Current maintainer
6.5 Kernel boot parameters
1.0 CIRRUS LOGIC LAN CS8900/CS8920 ETHERNET ADAPTERS
......@@ -690,4 +690,14 @@ the latest drivers and technical publications.
6.4 Current maintainer
In February 2000 the maintenance of this driver was assumed by Andrew
Morton <andrewm@uow.edu.au>
Morton <akpm@zip.com.au>
6.5 Kernel module parameters
For use in embedded environments with no cs89x0 EEPROM, the kernel boot
parameter `cs89x0_media=' has been implemented. Usage is:
cs89x0_media=rj45 or
cs89x0_media=aui or
cs89x0_media=bnc
......@@ -81,6 +81,9 @@
: Make `version[]' __initdata
: Uninlined the read/write reg/word functions.
Oskar Schirmer : oskar@scara.com
: HiCO.SH4 (superh) support added (irq#1, cs89x0_media=)
*/
/* Always include 'config.h' first in case the user wants to turn on
......@@ -156,6 +159,10 @@ static char version[] __initdata =
static unsigned int netcard_portlist[] __initdata =
{ 0x80090303, 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
static unsigned int cs8900_irq_map[] = {12,0,0,0};
#elif defined(CONFIG_SH_HICOSH4)
static unsigned int netcard_portlist[] __initdata =
{ 0x0300, 0};
static unsigned int cs8900_irq_map[] = {1,0,0,0};
#else
static unsigned int netcard_portlist[] __initdata =
{ 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0};
......@@ -247,6 +254,20 @@ static int __init dma_fn(char *str)
__setup("cs89x0_dma=", dma_fn);
#endif /* !defined(MODULE) && (ALLOW_DMA != 0) */
#ifndef MODULE
static int g_cs89x0_media__force;
static int __init media_fn(char *str)
{
if (!strcmp(str, "rj45")) g_cs89x0_media__force = FORCE_RJ45;
else if (!strcmp(str, "aui")) g_cs89x0_media__force = FORCE_AUI;
else if (!strcmp(str, "bnc")) g_cs89x0_media__force = FORCE_BNC;
return 1;
}
__setup("cs89x0_media=", media_fn);
#endif
/* Check for a network adaptor of this type, and return '0' iff one exists.
If dev->base_addr == 0, probe all likely locations.
......@@ -382,6 +403,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr)
lp->dma = g_cs89x0_dma;
lp->dmasize = 16; /* Could make this an option... */
}
#endif
#ifndef MODULE
lp->force = g_cs89x0_media__force;
#endif
}
lp = (struct net_local *)dev->priv;
......@@ -394,6 +418,12 @@ cs89x0_probe1(struct net_device *dev, int ioaddr)
goto out1;
}
#ifdef CONFIG_SH_HICOSH4
/* truely reset the chip */
outw(0x0114, ioaddr + ADD_PORT);
outw(0x0040, ioaddr + DATA_PORT);
#endif
/* if they give us an odd I/O address, then do ONE write to
the address port, to get it back to address zero, where we
expect to find the EISA signature word. An IO with a base of 0x3
......@@ -413,7 +443,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr)
}
printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) {
if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) {
printk(KERN_ERR "%s: incorrect signature 0x%x\n",
dev->name, inw(ioaddr + DATA_PORT));
retval = -ENODEV;
......@@ -454,6 +484,39 @@ printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
EEPROM read on reset. So, if the chip says it read the EEPROM
the driver will always do *something* instead of complain that
adapter_cnf is 0. */
#ifdef CONFIG_SH_HICOSH4
if (1) {
/* For the HiCO.SH4 board, things are different: we don't
have EEPROM, but there is some data in flash, so we go
get it there directly (MAC). */
__u16 *confd;
short cnt;
if (((* (volatile __u32 *) 0xa0013ff0) & 0x00ffffff)
== 0x006c3000) {
confd = (__u16*) 0xa0013fc0;
} else {
confd = (__u16*) 0xa001ffc0;
}
cnt = (*confd++ & 0x00ff) >> 1;
while (--cnt > 0) {
__u16 j = *confd++;
switch (j & 0x0fff) {
case PP_IA:
for (i = 0; i < ETH_ALEN/2; i++) {
dev->dev_addr[i*2] = confd[i] & 0xFF;
dev->dev_addr[i*2+1] = confd[i] >> 8;
}
break;
}
j = (j >> 12) + 1;
confd += j;
cnt -= j;
}
} else
#endif
if ((readreg(dev, PP_SelfST) & (EEPROM_OK | EEPROM_PRESENT)) ==
(EEPROM_OK|EEPROM_PRESENT)) {
/* Load the MAC. */
......@@ -507,6 +570,11 @@ printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
printk("\n");
/* First check to see if an EEPROM is attached. */
#ifdef CONFIG_SH_HICOSH4 /* no EEPROM on HiCO, don't hazzle with it here */
if (1) {
printk(KERN_NOTICE "cs89x0: No EEPROM on HiCO.SH4\n");
} else
#endif
if ((readreg(dev, PP_SelfST) & EEPROM_PRESENT) == 0)
printk(KERN_WARNING "cs89x0: No EEPROM, relying on command line....\n");
else if (get_eeprom_data(dev, START_EEPROM_DATA,CHKSUM_LEN,eeprom_buff) < 0) {
......@@ -616,10 +684,10 @@ printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT));
}
/* print the ethernet address. */
printk(", MAC ");
printk(", MAC");
for (i = 0; i < ETH_ALEN; i++)
{
printk("%s%02x", i ? ":" : "", dev->dev_addr[i]);
printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]);
}
dev->open = net_open;
......@@ -1046,6 +1114,7 @@ net_open(struct net_device *dev)
int i;
int ret;
#ifndef CONFIG_SH_HICOSH4 /* uses irq#1, so this wont work */
if (dev->irq < 2) {
/* Allow interrupts to be generated by the chip */
/* Cirrus' release had this: */
......@@ -1056,7 +1125,7 @@ net_open(struct net_device *dev)
writereg(dev, PP_BusCTL, ENABLE_IRQ | MEMORY_ON);
for (i = 2; i < CS8920_NO_INTS; i++) {
if ((1 << dev->irq) & lp->irq_map) {
if ((1 << i) & lp->irq_map) {
if (request_irq(i, net_interrupt, 0, dev->name, dev) == 0) {
dev->irq = i;
write_irq(dev, lp->chip_type, i);
......@@ -1072,7 +1141,10 @@ net_open(struct net_device *dev)
ret = -EAGAIN;
goto bad_out;
}
} else {
}
else
#endif
{
if (((1 << dev->irq) & lp->irq_map) == 0) {
printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n",
dev->name, dev->irq, lp->irq_map);
......
......@@ -437,7 +437,11 @@
#define IRQ_MAP_EEPROM_DATA 0x0046 /* Offset into eeprom for the IRQ map */
#define IRQ_MAP_LEN 0x0004 /* No of bytes to read for the IRQ map */
#define PNP_IRQ_FRMT 0x0022 /* PNP small item IRQ format */
#ifdef CONFIG_SH_HICOSH4
#define CS8900_IRQ_MAP 0x0002 /* HiCO-SH4 board has its IRQ on #1 */
#else
#define CS8900_IRQ_MAP 0x1c20 /* This IRQ map is fixed */
#endif
#define CS8920_NO_INTS 0x0F /* Max CS8920 interrupt select # */
......
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