From: peng.fan at nxp.com Date: Mon, 23 Sep 2019 10:18:41 +0800 Subject: [U-Boot] [PATCH V2 2/9] spl: spi: introduce spl_spi_get_uboot_offs In-Reply-To: <20190923021848.12500-1-peng.fan@nxp.com> References: <20190923021848.12500-1-peng.fan@nxp.com> Message-ID: <20190923021848.12500-2-peng.fan@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Peng Fan Introduce a weak function spl_spi_get_uboot_offs, then platform could have their own implementation. Signed-off-by: Peng Fan Cc: Simon Goldschmidt Cc: Tien Fong Chee Cc: Marek Vasut Cc: Andreas Dannenberg Cc: Alex Kiernan Cc: Stefan Roese Cc: Patrick Delaunay Cc: Miquel Raynal Cc: Michal Simek --- V2: switch raw_sector to offs common/spl/spl_spi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 9b74473377..84f20ea4ed 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) -- 2.16.4