aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smc91x.h
diff options
context:
space:
mode:
authorMarc Singer <elf@buici.com>2006-05-16 06:41:40 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-18 11:16:50 -0400
commitd4adcffb6574d3414f2e39d6ca1be5eccf97ac52 (patch)
tree1604f18abc55dd1bf0679affb5e9b62fa31fc54e /drivers/net/smc91x.h
parentc97898614bf0ac9605333a2c99bdbcf4276a22bd (diff)
[ARM] 3406/1: lpd7x: compilation fix for smc91x
Patch from Marc Singer Reworking of the adaptation macros to allow driver to compile again for the lpd7x's. Also, support added for the lh79520 so it may use the smc91x. Signed-off-by: Marc Singer <elf@buici.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net/smc91x.h')
-rw-r--r--drivers/net/smc91x.h44
1 files changed, 28 insertions, 16 deletions
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index e1be1af51201..c88f164aa710 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -242,15 +242,17 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
242#define RPC_LSA_DEFAULT RPC_LED_TX_RX 242#define RPC_LSA_DEFAULT RPC_LED_TX_RX
243#define RPC_LSB_DEFAULT RPC_LED_100_10 243#define RPC_LSB_DEFAULT RPC_LED_100_10
244 244
245#elif defined(CONFIG_MACH_LPD7A400) || defined(CONFIG_MACH_LPD7A404) 245#elif defined(CONFIG_MACH_LPD79520) \
246 || defined(CONFIG_MACH_LPD7A400) \
247 || defined(CONFIG_MACH_LPD7A404)
246 248
247/* The LPD7A40X_IOBARRIER is necessary to overcome a mismatch between 249/* The LPD7X_IOBARRIER is necessary to overcome a mismatch between the
248 * the way that the CPU handles chip selects and the way that the SMC 250 * way that the CPU handles chip selects and the way that the SMC chip
249 * chip expects the chip select to operate. Refer to 251 * expects the chip select to operate. Refer to
250 * Documentation/arm/Sharp-LH/IOBarrier for details. The read from 252 * Documentation/arm/Sharp-LH/IOBarrier for details. The read from
251 * IOBARRIER is a byte as a least-common denominator of possible 253 * IOBARRIER is a byte, in order that we read the least-common
252 * regions to use as the barrier. It would be wasteful to read 32 254 * denominator. It would be wasteful to read 32 bits from an 8-bit
253 * bits from a byte oriented region. 255 * accessible region.
254 * 256 *
255 * There is no explicit protection against interrupts intervening 257 * There is no explicit protection against interrupts intervening
256 * between the writew and the IOBARRIER. In SMC ISR there is a 258 * between the writew and the IOBARRIER. In SMC ISR there is a
@@ -269,25 +271,35 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
269#define SMC_CAN_USE_16BIT 1 271#define SMC_CAN_USE_16BIT 1
270#define SMC_CAN_USE_32BIT 0 272#define SMC_CAN_USE_32BIT 0
271#define SMC_NOWAIT 0 273#define SMC_NOWAIT 0
272#define LPD7A40X_IOBARRIER readb (IOBARRIER_VIRT) 274#define LPD7X_IOBARRIER readb (IOBARRIER_VIRT)
273 275
274#define SMC_inw(a,r) readw ((void*) ((a) + (r))) 276#define SMC_inw(a,r)\
275#define SMC_insw(a,r,p,l) readsw ((void*) ((a) + (r)), p, l) 277 ({ unsigned short v = readw ((void*) ((a) + (r))); LPD7X_IOBARRIER; v; })
276#define SMC_outw(v,a,r) ({ writew ((v), (a) + (r)); LPD7A40X_IOBARRIER; }) 278#define SMC_outw(v,a,r) ({ writew ((v), (a) + (r)); LPD7X_IOBARRIER; })
277 279
278#define SMC_outsw LPD7A40X_SMC_outsw 280#define SMC_insw LPD7_SMC_insw
281static inline void LPD7_SMC_insw (unsigned char* a, int r,
282 unsigned char* p, int l)
283{
284 unsigned short* ps = (unsigned short*) p;
285 while (l-- > 0) {
286 *ps++ = readw (a + r);
287 LPD7X_IOBARRIER;
288 }
289}
279 290
280static inline void LPD7A40X_SMC_outsw(unsigned long a, int r, 291#define SMC_outsw LPD7_SMC_outsw
281 unsigned char* p, int l) 292static inline void LPD7_SMC_outsw (unsigned char* a, int r,
293 unsigned char* p, int l)
282{ 294{
283 unsigned short* ps = (unsigned short*) p; 295 unsigned short* ps = (unsigned short*) p;
284 while (l-- > 0) { 296 while (l-- > 0) {
285 writew (*ps++, a + r); 297 writew (*ps++, a + r);
286 LPD7A40X_IOBARRIER; 298 LPD7X_IOBARRIER;
287 } 299 }
288} 300}
289 301
290#define SMC_INTERRUPT_PREAMBLE LPD7A40X_IOBARRIER 302#define SMC_INTERRUPT_PREAMBLE LPD7X_IOBARRIER
291 303
292#define RPC_LSA_DEFAULT RPC_LED_TX_RX 304#define RPC_LSA_DEFAULT RPC_LED_TX_RX
293#define RPC_LSB_DEFAULT RPC_LED_100_10 305#define RPC_LSB_DEFAULT RPC_LED_100_10