forked from u-boot/u-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: spl: Add a test for the SPI load method
Add test for the SPI load method. This one is pretty straightforward. We can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image doesn't know the total image size and has to guess from fdt_totalsize. This doesn't include external data, so loading it will fail. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Glass <[email protected]>
- Loading branch information
Showing
8 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ enum { | |
BOOT_DEVICE_VBE, | ||
BOOT_DEVICE_CPGMAC, | ||
BOOT_DEVICE_NOR, | ||
BOOT_DEVICE_SPI, | ||
}; | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Copyright (C) 2023 Sean Anderson <[email protected]> | ||
*/ | ||
|
||
#include <common.h> | ||
#include <dm.h> | ||
#include <spi_flash.h> | ||
#include <spl.h> | ||
#include <test/spl.h> | ||
#include <test/ut.h> | ||
|
||
static int spl_test_spi_write_image(struct unit_test_state *uts, void *img, | ||
size_t img_size) | ||
{ | ||
struct spi_flash *flash; | ||
|
||
flash = spi_flash_probe(spl_spi_boot_bus(), spl_spi_boot_cs(), | ||
CONFIG_SF_DEFAULT_SPEED, | ||
CONFIG_SF_DEFAULT_MODE); | ||
ut_assertnonnull(flash); | ||
ut_assertok(spi_flash_write(flash, spl_spi_get_uboot_offs(flash), | ||
img_size, img)); | ||
|
||
return 0; | ||
} | ||
|
||
static int spl_test_spi(struct unit_test_state *uts, const char *test_name, | ||
enum spl_test_image type) | ||
{ | ||
return do_spl_test_load(uts, test_name, type, | ||
SPL_LOAD_IMAGE_GET(1, BOOT_DEVICE_SPI, | ||
spl_spi_load_image), | ||
spl_test_spi_write_image); | ||
} | ||
SPL_IMG_TEST(spl_test_spi, LEGACY, DM_FLAGS); | ||
SPL_IMG_TEST(spl_test_spi, IMX8, DM_FLAGS); | ||
SPL_IMG_TEST(spl_test_spi, FIT_INTERNAL, DM_FLAGS); | ||
#if !IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) | ||
SPL_IMG_TEST(spl_test_spi, FIT_EXTERNAL, DM_FLAGS); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters