From 974dffc2dd72d499a3ff150f61c8025b097a2c34 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:06 -0800 Subject: [PATCH] cs89x0: make {read,write}word take base_addr readword() and writeword() take a 'struct net_device *' and deref its ->base_addr member. Make them take the base_addr directly instead, so that we can switch the other occurences of inw/outw in the file over to readword/writeword as well. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index a6078ad9b654..29a7c0cf84bc 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -353,15 +353,15 @@ writereg(struct net_device *dev, int portno, int value) } static int -readword(struct net_device *dev, int portno) +readword(unsigned long base_addr, int portno) { - return inw(dev->base_addr + portno); + return inw(base_addr + portno); } static void -writeword(struct net_device *dev, int portno, int value) +writeword(unsigned long base_addr, int portno, int value) { - outw(value, dev->base_addr + portno); + outw(value, base_addr + portno); } static int __init @@ -1104,8 +1104,8 @@ send_test_pkt(struct net_device *dev) memcpy(test_packet, dev->dev_addr, ETH_ALEN); memcpy(test_packet+ETH_ALEN, dev->dev_addr, ETH_ALEN); - writeword(dev, TX_CMD_PORT, TX_AFTER_ALL); - writeword(dev, TX_LEN_PORT, ETH_ZLEN); + writeword(dev->base_addr, TX_CMD_PORT, TX_AFTER_ALL); + writeword(dev->base_addr, TX_LEN_PORT, ETH_ZLEN); /* Test to see if the chip has allocated memory for the packet */ while (jiffies - timenow < 5) @@ -1457,8 +1457,8 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) netif_stop_queue(dev); /* initiate a transmit sequence */ - writeword(dev, TX_CMD_PORT, lp->send_cmd); - writeword(dev, TX_LEN_PORT, skb->len); + writeword(dev->base_addr, TX_CMD_PORT, lp->send_cmd); + writeword(dev->base_addr, TX_LEN_PORT, skb->len); /* Test to see if the chip has allocated memory for the packet */ if ((readreg(dev, PP_BusST) & READY_FOR_TX_NOW) == 0) { @@ -1512,7 +1512,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs) course, if you're on a slow machine, and packets are arriving faster than you can read them off, you're screwed. Hasta la vista, baby! */ - while ((status = readword(dev, ISQ_PORT))) { + while ((status = readword(dev->base_addr, ISQ_PORT))) { if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); handled = 1; switch(status & ISQ_EVENT_MASK) { -- cgit v1.2.3 From fc8c7d79b117f7a5b17640bf657d95afe4025bb8 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:08 -0800 Subject: [PATCH] cs89x0: convert {inw,outw} calls to {read,write}word Switch all occurences of inw/outw in the driver over to readword/writeword. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 29a7c0cf84bc..04fca31f1733 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -491,8 +491,8 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) #ifdef CONFIG_SH_HICOSH4 /* truely reset the chip */ - outw(0x0114, ioaddr + ADD_PORT); - outw(0x0040, ioaddr + DATA_PORT); + writeword(ioaddr, ADD_PORT, 0x0114); + writeword(ioaddr, DATA_PORT, 0x0040); #endif /* if they give us an odd I/O address, then do ONE write to @@ -503,24 +503,24 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) if (net_debug > 1) printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); if ((ioaddr & 2) != 2) - if ((inw((ioaddr & ~3)+ ADD_PORT) & ADD_MASK) != ADD_SIG) { + if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { printk(KERN_ERR "%s: bad signature 0x%x\n", - dev->name, inw((ioaddr & ~3)+ ADD_PORT)); + dev->name, readword(ioaddr & ~3, ADD_PORT)); retval = -ENODEV; goto out2; } } - printk(KERN_DEBUG "PP_addr at %x: 0x%x\n", - ioaddr + ADD_PORT, inw(ioaddr + ADD_PORT)); + printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", + ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); ioaddr &= ~3; - outw(PP_ChipID, ioaddr + ADD_PORT); + writeword(ioaddr, ADD_PORT, PP_ChipID); - tmp = inw(ioaddr + DATA_PORT); + tmp = readword(ioaddr, DATA_PORT); if (tmp != CHIP_EISA_ID_SIG) { - printk(KERN_DEBUG "%s: incorrect signature at %x: 0x%x!=" + printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" CHIP_EISA_ID_SIG_STR "\n", - dev->name, ioaddr + DATA_PORT, tmp); + dev->name, ioaddr, DATA_PORT, tmp); retval = -ENODEV; goto out2; } @@ -790,7 +790,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) goto out3; return 0; out3: - outw(PP_ChipID, dev->base_addr + ADD_PORT); + writeword(dev->base_addr, ADD_PORT, PP_ChipID); out2: release_region(ioaddr & ~3, NETCARD_IO_EXTENT); out1: @@ -970,11 +970,11 @@ void __init reset_chip(struct net_device *dev) #ifndef CONFIG_ARCH_IXDP2X01 if (lp->chip_type != CS8900) { /* Hardware problem requires PNP registers to be reconfigured after a reset */ - outw(PP_CS8920_ISAINT, ioaddr + ADD_PORT); + writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); outb(dev->irq, ioaddr + DATA_PORT); outb(0, ioaddr + DATA_PORT + 1); - outw(PP_CS8920_ISAMemB, ioaddr + ADD_PORT); + writeword(ioaddr, ADD_PORT, PP_CS8920_ISAMemB); outb((dev->mem_start >> 16) & 0xff, ioaddr + DATA_PORT); outb((dev->mem_start >> 8) & 0xff, ioaddr + DATA_PORT + 1); } @@ -1606,8 +1606,8 @@ net_rx(struct net_device *dev) int status, length; int ioaddr = dev->base_addr; - status = inw(ioaddr + RX_FRAME_PORT); - length = inw(ioaddr + RX_FRAME_PORT); + status = readword(ioaddr, RX_FRAME_PORT); + length = readword(ioaddr, RX_FRAME_PORT); if ((status & RX_OK) == 0) { count_rx_errors(status, lp); @@ -1628,7 +1628,7 @@ net_rx(struct net_device *dev) insw(ioaddr + RX_FRAME_PORT, skb_put(skb, length), length >> 1); if (length & 1) - skb->data[length-1] = inw(ioaddr + RX_FRAME_PORT); + skb->data[length-1] = readword(ioaddr, RX_FRAME_PORT); if (net_debug > 3) { printk( "%s: received %d byte packet of type %x\n", @@ -1901,7 +1901,7 @@ void cleanup_module(void) { unregister_netdev(dev_cs89x0); - outw(PP_ChipID, dev_cs89x0->base_addr + ADD_PORT); + writeword(dev_cs89x0->base_addr, ADD_PORT, PP_ChipID); release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); free_netdev(dev_cs89x0); } -- cgit v1.2.3 From 0d5affcfe23ade8c4c01154e7e381e2a9a916399 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:09 -0800 Subject: [PATCH] cs89x0: swap {read,write}reg and {read,write}word Reverse the order of readreg/writereg and readword/writeword in the file, so that we can make readreg/writereg use readword/writeword. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 04fca31f1733..221f92e45ec7 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -339,29 +339,29 @@ out: #endif static int -readreg(struct net_device *dev, int portno) +readword(unsigned long base_addr, int portno) { - outw(portno, dev->base_addr + ADD_PORT); - return inw(dev->base_addr + DATA_PORT); + return inw(base_addr + portno); } static void -writereg(struct net_device *dev, int portno, int value) +writeword(unsigned long base_addr, int portno, int value) { - outw(portno, dev->base_addr + ADD_PORT); - outw(value, dev->base_addr + DATA_PORT); + outw(value, base_addr + portno); } static int -readword(unsigned long base_addr, int portno) +readreg(struct net_device *dev, int portno) { - return inw(base_addr + portno); + outw(portno, dev->base_addr + ADD_PORT); + return inw(dev->base_addr + DATA_PORT); } static void -writeword(unsigned long base_addr, int portno, int value) +writereg(struct net_device *dev, int portno, int value) { - outw(value, base_addr + portno); + outw(portno, dev->base_addr + ADD_PORT); + outw(value, dev->base_addr + DATA_PORT); } static int __init -- cgit v1.2.3 From 3eaa5e7dcce0653d2bfd2ab85a623687da49f8d5 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:10 -0800 Subject: [PATCH] cs89x0: make {read,write}reg use {read,write}word Make readreg/writereg use readword/writeword. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 221f92e45ec7..756d80adc47b 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -351,17 +351,17 @@ writeword(unsigned long base_addr, int portno, int value) } static int -readreg(struct net_device *dev, int portno) +readreg(struct net_device *dev, int regno) { - outw(portno, dev->base_addr + ADD_PORT); - return inw(dev->base_addr + DATA_PORT); + writeword(dev->base_addr, ADD_PORT, regno); + return readword(dev->base_addr, DATA_PORT); } static void -writereg(struct net_device *dev, int portno, int value) +writereg(struct net_device *dev, int regno, int value) { - outw(portno, dev->base_addr + ADD_PORT); - outw(value, dev->base_addr + DATA_PORT); + writeword(dev->base_addr, ADD_PORT, regno); + writeword(dev->base_addr, DATA_PORT, value); } static int __init -- cgit v1.2.3 From 3b68d70dffe255e7681d5725d96bc2b92a24bb9d Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:11 -0800 Subject: [PATCH] cs89x0: cleanly implement ixdp2x01 and pnx0501 support Implement suitable versions of the readword/writeword macros for ixdp2x01 and pnx0501. Handle the 32-bit spacing of the registers in these functions instead of in the header file. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 28 ++++++++++++++++++++++++++++ drivers/net/cs89x0.h | 19 ++++++------------- 2 files changed, 34 insertions(+), 13 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 756d80adc47b..7abc9f858f98 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -338,6 +338,32 @@ out: } #endif +#if defined(CONFIG_ARCH_IXDP2X01) +static int +readword(unsigned long base_addr, int portno) +{ + return (u16)__raw_readl(base_addr + (portno << 1)); +} + +static void +writeword(unsigned long base_addr, int portno, int value) +{ + __raw_writel((u16)value, base_addr + (portno << 1)); +} +#else +#if defined(CONFIG_ARCH_PNX0501) +static int +readword(unsigned long base_addr, int portno) +{ + return inw(base_addr + (portno << 1)); +} + +static void +writeword(unsigned long base_addr, int portno, int value) +{ + outw(value, base_addr + (portno << 1)); +} +#else static int readword(unsigned long base_addr, int portno) { @@ -349,6 +375,8 @@ writeword(unsigned long base_addr, int portno, int value) { outw(value, base_addr + portno); } +#endif +#endif static int readreg(struct net_device *dev, int regno) diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h index decea264f121..bd954aaa636f 100644 --- a/drivers/net/cs89x0.h +++ b/drivers/net/cs89x0.h @@ -16,13 +16,6 @@ #include -#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) -/* IXDP2401/IXDP2801 uses dword-aligned register addressing */ -#define CS89x0_PORT(reg) ((reg) * 2) -#else -#define CS89x0_PORT(reg) (reg) -#endif - #define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */ /* offset 2h -> Model/Product Number */ /* offset 3h -> Chip Revision Number */ @@ -332,16 +325,16 @@ #define RAM_SIZE 0x1000 /* The card has 4k bytes or RAM */ #define PKT_START PP_TxFrame /* Start of packet RAM */ -#define RX_FRAME_PORT CS89x0_PORT(0x0000) +#define RX_FRAME_PORT 0x0000 #define TX_FRAME_PORT RX_FRAME_PORT -#define TX_CMD_PORT CS89x0_PORT(0x0004) +#define TX_CMD_PORT 0x0004 #define TX_NOW 0x0000 /* Tx packet after 5 bytes copied */ #define TX_AFTER_381 0x0040 /* Tx packet after 381 bytes copied */ #define TX_AFTER_ALL 0x00c0 /* Tx packet after all bytes copied */ -#define TX_LEN_PORT CS89x0_PORT(0x0006) -#define ISQ_PORT CS89x0_PORT(0x0008) -#define ADD_PORT CS89x0_PORT(0x000A) -#define DATA_PORT CS89x0_PORT(0x000C) +#define TX_LEN_PORT 0x0006 +#define ISQ_PORT 0x0008 +#define ADD_PORT 0x000A +#define DATA_PORT 0x000C #define EEPROM_WRITE_EN 0x00F0 #define EEPROM_WRITE_DIS 0x0000 -- cgit v1.2.3 From 084f746a01ca026920e388e76e913cc7a26d5a3f Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:12 -0800 Subject: [PATCH] cs89x0: switch {in,out}sw to {read,write}words Implement readwords/writewords that use readword/writeword, and switch the rest of the driver over to use these. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 7abc9f858f98..f7ec590e80ea 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -378,6 +378,34 @@ writeword(unsigned long base_addr, int portno, int value) #endif #endif +static void +readwords(unsigned long base_addr, int portno, void *buf, int length) +{ + u8 *buf8 = (u8 *)buf; + + do { + u32 tmp32; + + tmp32 = readword(base_addr, portno); + *buf8++ = (u8)tmp32; + *buf8++ = (u8)(tmp32 >> 8); + } while (--length); +} + +static void +writewords(unsigned long base_addr, int portno, void *buf, int length) +{ + u8 *buf8 = (u8 *)buf; + + do { + u32 tmp32; + + tmp32 = *buf8++; + tmp32 |= (*buf8++) << 8; + writeword(base_addr, portno, tmp32); + } while (--length); +} + static int readreg(struct net_device *dev, int regno) { @@ -1143,7 +1171,7 @@ send_test_pkt(struct net_device *dev) return 0; /* this shouldn't happen */ /* Write the contents of the packet */ - outsw(dev->base_addr + TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1); + writewords(dev->base_addr, TX_FRAME_PORT,test_packet,(ETH_ZLEN+1) >>1); if (net_debug > 1) printk("Sending test packet "); /* wait a couple of jiffies for packet to be received */ @@ -1500,7 +1528,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) return 1; } /* Write the contents of the packet */ - outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); + writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1); spin_unlock_irq(&lp->lock); lp->stats.tx_bytes += skb->len; dev->trans_start = jiffies; @@ -1654,7 +1682,7 @@ net_rx(struct net_device *dev) skb_reserve(skb, 2); /* longword align L3 header */ skb->dev = dev; - insw(ioaddr + RX_FRAME_PORT, skb_put(skb, length), length >> 1); + readwords(ioaddr, RX_FRAME_PORT, skb_put(skb, length), length >> 1); if (length & 1) skb->data[length-1] = readword(ioaddr, RX_FRAME_PORT); -- cgit v1.2.3 From 277cb103e3d7b31b8f4941b6a495b1b80236b05c Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sun, 8 Jan 2006 01:01:14 -0800 Subject: [PATCH] cs89x0: fix up after pnx0105 Kconfig symbol renaming The Kconfig symbol for pnx0105 was recently renamed to ARCH_PNX010X. Signed-off-by: Lennert Buytenhek Cc: dmitry pervushin Cc: Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index f7ec590e80ea..907c01009746 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -175,7 +175,7 @@ static unsigned int cs8900_irq_map[] = {1,0,0,0}; #include static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; -#elif defined(CONFIG_ARCH_PNX0105) +#elif defined(CONFIG_ARCH_PNX010X) #include #include #define CIRRUS_DEFAULT_BASE IO_ADDRESS(EXT_STATIC2_s0_BASE + 0x200000) /* = Physical address 0x48200000 */ @@ -351,7 +351,7 @@ writeword(unsigned long base_addr, int portno, int value) __raw_writel((u16)value, base_addr + (portno << 1)); } #else -#if defined(CONFIG_ARCH_PNX0501) +#if defined(CONFIG_ARCH_PNX010X) static int readword(unsigned long base_addr, int portno) { @@ -512,7 +512,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) #endif } -#ifdef CONFIG_ARCH_PNX0105 +#ifdef CONFIG_ARCH_PNX010X initialize_ebi(); /* Map GPIO registers for the pins connected to the CS8900a. */ @@ -780,7 +780,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) } else { i = lp->isa_config & INT_NO_MASK; if (lp->chip_type == CS8900) { -#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX0105) +#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) i = cs8900_irq_map[0]; #else /* Translate the IRQ using the IRQ mapping table. */ @@ -1256,7 +1256,7 @@ net_open(struct net_device *dev) int i; int ret; -#if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX0105) /* uses irq#1, so this won't work */ +#if !defined(CONFIG_SH_HICOSH4) && !defined(CONFIG_ARCH_PNX010X) /* uses irq#1, so this won't work */ if (dev->irq < 2) { /* Allow interrupts to be generated by the chip */ /* Cirrus' release had this: */ @@ -1287,7 +1287,7 @@ net_open(struct net_device *dev) else #endif { -#if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX0105) +#if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) 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); @@ -1372,7 +1372,7 @@ net_open(struct net_device *dev) case A_CNF_MEDIA_10B_2: result = lp->adapter_cnf & A_CNF_10B_2; break; default: result = lp->adapter_cnf & (A_CNF_10B_T | A_CNF_AUI | A_CNF_10B_2); } -#ifdef CONFIG_ARCH_PNX0105 +#ifdef CONFIG_ARCH_PNX010X result = A_CNF_10B_T; #endif if (!result) { -- cgit v1.2.3 From 91e1c46356beddf984ce0ce5ec4fbaea43a07ec8 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Wed, 11 Jan 2006 12:17:34 -0800 Subject: [PATCH] cs89x0: fix setting of ALLOW_DMA There's an ifdef in cs89x0.c that seems to have been the wrong way round since it was merged (and noone seems to have noticed) -- the IXDP2x01 doesn't support ISA-style DMA, but when building for IXDP2x01, cs89x0's ALLOW_DMA is set to 1, and when building for another platform, ALLOW_DMA is set to 0. Signed-off-by: Lennert Buytenhek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 907c01009746..e2cfde7e31ec 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -100,7 +100,7 @@ * Note that even if DMA is turned off we still support the 'dma' and 'use_dma' * module options so we don't break any startup scripts. */ -#ifndef CONFIG_ARCH_IXDP2X01 +#ifndef CONFIG_ISA_DMA_API #define ALLOW_DMA 0 #else #define ALLOW_DMA 1 -- cgit v1.2.3 From 032874e49271f8c9c53c137cb60cf12617a953a0 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 14 Jan 2006 13:21:15 -0800 Subject: [PATCH] cs89x0: credit Dmitry Pervushin Credit Dmitry Pervushin for the PNX010X platform support. Signed-off-by: Lennert Buytenhek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index e2cfde7e31ec..494c71e05c82 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -87,6 +87,9 @@ Deepak Saxena : dsaxena@plexity.net : Intel IXDP2x01 (XScale ixp2x00 NPU) platform support + Dmitry Pervushin : dpervushin@ru.mvista.com + : PNX010X platform support + */ /* Always include 'config.h' first in case the user wants to turn on -- cgit v1.2.3 From 580d7b8cc59d68a3d26bfcc64c2053b464782c9a Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 14 Jan 2006 13:21:16 -0800 Subject: [PATCH] cs89x0: use #elif instead of #else/#if/#endif Signed-off-by: Lennert Buytenhek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 494c71e05c82..a7ef8a66ba0f 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -353,8 +353,7 @@ writeword(unsigned long base_addr, int portno, int value) { __raw_writel((u16)value, base_addr + (portno << 1)); } -#else -#if defined(CONFIG_ARCH_PNX010X) +#elif defined(CONFIG_ARCH_PNX010X) static int readword(unsigned long base_addr, int portno) { @@ -379,7 +378,6 @@ writeword(unsigned long base_addr, int portno, int value) outw(value, base_addr + portno); } #endif -#endif static void readwords(unsigned long base_addr, int portno, void *buf, int length) -- cgit v1.2.3 From a07f0dbec01fda6d88f5089e21454b8df53d36fc Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Sat, 14 Jan 2006 13:21:17 -0800 Subject: [PATCH] cs89x0: use u16 for device register data cs89x0 inconsistently used 'int' and 'u32' for device register data. As the cs89x0 is a 16-bit chip, change the I/O accessors over to 'u16'. (Spotted by Deepak Saxena.) Signed-off-by: Lennert Buytenhek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index a7ef8a66ba0f..2687b3e0994d 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -342,38 +342,38 @@ out: #endif #if defined(CONFIG_ARCH_IXDP2X01) -static int +static u16 readword(unsigned long base_addr, int portno) { - return (u16)__raw_readl(base_addr + (portno << 1)); + return __raw_readl(base_addr + (portno << 1)); } static void -writeword(unsigned long base_addr, int portno, int value) +writeword(unsigned long base_addr, int portno, u16 value) { - __raw_writel((u16)value, base_addr + (portno << 1)); + __raw_writel(value, base_addr + (portno << 1)); } #elif defined(CONFIG_ARCH_PNX010X) -static int +static u16 readword(unsigned long base_addr, int portno) { return inw(base_addr + (portno << 1)); } static void -writeword(unsigned long base_addr, int portno, int value) +writeword(unsigned long base_addr, int portno, u16 value) { outw(value, base_addr + (portno << 1)); } #else -static int +static u16 readword(unsigned long base_addr, int portno) { return inw(base_addr + portno); } static void -writeword(unsigned long base_addr, int portno, int value) +writeword(unsigned long base_addr, int portno, u16 value) { outw(value, base_addr + portno); } @@ -385,11 +385,11 @@ readwords(unsigned long base_addr, int portno, void *buf, int length) u8 *buf8 = (u8 *)buf; do { - u32 tmp32; + u16 tmp16; - tmp32 = readword(base_addr, portno); - *buf8++ = (u8)tmp32; - *buf8++ = (u8)(tmp32 >> 8); + tmp16 = readword(base_addr, portno); + *buf8++ = (u8)tmp16; + *buf8++ = (u8)(tmp16 >> 8); } while (--length); } @@ -399,23 +399,23 @@ writewords(unsigned long base_addr, int portno, void *buf, int length) u8 *buf8 = (u8 *)buf; do { - u32 tmp32; + u16 tmp16; - tmp32 = *buf8++; - tmp32 |= (*buf8++) << 8; - writeword(base_addr, portno, tmp32); + tmp16 = *buf8++; + tmp16 |= (*buf8++) << 8; + writeword(base_addr, portno, tmp16); } while (--length); } -static int -readreg(struct net_device *dev, int regno) +static u16 +readreg(struct net_device *dev, u16 regno) { writeword(dev->base_addr, ADD_PORT, regno); return readword(dev->base_addr, DATA_PORT); } static void -writereg(struct net_device *dev, int regno, int value) +writereg(struct net_device *dev, u16 regno, u16 value) { writeword(dev->base_addr, ADD_PORT, regno); writeword(dev->base_addr, DATA_PORT, value); -- cgit v1.2.3 From 9c878967d32a10cb604718f7608efa0ea3d8b596 Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Sat, 14 Jan 2006 13:21:18 -0800 Subject: [PATCH] cs89x0: add ixdp2351 support This patch adds support for the Intel IXDP2351 to the CS89x0 driver. Signed-off-by: Deepak Saxena Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/Kconfig | 2 +- drivers/net/cs89x0.c | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5c15f3e9ea07..171999e67eec 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -1387,7 +1387,7 @@ config FORCEDETH config CS89x0 tristate "CS89x0 support" - depends on NET_PCI && (ISA || ARCH_IXDP2X01 || ARCH_PNX010X) + depends on NET_PCI && (ISA || MACH_IXDP2351 || ARCH_IXDP2X01 || ARCH_PNX010X) ---help--- Support for CS89x0 chipset based Ethernet cards. If you have a network (Ethernet) card of this type, say Y and read the diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 2687b3e0994d..fab6586d87e9 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -90,6 +90,9 @@ Dmitry Pervushin : dpervushin@ru.mvista.com : PNX010X platform support + Deepak Saxena : dsaxena@plexity.net + : Intel IXDP2351 platform support + */ /* Always include 'config.h' first in case the user wants to turn on @@ -174,6 +177,10 @@ static unsigned int cs8900_irq_map[] = {12,0,0,0}; static unsigned int netcard_portlist[] __initdata = { 0x0300, 0}; static unsigned int cs8900_irq_map[] = {1,0,0,0}; +#elif defined(CONFIG_MACH_IXDP2351) +static unsigned int netcard_portlist[] __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; +static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; +#include #elif defined(CONFIG_ARCH_IXDP2X01) #include static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; @@ -341,7 +348,19 @@ out: } #endif -#if defined(CONFIG_ARCH_IXDP2X01) +#if defined(CONFIG_MACH_IXDP2351) +static u16 +readword(unsigned long base_addr, int portno) +{ + return __raw_readw(base_addr + (portno << 1)); +} + +static void +writeword(unsigned long base_addr, int portno, u16 value) +{ + __raw_writew(value, base_addr + (portno << 1)); +} +#elif defined(CONFIG_ARCH_IXDP2X01) static u16 readword(unsigned long base_addr, int portno) { @@ -781,7 +800,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) } else { i = lp->isa_config & INT_NO_MASK; if (lp->chip_type == CS8900) { -#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) +#if defined(CONFIG_MACH_IXDP2351) || defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) i = cs8900_irq_map[0]; #else /* Translate the IRQ using the IRQ mapping table. */ @@ -1013,7 +1032,7 @@ skip_this_frame: void __init reset_chip(struct net_device *dev) { -#ifndef CONFIG_ARCH_IXDP2X01 +#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) struct net_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr; #endif @@ -1024,7 +1043,7 @@ void __init reset_chip(struct net_device *dev) /* wait 30 ms */ msleep(30); -#ifndef CONFIG_ARCH_IXDP2X01 +#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) if (lp->chip_type != CS8900) { /* Hardware problem requires PNP registers to be reconfigured after a reset */ writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); @@ -1288,7 +1307,7 @@ net_open(struct net_device *dev) else #endif { -#if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) +#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) 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); -- cgit v1.2.3 From 5aeebe01cb2ba1bca4cd9b8a6e77386bd7499dc2 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Mon, 16 Jan 2006 22:14:53 -0800 Subject: [PATCH] cs89x0: credit Dmitry Pervushin Credit Dmitry Pervushin for the PNX010X platform support. Signed-off-by: Lennert Buytenhek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/net/cs89x0.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/cs89x0.c') diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index fab6586d87e9..ef54ebeb29b8 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -93,6 +93,9 @@ Deepak Saxena : dsaxena@plexity.net : Intel IXDP2351 platform support + Dmitry Pervushin : dpervushin@ru.mvista.com + : PNX010X platform support + */ /* Always include 'config.h' first in case the user wants to turn on -- cgit v1.2.3