
Marc Leeman wrote:
I'm trying to program the UPM A on the 8347E processor. Next to having bus errors while writing from Linux (RAM words for HPI are not correct yet, but that's something I have to figure out), I'm having problems with reading the RAM words back out for testing/debugging/verification.
Looks to me like you're having an out-of-order problem.
I wrote a version of your function some time ago, and included it in the set of changes for the 83xx tree that was made available to Wolfgang a few weeks ago, but he hasn't pulled them yet. You can find those changes here:
http://opensource.freescale.com/git?p=u-boot-83xx.git;a=summary
For your convenience, here's the upmconfig() function I wrote:
void upmconfig (uint upm, uint *table, uint size) { #if defined(CONFIG_MPC834X) 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;
/* 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++) { lbus->mdr = table[i]; __asm__ __volatile__ ("sync"); *dummy; /* Write the value to memory and increment MAD */ __asm__ __volatile__ ("sync"); }
/* Set the OP field in the MxMR to "normal" and the MAD field to 000000 */ *mxmr &= 0xCFFFFFC0; #else printf("Error: %s() not defined for this configuration.\n", __FUNCTION__); hang(); #endif }