diff options
Diffstat (limited to 'drivers/net/cs89x0.c')
-rw-r--r-- | drivers/net/cs89x0.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index e2cfde7e31ec..fab6586d87e9 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -87,6 +87,12 @@ | |||
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 | |||
90 | */ | 96 | */ |
91 | 97 | ||
92 | /* Always include 'config.h' first in case the user wants to turn on | 98 | /* Always include 'config.h' first in case the user wants to turn on |
@@ -171,6 +177,10 @@ static unsigned int cs8900_irq_map[] = {12,0,0,0}; | |||
171 | static unsigned int netcard_portlist[] __initdata = | 177 | static unsigned int netcard_portlist[] __initdata = |
172 | { 0x0300, 0}; | 178 | { 0x0300, 0}; |
173 | static unsigned int cs8900_irq_map[] = {1,0,0,0}; | 179 | static unsigned int cs8900_irq_map[] = {1,0,0,0}; |
180 | #elif defined(CONFIG_MACH_IXDP2351) | ||
181 | static unsigned int netcard_portlist[] __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | ||
182 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | ||
183 | #include <asm/irq.h> | ||
174 | #elif defined(CONFIG_ARCH_IXDP2X01) | 184 | #elif defined(CONFIG_ARCH_IXDP2X01) |
175 | #include <asm/irq.h> | 185 | #include <asm/irq.h> |
176 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 186 | static unsigned int netcard_portlist[] __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
@@ -338,45 +348,55 @@ out: | |||
338 | } | 348 | } |
339 | #endif | 349 | #endif |
340 | 350 | ||
341 | #if defined(CONFIG_ARCH_IXDP2X01) | 351 | #if defined(CONFIG_MACH_IXDP2351) |
342 | static int | 352 | static u16 |
343 | readword(unsigned long base_addr, int portno) | 353 | readword(unsigned long base_addr, int portno) |
344 | { | 354 | { |
345 | return (u16)__raw_readl(base_addr + (portno << 1)); | 355 | return __raw_readw(base_addr + (portno << 1)); |
346 | } | 356 | } |
347 | 357 | ||
348 | static void | 358 | static void |
349 | writeword(unsigned long base_addr, int portno, int value) | 359 | writeword(unsigned long base_addr, int portno, u16 value) |
350 | { | 360 | { |
351 | __raw_writel((u16)value, base_addr + (portno << 1)); | 361 | __raw_writew(value, base_addr + (portno << 1)); |
352 | } | 362 | } |
353 | #else | 363 | #elif defined(CONFIG_ARCH_IXDP2X01) |
354 | #if defined(CONFIG_ARCH_PNX010X) | 364 | static u16 |
355 | static int | 365 | readword(unsigned long base_addr, int portno) |
366 | { | ||
367 | return __raw_readl(base_addr + (portno << 1)); | ||
368 | } | ||
369 | |||
370 | static void | ||
371 | writeword(unsigned long base_addr, int portno, u16 value) | ||
372 | { | ||
373 | __raw_writel(value, base_addr + (portno << 1)); | ||
374 | } | ||
375 | #elif defined(CONFIG_ARCH_PNX010X) | ||
376 | static u16 | ||
356 | readword(unsigned long base_addr, int portno) | 377 | readword(unsigned long base_addr, int portno) |
357 | { | 378 | { |
358 | return inw(base_addr + (portno << 1)); | 379 | return inw(base_addr + (portno << 1)); |
359 | } | 380 | } |
360 | 381 | ||
361 | static void | 382 | static void |
362 | writeword(unsigned long base_addr, int portno, int value) | 383 | writeword(unsigned long base_addr, int portno, u16 value) |
363 | { | 384 | { |
364 | outw(value, base_addr + (portno << 1)); | 385 | outw(value, base_addr + (portno << 1)); |
365 | } | 386 | } |
366 | #else | 387 | #else |
367 | static int | 388 | static u16 |
368 | readword(unsigned long base_addr, int portno) | 389 | readword(unsigned long base_addr, int portno) |
369 | { | 390 | { |
370 | return inw(base_addr + portno); | 391 | return inw(base_addr + portno); |
371 | } | 392 | } |
372 | 393 | ||
373 | static void | 394 | static void |
374 | writeword(unsigned long base_addr, int portno, int value) | 395 | writeword(unsigned long base_addr, int portno, u16 value) |
375 | { | 396 | { |
376 | outw(value, base_addr + portno); | 397 | outw(value, base_addr + portno); |
377 | } | 398 | } |
378 | #endif | 399 | #endif |
379 | #endif | ||
380 | 400 | ||
381 | static void | 401 | static void |
382 | readwords(unsigned long base_addr, int portno, void *buf, int length) | 402 | readwords(unsigned long base_addr, int portno, void *buf, int length) |
@@ -384,11 +404,11 @@ readwords(unsigned long base_addr, int portno, void *buf, int length) | |||
384 | u8 *buf8 = (u8 *)buf; | 404 | u8 *buf8 = (u8 *)buf; |
385 | 405 | ||
386 | do { | 406 | do { |
387 | u32 tmp32; | 407 | u16 tmp16; |
388 | 408 | ||
389 | tmp32 = readword(base_addr, portno); | 409 | tmp16 = readword(base_addr, portno); |
390 | *buf8++ = (u8)tmp32; | 410 | *buf8++ = (u8)tmp16; |
391 | *buf8++ = (u8)(tmp32 >> 8); | 411 | *buf8++ = (u8)(tmp16 >> 8); |
392 | } while (--length); | 412 | } while (--length); |
393 | } | 413 | } |
394 | 414 | ||
@@ -398,23 +418,23 @@ writewords(unsigned long base_addr, int portno, void *buf, int length) | |||
398 | u8 *buf8 = (u8 *)buf; | 418 | u8 *buf8 = (u8 *)buf; |
399 | 419 | ||
400 | do { | 420 | do { |
401 | u32 tmp32; | 421 | u16 tmp16; |
402 | 422 | ||
403 | tmp32 = *buf8++; | 423 | tmp16 = *buf8++; |
404 | tmp32 |= (*buf8++) << 8; | 424 | tmp16 |= (*buf8++) << 8; |
405 | writeword(base_addr, portno, tmp32); | 425 | writeword(base_addr, portno, tmp16); |
406 | } while (--length); | 426 | } while (--length); |
407 | } | 427 | } |
408 | 428 | ||
409 | static int | 429 | static u16 |
410 | readreg(struct net_device *dev, int regno) | 430 | readreg(struct net_device *dev, u16 regno) |
411 | { | 431 | { |
412 | writeword(dev->base_addr, ADD_PORT, regno); | 432 | writeword(dev->base_addr, ADD_PORT, regno); |
413 | return readword(dev->base_addr, DATA_PORT); | 433 | return readword(dev->base_addr, DATA_PORT); |
414 | } | 434 | } |
415 | 435 | ||
416 | static void | 436 | static void |
417 | writereg(struct net_device *dev, int regno, int value) | 437 | writereg(struct net_device *dev, u16 regno, u16 value) |
418 | { | 438 | { |
419 | writeword(dev->base_addr, ADD_PORT, regno); | 439 | writeword(dev->base_addr, ADD_PORT, regno); |
420 | writeword(dev->base_addr, DATA_PORT, value); | 440 | writeword(dev->base_addr, DATA_PORT, value); |
@@ -780,7 +800,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
780 | } else { | 800 | } else { |
781 | i = lp->isa_config & INT_NO_MASK; | 801 | i = lp->isa_config & INT_NO_MASK; |
782 | if (lp->chip_type == CS8900) { | 802 | if (lp->chip_type == CS8900) { |
783 | #if defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) | 803 | #if defined(CONFIG_MACH_IXDP2351) || defined(CONFIG_ARCH_IXDP2X01) || defined(CONFIG_ARCH_PNX010X) |
784 | i = cs8900_irq_map[0]; | 804 | i = cs8900_irq_map[0]; |
785 | #else | 805 | #else |
786 | /* Translate the IRQ using the IRQ mapping table. */ | 806 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -1012,7 +1032,7 @@ skip_this_frame: | |||
1012 | 1032 | ||
1013 | void __init reset_chip(struct net_device *dev) | 1033 | void __init reset_chip(struct net_device *dev) |
1014 | { | 1034 | { |
1015 | #ifndef CONFIG_ARCH_IXDP2X01 | 1035 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) |
1016 | struct net_local *lp = netdev_priv(dev); | 1036 | struct net_local *lp = netdev_priv(dev); |
1017 | int ioaddr = dev->base_addr; | 1037 | int ioaddr = dev->base_addr; |
1018 | #endif | 1038 | #endif |
@@ -1023,7 +1043,7 @@ void __init reset_chip(struct net_device *dev) | |||
1023 | /* wait 30 ms */ | 1043 | /* wait 30 ms */ |
1024 | msleep(30); | 1044 | msleep(30); |
1025 | 1045 | ||
1026 | #ifndef CONFIG_ARCH_IXDP2X01 | 1046 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) |
1027 | if (lp->chip_type != CS8900) { | 1047 | if (lp->chip_type != CS8900) { |
1028 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ | 1048 | /* Hardware problem requires PNP registers to be reconfigured after a reset */ |
1029 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); | 1049 | writeword(ioaddr, ADD_PORT, PP_CS8920_ISAINT); |
@@ -1287,7 +1307,7 @@ net_open(struct net_device *dev) | |||
1287 | else | 1307 | else |
1288 | #endif | 1308 | #endif |
1289 | { | 1309 | { |
1290 | #if !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) | 1310 | #if !defined(CONFIG_MACH_IXDP2351) && !defined(CONFIG_ARCH_IXDP2X01) && !defined(CONFIG_ARCH_PNX010X) |
1291 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1311 | 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", | 1312 | 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); | 1313 | dev->name, dev->irq, lp->irq_map); |