summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2007-02-20 09:05:31 +0100
committerStefan Roese <sr@denx.de>2007-02-20 09:05:31 +0100
commitf4852ebe6ca946a509667eb68be42026f837be76 (patch)
tree917be25c40f04786f46f4ed849769ff2e685ffe1
parent3a8ce9af6fcb5744a7851b4440c07688acc40844 (diff)
downloadu-boot-imx-f4852ebe6ca946a509667eb68be42026f837be76.zip
u-boot-imx-f4852ebe6ca946a509667eb68be42026f837be76.tar.gz
u-boot-imx-f4852ebe6ca946a509667eb68be42026f837be76.tar.bz2
[PATCH 7_9] Replace ace_readw_ace_writeb functions with macros
Register read/write does not need to be wrapped in a full function. The patch replaces them with macros. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/systemace.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/drivers/systemace.c b/drivers/systemace.c
index 8dd98d0..3f329f9 100644
--- a/drivers/systemace.c
+++ b/drivers/systemace.c
@@ -53,38 +53,22 @@
* 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
-}
/* */