[U-Boot] [PATCH] Added support for the Guntermann & Drunck PowerPC 440 EP/GR ETX module.

Eibach, Dirk Eibach at gdsys.de
Fri Nov 28 09:53:19 CET 2008


Hello Wolfgang,

Thanks for the review. I'm busys cleaning up the code, but at one point
I need some help: 

> > 
> +/********************************************************************
> > +*****
> > + *  initdram -- doesn't use serial presence detect.
> > + *
> > + *  Assumes:    256 MB, ECC, non-registered
> 
> Do not hard-code sizes. Use aut-sizing, please.
> 
> > +void sdram_tr1_set(int ram_address, int* tr1_value) {
> > +	int i;
> > +	int j, k;
> > +	volatile unsigned int* ram_pointer =  (unsigned 
> int*)ram_address;
> > +	int first_good = -1, last_bad = 0x1ff;
> > +
> > +	unsigned long test[NUM_TRIES] = {
> > +		0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
> > +		0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
> > +		0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
> > +		0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000,
> > +		0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
> > +		0xAAAAAAAA, 0xAAAAAAAA, 0x55555555, 0x55555555,
> > +		0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
> > +		0x55555555, 0x55555555, 0xAAAAAAAA, 0xAAAAAAAA,
> > +		0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
> > +		0xA5A5A5A5, 0xA5A5A5A5, 0x5A5A5A5A, 0x5A5A5A5A,
> > +		0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
> > +		0x5A5A5A5A, 0x5A5A5A5A, 0xA5A5A5A5, 0xA5A5A5A5,
> > +		0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
> > +		0xAA55AA55, 0xAA55AA55, 0x55AA55AA, 0x55AA55AA,
> > +		0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55,
> > +		0x55AA55AA, 0x55AA55AA, 0xAA55AA55, 0xAA55AA55 };
> > +
> > +	/* go through all possible SDRAM0_TR1[RDCT] values */
> > +	for (i=0; i<=0x1ff; i++) {
> > +		/* set the current value for TR1 */
> > +		mtsdram(mem_tr1, (0x80800800 | i));
> > +
> > +		/* write values */
> > +		for (j=0; j<NUM_TRIES; j++) {
> > +			ram_pointer[j] = test[j];
> > +
> > +			/* clear any cache at ram location */
> > +			__asm__("dcbf 0,%0": :"r" (&ram_pointer[j]));
> > +		}
> > +
> > +		/* read values back */
> > +		for (j=0; j<NUM_TRIES; j++) {
> > +			for (k=0; k<NUM_READS; k++) {
> > +				/* clear any cache at ram location */
> > +				__asm__("dcbf 0,%0": :"r" 
> (&ram_pointer[j]));
> > +
> > +				if (ram_pointer[j] != test[j])
> > +					break;
> > +			}
> > +
> > +			/* read error */
> > +			if (k != NUM_READS) {
> > +				break;
> > +			}
> > +		}
> 
> Please do not implement yet another RAM test in U-Boot. We 
> already have enough of them. If you really want to test your 
> RAM, that is. For auto-sizing, you should use memsize() instead.

You are right, there is no RAM test necessary here. I want to use
auto-sizing with memsize(), but I did not find any refererences to that
in u-boot sources. Probaly I am missing something obvious. Can you show
me an example, where auto-sizing is used?

Cheers
Dirk



More information about the U-Boot mailing list