Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Marc Singer and committed by
Russell King
d4adcffb c9789861

+28 -16
+28 -16
drivers/net/smc91x.h
··· 242 242 #define RPC_LSA_DEFAULT RPC_LED_TX_RX 243 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 248 - * the way that the CPU handles chip selects and the way that the SMC 249 - * chip expects the chip select to operate. Refer to 249 + /* The LPD7X_IOBARRIER is necessary to overcome a mismatch between the 250 + * way that the CPU handles chip selects and the way that the SMC chip 251 + * expects the chip select to operate. Refer to 250 252 * Documentation/arm/Sharp-LH/IOBarrier for details. The read from 251 - * IOBARRIER is a byte as a least-common denominator of possible 252 - * regions to use as the barrier. It would be wasteful to read 32 253 - * bits from a byte oriented region. 253 + * IOBARRIER is a byte, in order that we read the least-common 254 + * denominator. It would be wasteful to read 32 bits from an 8-bit 255 + * accessible region. 254 256 * 255 257 * There is no explicit protection against interrupts intervening 256 258 * between the writew and the IOBARRIER. In SMC ISR there is a ··· 271 269 #define SMC_CAN_USE_16BIT 1 272 270 #define SMC_CAN_USE_32BIT 0 273 271 #define SMC_NOWAIT 0 274 - #define LPD7A40X_IOBARRIER readb (IOBARRIER_VIRT) 272 + #define LPD7X_IOBARRIER readb (IOBARRIER_VIRT) 275 273 276 - #define SMC_inw(a,r) readw ((void*) ((a) + (r))) 277 - #define SMC_insw(a,r,p,l) readsw ((void*) ((a) + (r)), p, l) 278 - #define SMC_outw(v,a,r) ({ writew ((v), (a) + (r)); LPD7A40X_IOBARRIER; }) 274 + #define SMC_inw(a,r)\ 275 + ({ unsigned short v = readw ((void*) ((a) + (r))); LPD7X_IOBARRIER; v; }) 276 + #define SMC_outw(v,a,r) ({ writew ((v), (a) + (r)); LPD7X_IOBARRIER; }) 279 277 280 - #define SMC_outsw LPD7A40X_SMC_outsw 278 + #define SMC_insw LPD7_SMC_insw 279 + static inline void LPD7_SMC_insw (unsigned char* a, int r, 280 + unsigned char* p, int l) 281 + { 282 + unsigned short* ps = (unsigned short*) p; 283 + while (l-- > 0) { 284 + *ps++ = readw (a + r); 285 + LPD7X_IOBARRIER; 286 + } 287 + } 281 288 282 - static inline void LPD7A40X_SMC_outsw(unsigned long a, int r, 283 - unsigned char* p, int l) 289 + #define SMC_outsw LPD7_SMC_outsw 290 + static inline void LPD7_SMC_outsw (unsigned char* a, int r, 291 + unsigned char* p, int l) 284 292 { 285 293 unsigned short* ps = (unsigned short*) p; 286 294 while (l-- > 0) { 287 295 writew (*ps++, a + r); 288 - LPD7A40X_IOBARRIER; 296 + LPD7X_IOBARRIER; 289 297 } 290 298 } 291 299 292 - #define SMC_INTERRUPT_PREAMBLE LPD7A40X_IOBARRIER 300 + #define SMC_INTERRUPT_PREAMBLE LPD7X_IOBARRIER 293 301 294 302 #define RPC_LSA_DEFAULT RPC_LED_TX_RX 295 303 #define RPC_LSB_DEFAULT RPC_LED_100_10