diff options
author | Heiko Schocher <hs@denx.de> | 2014-11-18 09:41:58 +0100 |
---|---|---|
committer | Andreas Bießmann <andreas.devel@googlemail.com> | 2015-01-19 12:49:28 +0100 |
commit | a1655bb2e1e2bf8f30f40b46d1bb7a45810634be (patch) | |
tree | 2b66296e338510249024f4a959d421e15ea070a9 /board/siemens | |
parent | 389aee89308daf67c540e80aafd1d2f1a694f0e8 (diff) | |
download | u-boot-imx-a1655bb2e1e2bf8f30f40b46d1bb7a45810634be.zip u-boot-imx-a1655bb2e1e2bf8f30f40b46d1bb7a45810634be.tar.gz u-boot-imx-a1655bb2e1e2bf8f30f40b46d1bb7a45810634be.tar.bz2 |
taurus, spl: erase also spi flash if recovery button is pressed
if in SPL mode recovery button is pressed, erase also spi flash
from offset 0 to CONFIG_SYS_NAND_U_BOOT_SIZE on the taurus board.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'board/siemens')
-rw-r--r-- | board/siemens/taurus/taurus.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c index b8ff478..013dac2 100644 --- a/board/siemens/taurus/taurus.c +++ b/board/siemens/taurus/taurus.c @@ -68,6 +68,7 @@ static void taurus_nand_hw_init(void) #if defined(CONFIG_SPL_BUILD) #include <spl.h> #include <nand.h> +#include <spi_flash.h> void matrix_init(void) { @@ -81,23 +82,28 @@ void matrix_init(void) void at91_spl_board_init(void) { taurus_nand_hw_init(); + at91_spi0_hw_init(TAURUS_SPI_MASK); /* Configure recovery button PINs */ at91_set_gpio_input(AT91_PIN_PA31, 1); /* check if button is pressed */ if (at91_get_gpio_value(AT91_PIN_PA31) == 0) { - u32 boot_device; + struct spi_flash *flash; debug("Recovery button pressed\n"); - boot_device = spl_boot_device(); - switch (boot_device) { -#ifdef CONFIG_SPL_NAND_SUPPORT - case BOOT_DEVICE_NAND: - nand_init(); - spl_nand_erase_one(0, 0); - break; -#endif + nand_init(); + spl_nand_erase_one(0, 0); + flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, + 0, + CONFIG_SF_DEFAULT_SPEED, + SPI_MODE_3); + if (!flash) { + puts("no flash\n"); + } else { + puts("erase spi flash sector 0\n"); + spi_flash_erase(flash, 0, + CONFIG_SYS_NAND_U_BOOT_SIZE); } } } |