X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fat1700.c;h=e613cc289749d6a89ee595eb24b8285a95b41163;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=7543bfbacfec9bda0b38653116995e2d1d4339de;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index 7543bfbac..e613cc289 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -34,10 +34,6 @@ only is it difficult to detect, it also moves around in I/O space in response to inb()s from other device probes! */ -/* - 99/03/03 Allied Telesis RE1000 Plus support by T.Hagawa - 99/12/30 port to 2.3.35 by K.Takai -*/ #include #include @@ -56,15 +52,17 @@ #include #include #include +#include #include -#include #include #include static char version[] __initdata = "at1700.c:v1.15 4/7/98 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; +#define DRV_NAME "at1700" + /* Tunable parameters. */ /* When to switch from the 64-entry multicast filter to Rx-all-multicast. */ @@ -80,21 +78,14 @@ static int fmv18x_probe_list[] __initdata = { * ISA */ -#ifndef CONFIG_X86_PC9800 static unsigned at1700_probe_list[] __initdata = { 0x260, 0x280, 0x2a0, 0x240, 0x340, 0x320, 0x380, 0x300, 0 }; -#else /* CONFIG_X86_PC9800 */ -static unsigned at1700_probe_list[] __initdata = { - 0x1d6, 0x1d8, 0x1da, 0x1d4, 0xd4, 0xd2, 0xd8, 0xd0, 0 -}; - -#endif /* CONFIG_X86_PC9800 */ /* * MCA */ -#ifdef CONFIG_MCA +#ifdef CONFIG_MCA_LEGACY static int at1700_ioaddr_pattern[] __initdata = { 0x00, 0x04, 0x01, 0x05, 0x02, 0x06, 0x03, 0x07 }; @@ -133,7 +124,6 @@ struct net_local { /* Offsets from the base address. */ -#ifndef CONFIG_X86_PC9800 #define STATUS 0 #define TX_STATUS 0 #define RX_STATUS 1 @@ -161,34 +151,6 @@ struct net_local { #define RESET 31 /* Write to reset some parts of the chip. */ #define AT1700_IO_EXTENT 32 #define PORT_OFFSET(o) (o) -#else /* CONFIG_X86_PC9800 */ -#define STATUS (0x0000) -#define TX_STATUS (0x0000) -#define RX_STATUS (0x0001) -#define TX_INTR (0x0200)/* Bit-mapped interrupt enable registers. */ -#define RX_INTR (0x0201) -#define TX_MODE (0x0400) -#define RX_MODE (0x0401) -#define CONFIG_0 (0x0600)/* Misc. configuration settings. */ -#define CONFIG_1 (0x0601) -/* Run-time register bank 2 definitions. */ -#define DATAPORT (0x0800)/* Word-wide DMA or programmed-I/O dataport. */ -#define TX_START (0x0a00) -#define COL16CNTL (0x0a01)/* Controll Reg for 16 collisions */ -#define MODE13 (0x0c01) -#define RX_CTRL (0x0e00) -/* Configuration registers only on the '865A/B chips. */ -#define EEPROM_Ctrl (0x1000) -#define EEPROM_Data (0x1200) -#define CARDSTATUS 16 /* FMV-18x Card Status */ -#define CARDSTATUS1 17 /* FMV-18x Card Status */ -#define IOCONFIG (0x1400)/* Either read the jumper, or move the I/O. */ -#define IOCONFIG1 (0x1600) -#define SAPROM 20 /* The station address PROM, if no EEPROM. */ -#define MODE24 (0x1800)/* The station address PROM, if no EEPROM. */ -#define RESET (0x1e01)/* Write to reset some parts of the chip. */ -#define PORT_OFFSET(o) ({ int _o_ = (o); (_o_ & ~1) * 0x100 + (_o_ & 1); }) -#endif /* CONFIG_X86_PC9800 */ #define TX_TIMEOUT 10 @@ -208,7 +170,7 @@ static void set_rx_mode(struct net_device *dev); static void net_tx_timeout (struct net_device *dev); -#ifdef CONFIG_MCA +#ifdef CONFIG_MCA_LEGACY struct at1720_mca_adapters_struct { char* name; int id; @@ -230,31 +192,19 @@ static struct at1720_mca_adapters_struct at1720_mca_adapters[] __initdata = { (detachable devices only). */ -#ifndef CONFIG_X86_PC9800 static int io = 0x260; -#else -static int io = 0xd0; -#endif static int irq; static void cleanup_card(struct net_device *dev) { -#ifdef CONFIG_MCA +#ifdef CONFIG_MCA_LEGACY struct net_local *lp = netdev_priv(dev); - if (lp->mca_slot) + if (lp->mca_slot >= 0) mca_mark_as_unused(lp->mca_slot); #endif free_irq(dev->irq, NULL); -#ifndef CONFIG_X86_PC9800 release_region(dev->base_addr, AT1700_IO_EXTENT); -#else - { - int i; - for (i = 0; i < 0x2000; i += 0x200) - release_region(dev->base_addr + i, 2); - } -#endif } struct net_device * __init at1700_probe(int unit) @@ -321,20 +271,8 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) int slot, ret = -ENODEV; struct net_local *lp = netdev_priv(dev); -#ifndef CONFIG_X86_PC9800 - if (!request_region(ioaddr, AT1700_IO_EXTENT, dev->name)) + if (!request_region(ioaddr, AT1700_IO_EXTENT, DRV_NAME)) return -EBUSY; -#else - for (i = 0; i < 0x2000; i += 0x0200) { - if (!request_region(ioaddr + i, 2, dev->name)) { - while (i > 0) { - i -= 0x0200; - release_region(ioaddr + i, 2); - } - return -EBUSY; - } - } -#endif /* Resetting the chip doesn't reset the ISA interface, so don't bother. That means we have to be careful with the register values we probe @@ -346,7 +284,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) read_eeprom(ioaddr, 6), inw(ioaddr + EEPROM_Ctrl)); #endif -#ifdef CONFIG_MCA +#ifdef CONFIG_MCA_LEGACY /* rEnE (rene@bss.lu): got this from 3c509 driver source , adapted for AT1720 */ /* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch, heavily @@ -417,7 +355,7 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr) goto err_out; } -#ifdef CONFIG_MCA +#ifdef CONFIG_MCA_LEGACY found: #endif @@ -425,15 +363,8 @@ found: outb(0, ioaddr + RESET); if (is_at1700) { -#ifndef CONFIG_X86_PC9800 irq = at1700_irqmap[(read_eeprom(ioaddr, 12)&0x04) | (read_eeprom(ioaddr, 0)>>14)]; -#else - { - char re1000plus_irqmap[4] = {3, 5, 6, 12}; - irq = re1000plus_irqmap[inb(ioaddr + IOCONFIG1) >> 6]; - } -#endif } else { /* Check PnP mode for FMV-183/184/183A/184A. */ /* This PnP routine is very poor. IO and IRQ should be known. */ @@ -444,11 +375,11 @@ found: break; } if (i == 8) { - goto err_out; + goto err_mca; } } else { if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr) - goto err_out; + goto err_mca; irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03]; } } @@ -517,11 +448,7 @@ found: /* Switch to bank 2 */ /* Lock our I/O address, and set manual processing mode for 16 collisions. */ outb(0x08, ioaddr + CONFIG_1); -#ifndef CONFIG_X86_PC9800 outb(dev->if_port, ioaddr + MODE13); -#else - outb(0, ioaddr + MODE13); -#endif outb(0x00, ioaddr + COL16CNTL); if (net_debug) @@ -542,22 +469,22 @@ found: lp->jumpered = is_fmv18x; lp->mca_slot = slot; /* Snarf the interrupt vector now. */ - ret = request_irq(irq, &net_interrupt, 0, dev->name, dev); + ret = request_irq(irq, &net_interrupt, 0, DRV_NAME, dev); if (ret) { printk (" AT1700 at %#3x is unusable due to a conflict on" "IRQ %d.\n", ioaddr, irq); - goto err_out; + goto err_mca; } return 0; +err_mca: +#ifdef CONFIG_MCA_LEGACY + if (slot >= 0) + mca_mark_as_unused(slot); +#endif err_out: -#ifndef CONFIG_X86_PC9800 release_region(ioaddr, AT1700_IO_EXTENT); -#else - for (i = 0; i < 0x2000; i += 0x0200) - release_region(ioaddr + i, 2); -#endif return ret; } @@ -568,13 +495,6 @@ err_out: #define EE_DATA_WRITE 0x80 /* EEPROM chip data in, in reg. 17. */ #define EE_DATA_READ 0x80 /* EEPROM chip data out, in reg. 17. */ -/* Delay between EEPROM clock transitions. */ -#ifndef CONFIG_X86_PC9800 -#define eeprom_delay() do { } while (0) -#else -#define eeprom_delay() __asm__ ("out%B0 %%al,%0" :: "N"(0x5f)) -#endif - /* The EEPROM commands include the alway-set leading bit. */ #define EE_WRITE_CMD (5 << 6) #define EE_READ_CMD (6 << 6) @@ -593,22 +513,17 @@ static int __init read_eeprom(long ioaddr, int location) short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; outb(EE_CS, ee_addr); outb(dataval, ee_daddr); - eeprom_delay(); outb(EE_CS | EE_SHIFT_CLK, ee_addr); /* EEPROM clock tick. */ - eeprom_delay(); } outb(EE_DATA_WRITE, ee_daddr); for (i = 16; i > 0; i--) { outb(EE_CS, ee_addr); - eeprom_delay(); outb(EE_CS | EE_SHIFT_CLK, ee_addr); - eeprom_delay(); retval = (retval << 1) | ((inb(ee_daddr) & EE_DATA_READ) ? 1 : 0); } /* Terminate the EEPROM access. */ outb(EE_CS, ee_addr); - eeprom_delay(); outb(EE_SHIFT_CLK, ee_addr); outb(0, ee_addr); return retval; @@ -980,9 +895,9 @@ set_rx_mode(struct net_device *dev) #ifdef MODULE static struct net_device *dev_at1700; -MODULE_PARM(io, "i"); -MODULE_PARM(irq, "i"); -MODULE_PARM(net_debug, "i"); +module_param(io, int, 0); +module_param(irq, int, 0); +module_param(net_debug, int, 0); MODULE_PARM_DESC(io, "AT1700/FMV18X I/O base address"); MODULE_PARM_DESC(irq, "AT1700/FMV18X IRQ number"); MODULE_PARM_DESC(net_debug, "AT1700/FMV18X debug level (0-6)");