diff options
Diffstat (limited to 'drivers/net/smc91x.h')
-rw-r--r-- | drivers/net/smc91x.h | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 8606818653f8..22209b6f1405 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -40,23 +40,46 @@ | |||
40 | * Define your architecture specific bus configuration parameters here. | 40 | * Define your architecture specific bus configuration parameters here. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #if defined(CONFIG_ARCH_LUBBOCK) | 43 | #if defined(CONFIG_ARCH_LUBBOCK) ||\ |
44 | defined(CONFIG_MACH_MAINSTONE) ||\ | ||
45 | defined(CONFIG_MACH_ZYLONITE) ||\ | ||
46 | defined(CONFIG_MACH_LITTLETON) | ||
44 | 47 | ||
45 | /* We can only do 16-bit reads and writes in the static memory space. */ | 48 | #include <asm/mach-types.h> |
46 | #define SMC_CAN_USE_8BIT 0 | 49 | |
50 | /* Now the bus width is specified in the platform data | ||
51 | * pretend here to support all I/O access types | ||
52 | */ | ||
53 | #define SMC_CAN_USE_8BIT 1 | ||
47 | #define SMC_CAN_USE_16BIT 1 | 54 | #define SMC_CAN_USE_16BIT 1 |
48 | #define SMC_CAN_USE_32BIT 0 | 55 | #define SMC_CAN_USE_32BIT 1 |
49 | #define SMC_NOWAIT 1 | 56 | #define SMC_NOWAIT 1 |
50 | 57 | ||
51 | /* The first two address lines aren't connected... */ | 58 | #define SMC_IO_SHIFT (lp->io_shift) |
52 | #define SMC_IO_SHIFT 2 | ||
53 | 59 | ||
60 | #define SMC_inb(a, r) readb((a) + (r)) | ||
54 | #define SMC_inw(a, r) readw((a) + (r)) | 61 | #define SMC_inw(a, r) readw((a) + (r)) |
55 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | 62 | #define SMC_inl(a, r) readl((a) + (r)) |
63 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
64 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
56 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | 65 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
57 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 66 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
67 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
68 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
58 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | 69 | #define SMC_IRQ_FLAGS (-1) /* from resource */ |
59 | 70 | ||
71 | /* We actually can't write halfwords properly if not word aligned */ | ||
72 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | ||
73 | { | ||
74 | if (machine_is_mainstone() && reg & 2) { | ||
75 | unsigned int v = val << 16; | ||
76 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | ||
77 | writel(v, ioaddr + (reg & ~2)); | ||
78 | } else { | ||
79 | writew(val, ioaddr + reg); | ||
80 | } | ||
81 | } | ||
82 | |||
60 | #elif defined(CONFIG_BLACKFIN) | 83 | #elif defined(CONFIG_BLACKFIN) |
61 | 84 | ||
62 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | 85 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH |
@@ -195,7 +218,6 @@ | |||
195 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 218 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
196 | 219 | ||
197 | #elif defined(CONFIG_ARCH_INNOKOM) || \ | 220 | #elif defined(CONFIG_ARCH_INNOKOM) || \ |
198 | defined(CONFIG_MACH_MAINSTONE) || \ | ||
199 | defined(CONFIG_ARCH_PXA_IDP) || \ | 221 | defined(CONFIG_ARCH_PXA_IDP) || \ |
200 | defined(CONFIG_ARCH_RAMSES) || \ | 222 | defined(CONFIG_ARCH_RAMSES) || \ |
201 | defined(CONFIG_ARCH_PCM027) | 223 | defined(CONFIG_ARCH_PCM027) |
@@ -229,22 +251,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
229 | } | 251 | } |
230 | } | 252 | } |
231 | 253 | ||
232 | #elif defined(CONFIG_MACH_ZYLONITE) | ||
233 | |||
234 | #define SMC_CAN_USE_8BIT 1 | ||
235 | #define SMC_CAN_USE_16BIT 1 | ||
236 | #define SMC_CAN_USE_32BIT 0 | ||
237 | #define SMC_IO_SHIFT 0 | ||
238 | #define SMC_NOWAIT 1 | ||
239 | #define SMC_USE_PXA_DMA 1 | ||
240 | #define SMC_inb(a, r) readb((a) + (r)) | ||
241 | #define SMC_inw(a, r) readw((a) + (r)) | ||
242 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | ||
243 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | ||
244 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
245 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
246 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
247 | |||
248 | #elif defined(CONFIG_ARCH_OMAP) | 254 | #elif defined(CONFIG_ARCH_OMAP) |
249 | 255 | ||
250 | /* We can only do 16-bit reads and writes in the static memory space. */ | 256 | /* We can only do 16-bit reads and writes in the static memory space. */ |
@@ -454,7 +460,6 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
454 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 460 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
455 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX | 461 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX |
456 | 462 | ||
457 | #define SMC_DYNAMIC_BUS_CONFIG | ||
458 | #endif | 463 | #endif |
459 | 464 | ||
460 | 465 | ||
@@ -493,7 +498,7 @@ struct smc_local { | |||
493 | 498 | ||
494 | spinlock_t lock; | 499 | spinlock_t lock; |
495 | 500 | ||
496 | #ifdef SMC_USE_PXA_DMA | 501 | #ifdef CONFIG_ARCH_PXA |
497 | /* DMA needs the physical address of the chip */ | 502 | /* DMA needs the physical address of the chip */ |
498 | u_long physaddr; | 503 | u_long physaddr; |
499 | struct device *device; | 504 | struct device *device; |
@@ -501,20 +506,17 @@ struct smc_local { | |||
501 | void __iomem *base; | 506 | void __iomem *base; |
502 | void __iomem *datacs; | 507 | void __iomem *datacs; |
503 | 508 | ||
509 | /* the low address lines on some platforms aren't connected... */ | ||
510 | int io_shift; | ||
511 | |||
504 | struct smc91x_platdata cfg; | 512 | struct smc91x_platdata cfg; |
505 | }; | 513 | }; |
506 | 514 | ||
507 | #ifdef SMC_DYNAMIC_BUS_CONFIG | 515 | #define SMC_8BIT(p) ((p)->cfg.flags & SMC91X_USE_8BIT) |
508 | #define SMC_8BIT(p) (((p)->cfg.flags & SMC91X_USE_8BIT) && SMC_CAN_USE_8BIT) | 516 | #define SMC_16BIT(p) ((p)->cfg.flags & SMC91X_USE_16BIT) |
509 | #define SMC_16BIT(p) (((p)->cfg.flags & SMC91X_USE_16BIT) && SMC_CAN_USE_16BIT) | 517 | #define SMC_32BIT(p) ((p)->cfg.flags & SMC91X_USE_32BIT) |
510 | #define SMC_32BIT(p) (((p)->cfg.flags & SMC91X_USE_32BIT) && SMC_CAN_USE_32BIT) | ||
511 | #else | ||
512 | #define SMC_8BIT(p) SMC_CAN_USE_8BIT | ||
513 | #define SMC_16BIT(p) SMC_CAN_USE_16BIT | ||
514 | #define SMC_32BIT(p) SMC_CAN_USE_32BIT | ||
515 | #endif | ||
516 | 518 | ||
517 | #ifdef SMC_USE_PXA_DMA | 519 | #ifdef CONFIG_ARCH_PXA |
518 | /* | 520 | /* |
519 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is | 521 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is |
520 | * always happening in irq context so no need to worry about races. TX is | 522 | * always happening in irq context so no need to worry about races. TX is |
@@ -608,7 +610,7 @@ smc_pxa_dma_irq(int dma, void *dummy) | |||
608 | { | 610 | { |
609 | DCSR(dma) = 0; | 611 | DCSR(dma) = 0; |
610 | } | 612 | } |
611 | #endif /* SMC_USE_PXA_DMA */ | 613 | #endif /* CONFIG_ARCH_PXA */ |
612 | 614 | ||
613 | 615 | ||
614 | /* | 616 | /* |