spl: nand: Introduce spl_nand_get_uboot_raw_page
authorPeng Fan <peng.fan@nxp.com>
Mon, 23 Sep 2019 02:18:43 +0000 (10:18 +0800)
committerStefano Babic <sbabic@denx.de>
Tue, 8 Oct 2019 14:36:36 +0000 (16:36 +0200)
Introduce weak spl_nand_get_uboot_raw_page, then platform could
have their own implementation.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Andreas Dannenberg <dannenberg@ti.com>
Cc: Alex Kiernan <alex.kiernan@gmail.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Michal Simek <michal.simek@xilinx.com>
common/spl/spl_nand.c

index e2bcefb111e1f94bfc78b54a86cd09c19ff546ff..d3185dc0170c4b2bf6807b0c94a7583388f71700 100644 (file)
 #include <linux/libfdt_env.h>
 #include <fdt.h>
 
+uint32_t __weak spl_nand_get_uboot_raw_page(void)
+{
+       return CONFIG_SYS_NAND_U_BOOT_OFFS;
+}
+
 #if defined(CONFIG_SPL_NAND_RAW_ONLY)
 static int spl_nand_load_image(struct spl_image_info *spl_image,
                        struct spl_boot_device *bootdev)
@@ -21,7 +26,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
               CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
               CONFIG_SYS_NAND_U_BOOT_DST);
 
-       nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+       nand_spl_load_image(spl_nand_get_uboot_raw_page(),
                            CONFIG_SYS_NAND_U_BOOT_SIZE,
                            (void *)CONFIG_SYS_NAND_U_BOOT_DST);
        spl_set_header_raw_uboot(spl_image);
@@ -139,7 +144,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
 #endif
 #endif
        /* Load u-boot */
-       err = spl_nand_load_element(spl_image, CONFIG_SYS_NAND_U_BOOT_OFFS,
+       err = spl_nand_load_element(spl_image, spl_nand_get_uboot_raw_page(),
                                    header);
 #ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND
 #if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND