Blackfin: bf533-stamp: rewrite resource swap logic

The old swap function tended to clobber unrelated pins and screw up masks.
Rewrite the thing from scratch so it only uses the resources it needs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2008-10-11 22:38:37 -04:00
parent 29d4ea0a90
commit 1f75d6f0ff

View File

@ -54,29 +54,23 @@ phys_size_t initdram(int board_type)
return gd->bd->bi_memsize; return gd->bd->bi_memsize;
} }
/* PF0 and PF1 are used to switch between the ethernet and flash:
* PF0 PF1
* flash: 0 0
* ether: 1 0
*/
void swap_to(int device_id) void swap_to(int device_id)
{ {
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF1 | PF0);
if (device_id == ETHERNET) { SSYNC();
*pFIO_DIR = PF0; bfin_write_FIO_FLAG_C(PF1);
SSYNC(); if (device_id == ETHERNET)
*pFIO_FLAG_S = PF0; bfin_write_FIO_FLAG_S(PF0);
SSYNC(); else if (device_id == FLASH)
} else if (device_id == FLASH) { bfin_write_FIO_FLAG_C(PF0);
*pFIO_DIR = (PF4 | PF3 | PF2 | PF1 | PF0); else
*pFIO_FLAG_S = (PF4 | PF3 | PF2); printf("Unknown device to switch\n");
*pFIO_MASKA_D = (PF8 | PF6 | PF5); SSYNC();
*pFIO_MASKB_D = (PF7);
*pFIO_POLAR = (PF8 | PF6 | PF5);
*pFIO_EDGE = (PF8 | PF7 | PF6 | PF5);
*pFIO_INEN = (PF8 | PF7 | PF6 | PF5);
*pFIO_FLAG_D = (PF4 | PF3 | PF2);
SSYNC();
} else {
printf("Unknown bank to switch\n");
}
return;
} }
#if defined(CONFIG_MISC_INIT_R) #if defined(CONFIG_MISC_INIT_R)
@ -104,9 +98,6 @@ int misc_init_r(void)
if (cf_stat) { if (cf_stat) {
printf("Booting from COMPACT flash\n"); printf("Booting from COMPACT flash\n");
/* Set cycle time for CF */
*(volatile unsigned long *)ambctl1 = CF_AMBCTL1VAL;
for (i = 0; i < 0x1000; i++) for (i = 0; i < 0x1000; i++)
asm("nop;"); asm("nop;");
for (i = 0; i < 0x1000; i++) for (i = 0; i < 0x1000; i++)