vserver 2.0 rc7
[linux-2.6.git] / drivers / net / smc91x.h
index fad8c04..ddd2688 100644 (file)
@@ -162,6 +162,45 @@ SMC_outw(u16 val, unsigned long ioaddr, int reg)
        }
 }
 
+#elif  defined(CONFIG_ARCH_OMAP)
+
+/* We can only do 16-bit reads and writes in the static memory space. */
+#define SMC_CAN_USE_8BIT       0
+#define SMC_CAN_USE_16BIT      1
+#define SMC_CAN_USE_32BIT      0
+#define SMC_IO_SHIFT           0
+#define SMC_NOWAIT             1
+
+#define SMC_inb(a, r)          readb((a) + (r))
+#define SMC_outb(v, a, r)      writeb(v, (a) + (r))
+#define SMC_inw(a, r)          readw((a) + (r))
+#define SMC_outw(v, a, r)      writew(v, (a) + (r))
+#define SMC_insw(a, r, p, l)   readsw((a) + (r), p, l)
+#define SMC_outsw(a, r, p, l)  writesw((a) + (r), p, l)
+#define SMC_inl(a, r)          readl((a) + (r))
+#define SMC_outl(v, a, r)      writel(v, (a) + (r))
+#define SMC_insl(a, r, p, l)   readsl((a) + (r), p, l)
+#define SMC_outsl(a, r, p, l)  writesl((a) + (r), p, l)
+
+#elif  defined(CONFIG_SH_SH4202_MICRODEV)
+
+#define SMC_CAN_USE_8BIT       0
+#define SMC_CAN_USE_16BIT      1
+#define SMC_CAN_USE_32BIT      0
+
+#define SMC_inb(a, r)          inb((a) + (r) - 0xa0000000)
+#define SMC_inw(a, r)          inw((a) + (r) - 0xa0000000)
+#define SMC_inl(a, r)          inl((a) + (r) - 0xa0000000)
+#define SMC_outb(v, a, r)      outb(v, (a) + (r) - 0xa0000000)
+#define SMC_outw(v, a, r)      outw(v, (a) + (r) - 0xa0000000)
+#define SMC_outl(v, a, r)      outl(v, (a) + (r) - 0xa0000000)
+#define SMC_insl(a, r, p, l)   insl((a) + (r) - 0xa0000000, p, l)
+#define SMC_outsl(a, r, p, l)  outsl((a) + (r) - 0xa0000000, p, l)
+#define SMC_insw(a, r, p, l)   insw((a) + (r) - 0xa0000000, p, l)
+#define SMC_outsw(a, r, p, l)  outsw((a) + (r) - 0xa0000000, p, l)
+
+#define set_irq_type(irq, type)        do {} while(0)
+
 #elif  defined(CONFIG_ISA)
 
 #define SMC_CAN_USE_8BIT       1
@@ -362,7 +401,7 @@ smc_pxa_dma_irq(int dma, void *dummy, struct pt_regs *regs)
 #define SMC_IO_SHIFT   0
 #endif
 #define SMC_IO_EXTENT  (16 << SMC_IO_SHIFT)
-
+#define SMC_DATA_EXTENT (4)
 
 /*
  . Bank Select Register:
@@ -883,7 +922,7 @@ static const char * chip_ids[ 16 ] =  {
 #endif
 
 #if SMC_CAN_USE_32BIT
-#define SMC_PUSH_DATA(p, l)                                            \
+#define _SMC_PUSH_DATA(p, l)                                           \
        do {                                                            \
                char *__ptr = (p);                                      \
                int __len = (l);                                        \
@@ -898,7 +937,7 @@ static const char * chip_ids[ 16 ] =  {
                        SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );  \
                }                                                       \
        } while (0)
-#define SMC_PULL_DATA(p, l)                                            \
+#define _SMC_PULL_DATA(p, l)                                           \
        do {                                                            \
                char *__ptr = (p);                                      \
                int __len = (l);                                        \
@@ -918,11 +957,11 @@ static const char * chip_ids[ 16 ] =  {
                SMC_insl( ioaddr, DATA_REG, __ptr, __len >> 2);         \
        } while (0)
 #elif SMC_CAN_USE_16BIT
-#define SMC_PUSH_DATA(p, l)    SMC_outsw( ioaddr, DATA_REG, p, (l) >> 1 )
-#define SMC_PULL_DATA(p, l)    SMC_insw ( ioaddr, DATA_REG, p, (l) >> 1 )
+#define _SMC_PUSH_DATA(p, l)   SMC_outsw( ioaddr, DATA_REG, p, (l) >> 1 )
+#define _SMC_PULL_DATA(p, l)   SMC_insw ( ioaddr, DATA_REG, p, (l) >> 1 )
 #elif SMC_CAN_USE_8BIT
-#define SMC_PUSH_DATA(p, l)    SMC_outsb( ioaddr, DATA_REG, p, l )
-#define SMC_PULL_DATA(p, l)    SMC_insb ( ioaddr, DATA_REG, p, l )
+#define _SMC_PUSH_DATA(p, l)   SMC_outsb( ioaddr, DATA_REG, p, l )
+#define _SMC_PULL_DATA(p, l)   SMC_insb ( ioaddr, DATA_REG, p, l )
 #endif
 
 #if ! SMC_CAN_USE_16BIT
@@ -941,6 +980,51 @@ static const char * chip_ids[ 16 ] =  {
        })
 #endif
 
+#if SMC_CAN_USE_DATACS
+#define SMC_PUSH_DATA(p, l)                                            \
+       if ( lp->datacs ) {                                             \
+               unsigned char *__ptr = (p);                             \
+               int __len = (l);                                        \
+               if (__len >= 2 && (unsigned long)__ptr & 2) {           \
+                       __len -= 2;                                     \
+                       SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );  \
+                       __ptr += 2;                                     \
+               }                                                       \
+               outsl(lp->datacs, __ptr, __len >> 2);                   \
+               if (__len & 2) {                                        \
+                       __ptr += (__len & ~3);                          \
+                       SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );  \
+               }                                                       \
+       } else {                                                        \
+               _SMC_PUSH_DATA(p, l);                                   \
+       }
+
+#define SMC_PULL_DATA(p, l)                                            \
+       if ( lp->datacs ) {                                             \
+               unsigned char *__ptr = (p);                             \
+               int __len = (l);                                        \
+               if ((unsigned long)__ptr & 2) {                         \
+                       /*                                              \
+                        * We want 32bit alignment here.                \
+                        * Since some buses perform a full 32bit        \
+                        * fetch even for 16bit data we can't use       \
+                        * SMC_inw() here.  Back both source (on chip   \
+                        * and destination) pointers of 2 bytes.        \
+                        */                                             \
+                       __ptr -= 2;                                     \
+                       __len += 2;                                     \
+                       SMC_SET_PTR( 2|PTR_READ|PTR_RCV|PTR_AUTOINC );  \
+               }                                                       \
+               __len += 2;                                             \
+               insl( lp->datacs, __ptr, __len >> 2);                   \
+       } else {                                                        \
+               _SMC_PULL_DATA(p, l);                                   \
+       }
+#else
+#define SMC_PUSH_DATA(p, l) _SMC_PUSH_DATA(p, l)
+#define SMC_PULL_DATA(p, l) _SMC_PULL_DATA(p, l)
+#endif
+
 #if !defined (SMC_INTERRUPT_PREAMBLE)
 # define SMC_INTERRUPT_PREAMBLE
 #endif