From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Mon, 20 Nov 2006 10:37:29 -0600 Subject: [U-Boot-Users] 834x UPM Read access RAM Array (stuck?). In-Reply-To: <20061120142744.GI5492@scorpius.homelinux.org> References: <20061120142744.GI5492@scorpius.homelinux.org> Message-ID: <4561D9C9.50008@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 } -- Timur Tabi Linux Kernel Developer @ Freescale