[U-Boot] ppc: using d-cache for C stack and as cache at thesame time?

Peter Tyser
2009-04-01T14:48:31Z

On Wed, 2009-04-01 at 17:29 +0800, Liu Dave-R63238 wrote:
> > > AFAIK, while running from flash, u-boot uses (part of)
> > d-cache on some
> > > platforms for the C stack. I think, it's on MPC83xx and MPC85xx?
> > >
> > > Does anybody know, if I can use the remaining part of the d-cache
> > > as normal d-cache, e.g. to generate bursts on the SDRAM interface
> > > while testing the RAM?
> >
> > On which platform?
> >
> > Note that implementing a memory test that actually triggers burst
> > mode accesses is really, really tricky. You probably do NOT want to
> > do this while running from flash (i. e. from a very restrictive
> > envrionment). You might want to have a look at examples/test_burst*
> > but note that this code was written for a MPC8xx system, so changes
> > will be required for 83xx or 85xx.
> >
> > Also note that a much more reliable test for burst mode errors is to
> > boot Linux with root file system over NFS and then compile the Linux
> > kernel on the target.
>
> It needs case by case.
>
> * 83xx, the whole d-cache is locked
> If you need generate bursts on DRAM interface, you have to change to
> way locked. Otherwise, you can use the DMA to generate burst.
>
> * 85xx, half of d-cache is locked.
> it is possible to generate the burst at 85xx.
> Try to use dcbf....

You should be able to use the 85xx DMA engine to generate the bursts too
(I'd assume the same for 83xx, but never tried it). See
cpu/mpc85xx/cpu.c dma_*(). The default values of the satr0 and datr0
don't allow the processor to snoop transactions, so you'd have to use
cache operations or change datr0/satr0 to something like 0x50000 for
your tests.

We've added a very basic DMA test to the mtest command which is used for
board testing here. Let me know if you'd like me to send it - its not
cleaned up but could give you a starting point.

Best,
Peter