diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2015-01-14 10:42:52 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2015-01-29 17:42:29 +0100 |
commit | 7e8d7f2ac2035efa04382bbeede1b4fbe1c66987 (patch) | |
tree | 7858c57b51a69fc71271695efab44b544740e979 /board/compulab/common | |
parent | fd29dd554af6e88ff6d794886e5ab7ba176ace17 (diff) | |
download | u-boot-imx-7e8d7f2ac2035efa04382bbeede1b4fbe1c66987.zip u-boot-imx-7e8d7f2ac2035efa04382bbeede1b4fbe1c66987.tar.gz u-boot-imx-7e8d7f2ac2035efa04382bbeede1b4fbe1c66987.tar.bz2 |
compulab: splash: support loading splash from sf
Add support for loading splash from sf.
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
[grinberg@compulab.co.il: staticize the sf global variable]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'board/compulab/common')
-rw-r--r-- | board/compulab/common/common.h | 1 | ||||
-rw-r--r-- | board/compulab/common/splash.c | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/board/compulab/common/common.h b/board/compulab/common/common.h index 09b4de6..b992965 100644 --- a/board/compulab/common/common.h +++ b/board/compulab/common/common.h @@ -26,6 +26,7 @@ static inline void cl_usb_hub_deinit(int gpio) {} enum splash_storage { SPLASH_STORAGE_NAND, + SPLASH_STORAGE_SF, }; struct splash_location { diff --git a/board/compulab/common/splash.c b/board/compulab/common/splash.c index f230d6d..16c315c 100644 --- a/board/compulab/common/splash.c +++ b/board/compulab/common/splash.c @@ -9,11 +9,36 @@ #include <common.h> #include <nand.h> #include <errno.h> +#include <spi_flash.h> +#include <spi.h> #include <bmp_layout.h> #include "common.h" DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_SPI_FLASH +static struct spi_flash *sf; +static int splash_sf_read(u32 bmp_load_addr, int offset, size_t read_size) +{ + if (!sf) { + sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, + CONFIG_SF_DEFAULT_CS, + CONFIG_SF_DEFAULT_SPEED, + CONFIG_SF_DEFAULT_MODE); + if (!sf) + return -ENODEV; + } + + return spi_flash_read(sf, offset, read_size, (void *)bmp_load_addr); +} +#else +static int splash_sf_read(u32 bmp_load_addr, int offset, size_t read_size) +{ + debug("%s: sf support not available\n", __func__); + return -ENOSYS; +} +#endif + #ifdef CONFIG_CMD_NAND static int splash_nand_read(u32 bmp_load_addr, int offset, size_t read_size) { @@ -42,6 +67,8 @@ static int splash_storage_read(struct splash_location *location, switch (location->storage) { case SPLASH_STORAGE_NAND: return splash_nand_read(bmp_load_addr, offset, read_size); + case SPLASH_STORAGE_SF: + return splash_sf_read(bmp_load_addr, offset, read_size); default: printf("Unknown splash location\n"); } |