diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:48:03 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:41 -0500 |
commit | 0c1f4a9fb13a54780f550d6e5bc4cd37a58f879e (patch) | |
tree | 0195ba57f94d4fca102bf5677d494f2727aa9fe6 /drivers/mtd/spi/sf-uclass.c | |
parent | 081bdc52c158dd3a4f73910cde3d7e70a5932d56 (diff) |
bootstd: Add a SPI flash bootdev
Add a bootdev for SPI flash so that these devices can be used with
standard boot. It only supports loading a script.
Add a special case for the label, since we want to use "spi", not
"spi_flash".
Enable the new bootdev on sandbox.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi/sf-uclass.c')
-rw-r--r-- | drivers/mtd/spi/sf-uclass.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index e6e650ef8c0..df1f75390c4 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -6,6 +6,7 @@ #define LOG_CATEGORY UCLASS_SPI_FLASH #include <common.h> +#include <bootdev.h> #include <dm.h> #include <log.h> #include <malloc.h> @@ -13,6 +14,7 @@ #include <spi_flash.h> #include <asm/global_data.h> #include <dm/device-internal.h> +#include <test/test.h> #include "sf_internal.h" DECLARE_GLOBAL_DATA_PTR; @@ -86,6 +88,14 @@ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, static int spi_flash_post_bind(struct udevice *dev) { + int ret; + + if (CONFIG_IS_ENABLED(BOOTDEV_SPI_FLASH) && test_sf_bootdev_enabled()) { + ret = bootdev_setup_for_dev(dev, "sf_bootdev"); + if (ret) + return log_msg_ret("bd", ret); + } + #if defined(CONFIG_NEEDS_MANUAL_RELOC) struct dm_spi_flash_ops *ops = sf_get_ops(dev); static int reloc_done; @@ -101,6 +111,7 @@ static int spi_flash_post_bind(struct udevice *dev) reloc_done++; } #endif + return 0; } |