aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cs89x0.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cs89x0.c')
-rw-r--r--drivers/net/cs89x0.c77
1 files changed, 50 insertions, 27 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index e2cfde7e31ec..ef54ebeb29b8 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -87,6 +87,15 @@
87 Deepak Saxena : dsaxena@plexity.net 87 Deepak Saxena : dsaxena@plexity.net
88 : Intel IXDP2x01 (XScale ixp2x00 NPU) platform support 88 : Intel IXDP2x01 (XScale ixp2x00 NPU) platform support
89 89
90 Dmitry Pervushin : dpervushin@ru.mvista.com
91 : PNX010X platform support
92
93 Deepak Saxena : dsaxena@plexity.net
94 : Intel IXDP2351 platform support
95
96 Dmitry Pervushin : dpervushin@ru.mvista.com
97 : PNX010X platform support
98
90*/ 99*/
91 100
92/* Always include 'config.h' first in case the user wants to turn on 101/* Always include 'config.h' first in case the user wants to turn on
@@ -171,6 +180,10 @@ static unsigned int cs8900_irq_map[] = {12,0,0,0};
171static unsigned int netcard_portlist[] __initdata = 180static unsigned int netcard_portlist[] __initdata =
172 { 0x0300, 0}; 181 { 0x0300, 0};
173static unsigned int cs8900_irq_map[] = {1,0,0,0}; 182static unsigned int cs8900_irq_map[] = {1,0,0,0};
183#elif defined(CONFIG_MACH_IXDP2351)
184static unsigned int netcard_portlist[] __initdata = {IXDP2351_VIRT_CS8900_BASE, 0};
185static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0};
186#include <asm/irq.h>
174#elif defined(CONFIG_ARCH_IXDP2X01) 187#elif defined(CONFIG_ARCH_IXDP2X01)
175#include <asm/irq.h> 188#include <asm/irq.h>
176static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; 189static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0};
@@ -338,45 +351,55 @@ out:
338} 351}
339#endif 352#endif
340 353
341#if defined(CONFIG_ARCH_IXDP2X01) 354#if defined(CONFIG_MACH_IXDP2351)
342static int 355static u16
343readword(unsigned long base_addr, int portno) 356readword(unsigned long base_addr, int portno)
344{ 357{
345 return (u16)__raw_readl(base_addr + (portno << 1)); 358 return __raw_readw(base_addr + (portno << 1));
346} 359}
347 360
348static void 361static void
349writeword(unsigned long base_addr, int portno, int value) 362writeword(unsigned long base_addr, int portno, u16 value)
350{ 363{
351 __raw_writel((u16)value, base_addr + (portno << 1)); 364 __raw_writew(value, base_addr + (portno << 1));
352} 365}
353#else 366#elif defined(CONFIG_ARCH_IXDP2X01)
354#if defined(CONFIG_ARCH_PNX010X) 367static u16
355static int 368readword(unsigned long base_addr, int portno)
369{
370 return __raw_readl(base_addr + (portno << 1));
371}
372
373static void
374writeword(unsigned long base_addr, int portno, u16 value)
375{
376 __raw_writel(value, base_addr + (portno << 1));
377}
378#elif defined(CONFIG_ARCH_PNX010X)
379static u16
356readword(unsigned long base_addr, int portno) 380readword(unsigned long base_addr, int portno)
357{ 381{
358 return inw(base_addr + (portno << 1)); 382 return inw(base_addr + (portno << 1));
359} 383}
360 384
361static void 385static void
362writeword(unsigned long base_addr, int portno, int value) 386writeword(unsigned long base_addr, int portno, u16 value)
363{ 387{
364 outw(value, base_addr + (portno << 1)); 388 outw(value, base_addr + (portno << 1));
365} 389}
366#else 390#else
367static int 391static u16
368readword(unsigned long base_addr, int portno) 392readword(unsigned long base_addr, int portno)
369{ 393{
370 return inw(base_addr + portno); 394 return inw(base_addr + portno);
371} 395}
372 396
373static void 397static void
374writeword(unsigned long base_addr, int portno, int value) 398writeword(unsigned long base_addr, int portno, u16 value)
375{ 399{
376 outw(value, base_addr + portno); 400 outw(value, base_addr + portno);
377} 401}
378#endif 402#endif
379#endif
380 403
381static void 404static void
382readwords(unsigned long base_addr, int portno, void *buf, int length) 405readwords(unsigned long base_addr, int portno, void *buf, int length)
@@ -384,11 +407,11 @@ readwords(unsigned long base_addr, int portno, void *buf, int length)
384 u8 *buf8 = (u8 *)buf; 407 u8 *buf8 = (u8 *)buf;
385 408
386 do { 409 do {
387 u32 tmp32; 410 u16 tmp16;
388 411
389 tmp32 = readword(base_addr, portno); 412 tmp16 = readword(base_addr, portno);
390 *buf8++ = (u8)tmp32; 413 *buf8++ = (u8)tmp16;
391 *buf8++ = (u8)(tmp32 >> 8); 414 *buf8++ = (u8)(tmp16 >> 8);
392 } while (--length); 415 } while (--length);
393} 416}
394 417
@@ -398,23 +421,23 @@ writewords(unsigned long base_addr, int portno, void *buf, int length)
398 u8 *buf8 = (u8 *)buf; 421 u8 *buf8 = (u8 *)buf;
399 422
400 do { 423 do {
401 u32 tmp32; 424 u16 tmp16;
402 425
403 tmp32 = *buf8++; 426 tmp16 = *buf8++;
404 tmp32 |= (*buf8++) << 8; 427 tmp16 |= (*buf8++) << 8;
405 writeword(base_addr, portno, tmp32); 428 writeword(base_addr, portno, tmp16);
406 } while (--length); 429 } while (--length);
407} 430}
408 431
409static int 432static u16
410readreg(struct net_device *dev, int regno) 433readreg(struct net_device *dev, u16 regno)
411{ 434{
412 writeword(dev->base_addr, ADD_PORT, regno); 435 writeword(dev->base_addr, ADD_PORT, regno);
413 return readword(dev->base_addr, DATA_PORT); 436 return readword(dev->base_addr, DATA_PORT);
414} 437}
415 438
416static void 439static void
417writereg(struct net_device *dev, int regno, int value) 440writereg(struct net_device *dev, u16 regno, u16 value)
418{ 441{
419 writeword(dev->base_addr, ADD_PORT, regno); 442 writeword(dev->base_addr, ADD_PORT, regno);
420 writeword(dev->base_addr, DATA_PORT, value); 443 writeword(dev->base_addr, DATA_PORT, value);
@@ -780,7 +803,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
780 } else { 803 } else {
781 i = lp->isa_config & INT_NO_MASK; 804 i = lp->isa_config & INT_NO_MASK;
782 if (lp->chip_type == CS8900) { 805 if (lp->chip_type == CS8900) {
783#if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) 806#if defined(CONFIG_MACH_IXDP2351) || defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X)
784 i = cs8900_irq_map[0]; 807 i = cs8900_irq_map[0];
785#else 808#else
786 /* Translate the IRQ using the IRQ mapping table. */ 809 /* Translate the IRQ using the IRQ mapping table. */
@@ -1012,7 +1035,7 @@ skip_this_frame:
1012 1035
1013void __init reset_chip(struct net_device *dev) 1036void __init reset_chip(struct net_device *dev)
1014{ 1037{
1015#ifndef CONFIG_ARCH_IXDP2X01 1038#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01)
1016 struct net_local *lp = netdev_priv(dev); 1039 struct net_local *lp = netdev_priv(dev);
1017 int ioaddr = dev->base_addr; 1040 int ioaddr = dev->base_addr;
1018#endif 1041#endif
@@ -1023,7 +1046,7 @@ void __init reset_chip(struct net_device *dev)
1023 /* wait 30 ms */ 1046 /* wait 30 ms */
1024 msleep(30); 1047 msleep(30);
1025 1048
1026#ifndef CONFIG_ARCH_IXDP2X01 1049#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01)
1027 if (lp->chip_type != CS8900) { 1050 if (lp->chip_type != CS8900) {
1028 /* Hardware problem requires PNP registers to be reconfigured after a reset */ 1051 /* Hardware problem requires PNP registers to be reconfigured after a reset */
1029 writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); 1052 writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT);
@@ -1287,7 +1310,7 @@ net_open(struct net_device *dev)
1287 else 1310 else
1288#endif 1311#endif
1289 { 1312 {
1290#if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) 1313#if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X)
1291 if (((1 << dev->irq) & lp->irq_map) == 0) { 1314 if (((1 << dev->irq) & lp->irq_map) == 0) {
1292 printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", 1315 printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n",
1293 dev->name, dev->irq, lp->irq_map); 1316 dev->name, dev->irq, lp->irq_map);