summaryrefslogtreecommitdiff
path: root/cpu/ppc4xx
diff options
context:
space:
mode:
authorGrant Erickson <gerickson@nuovations.com>2008-05-21 13:28:30 -0700
committerStefan Roese <sr@denx.de>2008-06-03 20:20:01 +0200
commita439680019e06171d4a5694b7992accce87f590e (patch)
treee6d0b73f97b4de400f317d1caaf54b6976d71226 /cpu/ppc4xx
parent10a3367955bc2033b288915f8f10d0e507fe2fa1 (diff)
downloadu-boot-imx-a439680019e06171d4a5694b7992accce87f590e.zip
u-boot-imx-a439680019e06171d4a5694b7992accce87f590e.tar.gz
u-boot-imx-a439680019e06171d4a5694b7992accce87f590e.tar.bz2
PPC4xx: Simplified post_word_{load, store}
This patch simplifies post_word_{load,store} by using the preprocessor to eliminate redundant, copy-and-pasted code. Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Diffstat (limited to 'cpu/ppc4xx')
-rw-r--r--cpu/ppc4xx/commproc.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/cpu/ppc4xx/commproc.c b/cpu/ppc4xx/commproc.c
index 22156dd..8b2954c 100644
--- a/cpu/ppc4xx/commproc.c
+++ b/cpu/ppc4xx/commproc.c
@@ -30,29 +30,25 @@
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
-#if defined(CFG_POST_ALT_WORD_ADDR)
-void post_word_store (ulong a)
-{
- out_be32((void *)CFG_POST_ALT_WORD_ADDR, a);
-}
+#if defined(CFG_POST_WORD_ADDR)
+# define _POST_ADDR ((CFG_OCM_DATA_ADDR) + (CFG_POST_WORD_ADDR))
+#elif defined(CFG_POST_ALT_WORD_ADDR)
+# define _POST_ADDR (CFG_POST_ALT_WORD_ADDR)
+#endif
-ulong post_word_load (void)
-{
- return in_be32((void *)CFG_POST_ALT_WORD_ADDR);
-}
-#else /* CFG_POST_ALT_WORD_ADDR */
void post_word_store (ulong a)
{
- volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
- *(volatile ulong *) save_addr = a;
+ volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+ out_be32(save_addr, a);
}
ulong post_word_load (void)
{
- volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
- return *(volatile ulong *) save_addr;
+ volatile void *save_addr = (volatile void *)(_POST_ADDR);
+
+ return in_be32(save_addr);
}
-#endif /* CFG_POST_ALT_WORD_ADDR */
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/