[U-Boot] [PATCH] [Not for inclusion] Add support to verify UPM array
Selvamuthukumar
selva.muthukumar at e-coninfotech.com
Thu Oct 9 07:37:28 CEST 2008
---
This function is not called anywhere within main tree.
This is just for reference. Not to be included in main tree.
cpu/mpc83xx/cpu.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index 5862acd..be47a20 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -186,6 +186,44 @@ void upmconfig (uint upm, uint *table, uint size)
#endif
}
+void upmverify(int upm, uint *table, uint size)
+{
+ volatile immap_t *immap = (immap_t *) CFG_IMMR;
+ volatile lbus83xx_t *lbus = &immap->lbus;
+ volatile uchar *dummy = NULL;
+ const u32 msel = (upm + 4) << BR_MSEL_SHIFT; /* What the MSEL field in BRn should be */
+ volatile u32 *mxmr = &lbus->mamr + upm; /* Pointer to mamr, mbmr, or mcmr */
+ uint i, tout;
+
+ /* Scan all the banks to determine the base address of the device */
+ for (i = 0; i < 8; i++) {
+ if ((lbus->bank[i].br & BR_MSEL) == msel) {
+ dummy = (uchar *) (lbus->bank[i].br & BR_BA);
+ break;
+ }
+ }
+
+ if (!dummy) {
+ printf("Error: %s() could not find matching BR\n", __FUNCTION__);
+ hang();
+ }
+
+ /* Set the OP field in the MxMR to "write" and the MAD field to 000000 */
+ *mxmr = (*mxmr & 0xCFFFFFC0) | 0x10000000;
+
+ for (i = 0; i < size; i++) {
+ *mxmr = (*mxmr & 0xCFFFFFC0) | 0x20000000 | i;
+ tout = *dummy; /* Read the value to MDR */
+ __asm__ __volatile__ ("sync");
+ tout = 0x100000;
+ while(((*mxmr & 0x3f) != ((i + 1) & 0x3f)) && tout--);
+ if(lbus->mdr != table[i])
+ printf("%d: expected %08x, read %08x\n", i, table[i], lbus->mdr);
+ }
+
+ /* Set the OP field in the MxMR to "normal" and the MAD field to 000000 */
+ *mxmr &= 0xCFFFFFC0;
+}
int
do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
--
1.5.5
More information about the U-Boot
mailing list