summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <[email protected]>2019-09-23 10:18:41 +0800
committerStefano Babic <[email protected]>2019-10-08 16:36:36 +0200
commitec649330942b7898f0e95c832f16ee189df91609 (patch)
tree2f6ba7e1d90126fba23f33b37693d1f68793b035
parent30ecc9c323ec2db72a709da7d3f3f70373aa52ee (diff)
spl: spi: introduce spl_spi_get_uboot_offs
Introduce a weak function spl_spi_get_uboot_offs, then platform could have their own implementation. Signed-off-by: Peng Fan <[email protected]> Cc: Simon Goldschmidt <[email protected]> Cc: Tien Fong Chee <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Andreas Dannenberg <[email protected]> Cc: Alex Kiernan <[email protected]> Cc: Stefan Roese <[email protected]> Cc: Patrick Delaunay <[email protected]> Cc: Miquel Raynal <[email protected]> Cc: Michal Simek <[email protected]>
-rw-r--r--common/spl/spl_spi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 9b74473377f..84f20ea4ed9 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -62,6 +62,12 @@ static ulong spl_spi_fit_read(struct spl_load_info *load, ulong sector,
else
return 0;
}
+
+unsigned int __weak spl_spi_get_uboot_offs(struct spi_flash *flash)
+{
+ return CONFIG_SYS_SPI_U_BOOT_OFFS;
+}
+
/*
* The main entry for SPI booting. It's necessary that SDRAM is already
* configured and available since this code loads the main U-Boot image
@@ -71,7 +77,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
int err = 0;
- unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS;
+ unsigned int payload_offs;
struct spi_flash *flash;
struct image_header *header;
@@ -90,6 +96,8 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
return -ENODEV;
}
+ payload_offs = spl_spi_get_uboot_offs(flash);
+
header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)