diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-12-09 17:21:08 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-02-05 21:25:35 -0500 |
commit | 97f265f14f23050f3cb997f617f3a6917b843ea2 (patch) | |
tree | f18a17dafeac9bdbd855fb1c4762c7d0d247d0da | |
parent | 67619982bfc5cd62710a48e3cbffc304cb78c341 (diff) | |
download | u-boot-imx-97f265f14f23050f3cb997f617f3a6917b843ea2.zip u-boot-imx-97f265f14f23050f3cb997f617f3a6917b843ea2.tar.gz u-boot-imx-97f265f14f23050f3cb997f617f3a6917b843ea2.tar.bz2 |
Blackfin: add support for fast SPI reads with Boot ROM
Newer Blackfin boot roms support using the fast SPI read command rather than
just the slow one. If the functionality is available, then use it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | cpu/blackfin/initcode.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/cpu/blackfin/initcode.c b/cpu/blackfin/initcode.c index 71f3375..704b791 100644 --- a/cpu/blackfin/initcode.c +++ b/cpu/blackfin/initcode.c @@ -133,12 +133,22 @@ static inline void serial_putc(char c) } -/* Max SCLK can be 133MHz ... dividing that by 4 gives - * us a freq of 33MHz for SPI which should generally be +/* Max SCLK can be 133MHz ... dividing that by (2*4) gives + * us a freq of 16MHz for SPI which should generally be * slow enough for the slow reads the bootrom uses. */ +#if !defined(CONFIG_SPI_FLASH_SLOW_READ) && \ + ((defined(__ADSPBF52x__) && __SILICON_REVISION__ >= 2) || \ + (defined(__ADSPBF54x__) && __SILICON_REVISION__ >= 1)) +# define BOOTROM_SUPPORTS_SPI_FAST_READ 1 +#else +# define BOOTROM_SUPPORTS_SPI_FAST_READ 0 +#endif #ifndef CONFIG_SPI_BAUD_INITBLOCK -# define CONFIG_SPI_BAUD_INITBLOCK 4 +# define CONFIG_SPI_BAUD_INITBLOCK (BOOTROM_SUPPORTS_SPI_FAST_READ ? 2 : 4) +#endif +#ifdef SPI0_BAUD +# define bfin_write_SPI_BAUD bfin_write_SPI0_BAUD #endif /* PLL_DIV defines */ @@ -254,12 +264,11 @@ void initcode(ADI_BOOT_DATA *bootstruct) * boot. Once we switch over to u-boot's SPI flash driver, we'll * increase the speed appropriately. */ - if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER) -#ifdef SPI0_BAUD - bfin_write_SPI0_BAUD(CONFIG_SPI_BAUD_INITBLOCK); -#else + if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER) { + if (BOOTROM_SUPPORTS_SPI_FAST_READ && CONFIG_SPI_BAUD_INITBLOCK < 4) + bootstruct->dFlags |= BFLAG_FASTREAD; bfin_write_SPI_BAUD(CONFIG_SPI_BAUD_INITBLOCK); -#endif + } serial_putc('B'); |