]> git.sur5r.net Git - u-boot/blobdiff - drivers/systemace.c
[PATCH] Clean up Katmai (440SPe) linker script
[u-boot] / drivers / systemace.c
index 8dd98d03fb04e6fe4df507aa751aa81de2958537..9502623a74116095c7b7afff39f7fb19f1af5b0e 100644 (file)
  * to be the base address for the chip, usually in the local
  * peripheral bus.
  */
-static unsigned ace_readw(unsigned offset)
-{
-#if (CFG_SYSTEMACE_WIDTH == 8)
-       u16 temp;
-
-#if !defined(__BIG_ENDIAN)
-       temp = ((u16) readb(CFG_SYSTEMACE_BASE + offset) << 8);
-       temp |= (u16) readb(CFG_SYSTEMACE_BASE + offset + 1);
-#else
-       temp = (u16) readb(CFG_SYSTEMACE_BASE + offset);
-       temp |= ((u16) readb(CFG_SYSTEMACE_BASE + offset + 1) << 8);
-#endif
-       return temp;
-#else
-       return readw(CFG_SYSTEMACE_BASE + offset);
-#endif
-}
-
-static void ace_writew(unsigned val, unsigned offset)
-{
 #if (CFG_SYSTEMACE_WIDTH == 8)
 #if !defined(__BIG_ENDIAN)
-       writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset);
-       writeb((u8) val, CFG_SYSTEMACE_BASE + offset + 1);
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)<<8) | \
+                        (readb(CFG_SYSTEMACE_BASE+off+1)))
+#define ace_write(val, off) {writeb(val>>8, CFG_SYSTEMACE_BASE+off); \
+                             writeb(val, CFG_SYSTEMACE_BASE+off+1);}
 #else
-       writeb((u8) val, CFG_SYSTEMACE_BASE + offset);
-       writeb((u8) (val >> 8), CFG_SYSTEMACE_BASE + offset + 1);
+#define ace_readw(off) ((readb(CFG_SYSTEMACE_BASE+off)) | \
+                        (readb(CFG_SYSTEMACE_BASE+off+1)<<8))
+#define ace_write(val, off) {writeb(val, CFG_SYSTEMACE_BASE+off); \
+                             writeb(val>>8, CFG_SYSTEMACE_BASE+off+1);}
 #endif
 #else
-       writew(val, CFG_SYSTEMACE_BASE + offset);
+#define ace_readw(off) (readw(CFG_SYSTEMACE_BASE+off))
+#define ace_writew(val, off) (writew(val, CFG_SYSTEMACE_BASE+off))
 #endif
-}
 
 /* */
 
 static unsigned long systemace_read(int dev, unsigned long start,
-                                    unsigned long blkcnt,
-                                    unsigned long *buffer);
+                                    unsigned long blkcnt, void *buffer);
 
 static block_dev_desc_t systemace_dev = { 0 };
 
@@ -149,11 +132,11 @@ block_dev_desc_t *systemace_get_dev(int dev)
  * number of blocks read. A zero return indicates an error.
  */
 static unsigned long systemace_read(int dev, unsigned long start,
-                                    unsigned long blkcnt, unsigned long *buffer)
+                                    unsigned long blkcnt, void *buffer)
 {
        int retry;
        unsigned blk_countdown;
-       unsigned char *dp = (unsigned char *)buffer;
+       unsigned char *dp = buffer;
        unsigned val;
 
        if (get_cf_lock() < 0) {