X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fpcmcia%2Fpcnet_cs.c;h=b0126304ca08398ba3b40189c154b9ada522750f;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=2db4baabe9c916f5b47e5d5e447954a591410270;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 2db4baabe..b0126304c 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -71,7 +71,7 @@ static char *if_names[] = { "auto", "10baseT", "10base2"}; #ifdef PCMCIA_DEBUG static int pc_debug = PCMCIA_DEBUG; -MODULE_PARM(pc_debug, "i"); +module_param(pc_debug, int, 0); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) static char *version = "pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)"; @@ -87,12 +87,7 @@ MODULE_AUTHOR("David Hinds "); MODULE_DESCRIPTION("NE2000 compatible PCMCIA ethernet driver"); MODULE_LICENSE("GPL"); -#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i") - -/* Bit map of interrupts to choose from */ -INT_MODULE_PARM(irq_mask, 0xdeb8); -static int irq_list[4] = { -1 }; -MODULE_PARM(irq_list, "1-4i"); +#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) INT_MODULE_PARM(if_port, 1); /* Transceiver type */ INT_MODULE_PARM(use_big_buf, 1); /* use 64K packet buffer? */ @@ -104,7 +99,7 @@ INT_MODULE_PARM(full_duplex, 0); /* full duplex? */ /* Ugh! Let the user hardwire the hardware address for queer cards */ static int hw_addr[6] = { 0, /* ... */ }; -MODULE_PARM(hw_addr, "6i"); +module_param_array(hw_addr, int, NULL, 0); /*====================================================================*/ @@ -227,7 +222,7 @@ typedef struct pcnet_dev_t { dev_link_t link; dev_node_t node; u_int flags; - caddr_t base; + void __iomem *base; struct timer_list watchdog; int stale, fast_poll; u_char phy_id; @@ -256,7 +251,7 @@ static dev_link_t *pcnet_attach(void) dev_link_t *link; struct net_device *dev; client_reg_t client_reg; - int i, ret; + int ret; DEBUG(0, "pcnet_attach()\n"); @@ -268,12 +263,7 @@ static dev_link_t *pcnet_attach(void) link->priv = dev; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; - link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; - if (irq_list[0] == -1) - link->irq.IRQInfo2 = irq_mask; - else - for (i = 0; i < 4; i++) - link->irq.IRQInfo2 |= 1 << irq_list[i]; + link->irq.IRQInfo1 = IRQ_LEVEL_ID; link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; @@ -286,7 +276,6 @@ static dev_link_t *pcnet_attach(void) link->next = dev_list; dev_list = link; client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; client_reg.EventMask = CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | @@ -352,7 +341,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link) struct net_device *dev = link->priv; win_req_t req; memreq_t mem; - u_char *base, *virt; + u_char __iomem *base, *virt; int i, j; /* Allocate a small memory window */ @@ -399,7 +388,7 @@ static hw_info_t *get_hwinfo(dev_link_t *link) static hw_info_t *get_prom(dev_link_t *link) { struct net_device *dev = link->priv; - ioaddr_t ioaddr = dev->base_addr; + kio_addr_t ioaddr = dev->base_addr; u_char prom[32]; int i, j; @@ -475,7 +464,7 @@ static hw_info_t *get_dl10019(dev_link_t *link) static hw_info_t *get_ax88190(dev_link_t *link) { struct net_device *dev = link->priv; - ioaddr_t ioaddr = dev->base_addr; + kio_addr_t ioaddr = dev->base_addr; int i, j; /* Not much of a test, but the alternatives are messy */ @@ -722,6 +711,7 @@ static void pcnet_config(dev_link_t *link) link->dev = &info->node; link->state &= ~DEV_CONFIG_PENDING; + SET_NETDEV_DEV(dev, &handle_to_dev(handle)); #ifdef CONFIG_NET_POLL_CONTROLLER dev->poll_controller = ei_poll; @@ -862,7 +852,7 @@ static int pcnet_event(event_t event, int priority, #define MDIO_DATA_READ 0x10 #define MDIO_MASK 0x0f -static void mdio_sync(ioaddr_t addr) +static void mdio_sync(kio_addr_t addr) { int bits, mask = inb(addr) & MDIO_MASK; for (bits = 0; bits < 32; bits++) { @@ -871,7 +861,7 @@ static void mdio_sync(ioaddr_t addr) } } -static int mdio_read(ioaddr_t addr, int phy_id, int loc) +static int mdio_read(kio_addr_t addr, int phy_id, int loc) { u_int cmd = (0x06<<10)|(phy_id<<5)|loc; int i, retval = 0, mask = inb(addr) & MDIO_MASK; @@ -890,7 +880,7 @@ static int mdio_read(ioaddr_t addr, int phy_id, int loc) return (retval>>1) & 0xffff; } -static void mdio_write(ioaddr_t addr, int phy_id, int loc, int value) +static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value) { u_int cmd = (0x05<<28)|(phy_id<<23)|(loc<<18)|(1<<17)|value; int i, mask = inb(addr) & MDIO_MASK; @@ -907,7 +897,7 @@ static void mdio_write(ioaddr_t addr, int phy_id, int loc, int value) } } -static void mdio_reset(ioaddr_t addr, int phy_id) +static void mdio_reset(kio_addr_t addr, int phy_id) { outb_p(0x08, addr); outb_p(0x0c, addr); @@ -933,10 +923,10 @@ static void mdio_reset(ioaddr_t addr, int phy_id) #define DL19FDUPLX 0x0400 /* DL10019 Full duplex mode */ -static int read_eeprom(ioaddr_t ioaddr, int location) +static int read_eeprom(kio_addr_t ioaddr, int location) { int i, retval = 0; - ioaddr_t ee_addr = ioaddr + DLINK_EEPROM; + kio_addr_t ee_addr = ioaddr + DLINK_EEPROM; int read_cmd = location | (EE_READ_CMD << 8); outb(0, ee_addr); @@ -967,10 +957,10 @@ static int read_eeprom(ioaddr_t ioaddr, int location) In ASIC mode, EE_ADOT is used to output the data to the ASIC. */ -static void write_asic(ioaddr_t ioaddr, int location, short asic_data) +static void write_asic(kio_addr_t ioaddr, int location, short asic_data) { int i; - ioaddr_t ee_addr = ioaddr + DLINK_EEPROM; + kio_addr_t ee_addr = ioaddr + DLINK_EEPROM; short dataval; int read_cmd = location | (EE_READ_CMD << 8); @@ -1012,7 +1002,7 @@ static void write_asic(ioaddr_t ioaddr, int location, short asic_data) static void set_misc_reg(struct net_device *dev) { - ioaddr_t nic_base = dev->base_addr; + kio_addr_t nic_base = dev->base_addr; pcnet_dev_t *info = PRIV(dev); u_char tmp; @@ -1044,7 +1034,7 @@ static void set_misc_reg(struct net_device *dev) static void mii_phy_probe(struct net_device *dev) { pcnet_dev_t *info = PRIV(dev); - ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO; + kio_addr_t mii_addr = dev->base_addr + DLINK_GPIO; int i; u_int tmp, phyid; @@ -1119,7 +1109,7 @@ static int pcnet_close(struct net_device *dev) static void pcnet_reset_8390(struct net_device *dev) { - ioaddr_t nic_base = dev->base_addr; + kio_addr_t nic_base = dev->base_addr; int i; ei_status.txing = ei_status.dmaing = 0; @@ -1177,8 +1167,8 @@ static void ei_watchdog(u_long arg) { struct net_device *dev = (struct net_device *)arg; pcnet_dev_t *info = PRIV(dev); - ioaddr_t nic_base = dev->base_addr; - ioaddr_t mii_addr = nic_base + DLINK_GPIO; + kio_addr_t nic_base = dev->base_addr; + kio_addr_t mii_addr = nic_base + DLINK_GPIO; u_short link; if (!netif_device_present(dev)) goto reschedule; @@ -1281,7 +1271,7 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { pcnet_dev_t *info = PRIV(dev); u16 *data = (u16 *)&rq->ifr_ifru; - ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO; + kio_addr_t mii_addr = dev->base_addr + DLINK_GPIO; switch (cmd) { case SIOCGMIIPHY: data[0] = info->phy_id; @@ -1303,7 +1293,7 @@ static void dma_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) { - ioaddr_t nic_base = dev->base_addr; + kio_addr_t nic_base = dev->base_addr; if (ei_status.dmaing) { printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." @@ -1334,7 +1324,7 @@ static void dma_get_8390_hdr(struct net_device *dev, static void dma_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) { - ioaddr_t nic_base = dev->base_addr; + kio_addr_t nic_base = dev->base_addr; int xfer_count = count; char *buf = skb->data; @@ -1389,7 +1379,7 @@ static void dma_block_input(struct net_device *dev, int count, static void dma_block_output(struct net_device *dev, int count, const u_char *buf, const int start_page) { - ioaddr_t nic_base = dev->base_addr; + kio_addr_t nic_base = dev->base_addr; pcnet_dev_t *info = PRIV(dev); #ifdef PCMCIA_DEBUG int retries = 0; @@ -1491,9 +1481,10 @@ static int setup_dma_config(dev_link_t *link, int start_pg, /*====================================================================*/ -static void copyin(u_char *dest, u_char *src, int c) +static void copyin(void *dest, void __iomem *src, int c) { - u_short *d = (u_short *)dest, *s = (u_short *)src; + u_short *d = dest; + u_short __iomem *s = src; int odd; if (c <= 0) @@ -1508,9 +1499,10 @@ static void copyin(u_char *dest, u_char *src, int c) *((u_char *)d) = readw(s) & 0xff; } -static void copyout(u_char *dest, const u_char *src, int c) +static void copyout(void __iomem *dest, const void *src, int c) { - u_short *d = (u_short *)dest, *s = (u_short *)src; + u_short __iomem *d = dest; + const u_short *s = src; int odd; if (c <= 0) @@ -1531,10 +1523,11 @@ static void shmem_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) { - void *xfer_start = (void *)(ei_status.rmem_start + (ring_page << 8) - - (ei_status.rx_start_page << 8)); + void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8) + + (ring_page << 8) + - (ei_status.rx_start_page << 8); - copyin((void *)hdr, xfer_start, sizeof(struct e8390_pkt_hdr)); + copyin(hdr, xfer_start, sizeof(struct e8390_pkt_hdr)); /* Fix for big endian systems */ hdr->count = le16_to_cpu(hdr->count); } @@ -1544,17 +1537,17 @@ static void shmem_get_8390_hdr(struct net_device *dev, static void shmem_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) { - void *xfer_start = (void *)(ei_status.rmem_start + ring_offset - - (ei_status.rx_start_page << 8)); + void __iomem *xfer_start = ei_status.mem + (TX_PAGES<<8) + + ring_offset + - (ei_status.rx_start_page << 8); char *buf = skb->data; - if (xfer_start + count > (void *)ei_status.rmem_end) { + if (xfer_start + count > (void __iomem *)ei_status.rmem_end) { /* We must wrap the input move. */ - int semi_count = (void*)ei_status.rmem_end - xfer_start; + int semi_count = (void __iomem *)ei_status.rmem_end - xfer_start; copyin(buf, xfer_start, semi_count); buf += semi_count; - ring_offset = ei_status.rx_start_page << 8; - xfer_start = (void *)ei_status.rmem_start; + xfer_start = ei_status.mem + (TX_PAGES<<8); count -= semi_count; } copyin(buf, xfer_start, count); @@ -1565,7 +1558,7 @@ static void shmem_block_input(struct net_device *dev, int count, static void shmem_block_output(struct net_device *dev, int count, const u_char *buf, const int start_page) { - void *shmem = (void *)dev->mem_start + (start_page << 8); + void __iomem *shmem = ei_status.mem + (start_page << 8); shmem -= ei_status.tx_start_page << 8; copyout(shmem, buf, count); } @@ -1617,8 +1610,8 @@ static int setup_shmem_window(dev_link_t *link, int start_pg, goto failed; } - dev->mem_start = (u_long)info->base + offset; - ei_status.rmem_start = dev->mem_start + (TX_PAGES<<8); + ei_status.mem = info->base + offset; + dev->mem_start = (u_long)ei_status.mem; dev->mem_end = ei_status.rmem_end = (u_long)info->base + req.Size; ei_status.tx_start_page = start_pg; @@ -1659,8 +1652,7 @@ static void __exit exit_pcnet_cs(void) { DEBUG(0, "pcnet_cs: unloading\n"); pcmcia_unregister_driver(&pcnet_driver); - while (dev_list != NULL) - pcnet_detach(dev_list); + BUG_ON(dev_list != NULL); } module_init(init_pcnet_cs);