The default value for the MxMR register is not always the right one.
This patch adds the value of MxMR register as an additional
parameter (plus a few defines instead of hex coded values).

Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]>
---
 cpu/mpc85xx/cpu.c |   17 +++++++++++------
 include/common.h  |    4 ++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
index 2373b4a..081e804 100644
--- a/cpu/mpc85xx/cpu.c
+++ b/cpu/mpc85xx/cpu.c
@@ -314,16 +314,21 @@ int dma_xfer(void *dest, uint count, void *src) {
        return dma_check();
 }
 #endif
+
+#define MXMR_OP_NORMAL (0x00000000)
+#define MXMR_OP_WRITE  (0x10000000)
+#define MXMR_OP_READ   (0x20000000)
+#define MXMR_OP_RUN    (0x30000000)
+
 /*
- * Configures a UPM. Currently, the loop fields in MxMR (RLF, WLF and TLF)
- * are hardcoded as "1"."size" is the number or entries, not a sizeof.
+ * Configures a UPM. The MxMR mode is the fourth parameter.
+ * "size" is the number or entries, not a sizeof.
  */
-void upmconfig (uint upm, uint * table, uint size)
+void upmconfig(uint upm, uint *table, uint size, unsigned int mxmr_mode)
 {
        int i, mdr, mad, old_mad = 0;
        volatile u32 *mxmr;
        volatile ccsr_lbc_t *lbc = (void *)(CFG_MPC85xx_LBC_ADDR);
-       int loopval = 0x00004440;
        volatile u32 *brp,*orp;
        volatile u8* dummy = NULL;
        int upmmask;
@@ -364,7 +369,7 @@ void upmconfig (uint upm, uint * table, uint size)
 
        for (i = 0; i < size; i++) {
                /* 1 */
-               out_be32(mxmr, loopval | 0x10000000 | i); /* OP_WRITE */
+               out_be32(mxmr, mxmr_mode | MXMR_OP_WRITE | i);
                /* 2 */
                out_be32(&lbc->mdr, table[i]);
                /* 3 */
@@ -377,5 +382,5 @@ void upmconfig (uint upm, uint * table, uint size)
                } while (mad <= old_mad && !(!mad && i == (size-1)));
                old_mad = mad;
        }
-       out_be32(mxmr, loopval); /* OP_NORMAL */
+       out_be32(mxmr, mxmr_mode | MXMR_OP_NORMAL);
 }
diff --git a/include/common.h b/include/common.h
index 10b997e..0c0ef5b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -441,7 +441,11 @@ void               ppcDWstore(unsigned int *addr, unsigned 
int *value);
 int    checkcpu      (void);
 int    checkicache   (void);
 int    checkdcache   (void);
+#ifdef CONFIG_MPC85xx
+void   upmconfig     (unsigned int, unsigned int *, unsigned int, unsigned 
int);
+#else
 void   upmconfig     (unsigned int, unsigned int *, unsigned int);
+#endif
 ulong  get_tbclk     (void);
 void   reset_cpu     (ulong addr);
 #if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
-- 
1.5.5.2


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to