From 81a3170b150cbcafc9a59c080f0e759f6a2a5ce5 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Thu, 15 Dec 2005 09:43:12 +0100 Subject: Changes to Yellowstone & Yosemite 440EP/GR eval boards: - Changed GPIO setup to enable another address line in order to address 64M of FLASH. - Added function sdram_tr1_set to auto calculate the tr1 value for the DDR. Patch by Steven Blakeslee, 12 Dec 2005 --- board/amcc/yellowstone/yellowstone.c | 93 +++++++++++++++++++++++++++++++++--- board/amcc/yosemite/yosemite.c | 93 +++++++++++++++++++++++++++++++++--- 2 files changed, 172 insertions(+), 14 deletions(-) (limited to 'board') diff --git a/board/amcc/yellowstone/yellowstone.c b/board/amcc/yellowstone/yellowstone.c index 585f072..8ddf910 100644 --- a/board/amcc/yellowstone/yellowstone.c +++ b/board/amcc/yellowstone/yellowstone.c @@ -59,10 +59,10 @@ int board_early_init_f(void) * Setup the GPIO pins *-------------------------------------------------------------------*/ /*CPLD cs */ - /*setup Address lines for flash sizes larger than 16Meg. */ - out32(GPIO0_OSRL, in32(GPIO0_OSRL) | 0x40010000); - out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x40010000); - out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x40000000); + /*setup Address lines for flash size 64Meg. */ + out32(GPIO0_OSRL, in32(GPIO0_OSRL) | 0x50010000); + out32(GPIO0_TSRL, in32(GPIO0_TSRL) | 0x50010000); + out32(GPIO0_ISR1L, in32(GPIO0_ISR1L) | 0x50000000); /*setup emac */ out32(GPIO0_TCR, in32(GPIO0_TCR) | 0xC080); @@ -129,7 +129,7 @@ int board_early_init_f(void) #endif /*get rid of flash write protect */ - *(unsigned char *)(CFG_BCSR_BASE | 0x07) = 0x40; + *(unsigned char *)(CFG_BCSR_BASE | 0x07) = 0x00; return 0; } @@ -207,9 +207,85 @@ int checkboard(void) * PLB @ 133 MHz * ************************************************************************/ +#define NUM_TRIES 64 +#define NUM_READS 10 + +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