]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: xilinx: Add support for user configurable boot script offset
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Wed, 18 Dec 2019 10:34:41 +0000 (03:34 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 14 Jan 2020 08:05:52 +0000 (09:05 +0100)
Currently "script_offset_f" env variable is hardcoded, this variable
specifies from which offset of the flash boot.scr should be read/write.
As flashes are of different sizes having a fixed offset makes it
difficult to load other images into the flash which may overwrite the
boot script or cannot utilize the full memory. This current fix
creates a new config "CONFIG_BOOT_SCRIPT_OFFSET" which holds the
offset address, overwrites the "script_offset_f" variable.
Also removed existing variable with default values, as the default
values are held by CONFIG_BOOT_SCRIPT_OFFSET

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/Kconfig
board/xilinx/versal/board.c
board/xilinx/zynq/board.c
board/xilinx/zynqmp/zynqmp.c
include/configs/xilinx_versal.h
include/configs/xilinx_zynqmp.h
include/configs/zynq-common.h

index cb272eafda7a7497b62067f4c7362652d1248de5..7833b11767c4be50cf43364da055048d1ceb0aa7 100644 (file)
@@ -47,3 +47,12 @@ config XILINX_OF_BOARD_DTB_ADDR
        depends on OF_BOARD
        help
          Offset in the memory where the board configuration DTB is placed.
+
+config BOOT_SCRIPT_OFFSET
+       hex "Boot script offset"
+       depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL
+       default 0xFC0000 if ARCH_ZYNQ
+       default 0x3E80000 if ARCH_ZYNQMP
+       default 0x7F80000 if ARCH_VERSAL
+       help
+          Specifies distro boot script offset in NAND/NOR flash.
index 45724478a25e7f88eba85dd368ab5fdb240b466d..9fa9e76e6663b94dd50d963702aaa0714fa516c5 100644 (file)
@@ -203,6 +203,8 @@ int board_late_init(void)
        initrd_hi = round_down(initrd_hi, SZ_16M);
        env_set_addr("initrd_high", (void *)initrd_hi);
 
+       env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
+
        return 0;
 }
 
index cffabe825a201528c867e04355a40ffc065201f0..390d9482a70cfc0b80c47f94135f9bc46f83312c 100644 (file)
@@ -76,6 +76,8 @@ int board_late_init(void)
 
        env_set("boot_targets", new_targets);
 
+       env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
+
        return 0;
 }
 
index b72eade43eea9fb778f820a097f2dae801026975..8bdc67748ec2c55635859fc9cfefb81715d2851c 100644 (file)
@@ -667,6 +667,8 @@ int board_late_init(void)
        initrd_hi = round_down(initrd_hi, SZ_16M);
        env_set_addr("initrd_high", (void *)initrd_hi);
 
+       env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
+
        reset_reason();
 
        return 0;
index f426127edcff4485a0340e57f90982a270d1ce40..dec5001b5fe460852b1aaaa3adbb572a7bb85a2d 100644 (file)
@@ -92,7 +92,6 @@
        "kernel_size_r=0x10000000\0" \
        "scriptaddr=0x20000000\0" \
        "ramdisk_addr_r=0x02100000\0" \
-       "script_offset_f=0x7F80000\0" \
        "script_size_f=0x80000\0"
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
index ee1ceebf1291872e342aa6b92f666a6d48e8018e..9e08ed510805e214b5b1d7dd4eb4e2e7c87e111c 100644 (file)
        "kernel_addr_r=0x18000000\0" \
        "scriptaddr=0x20000000\0" \
        "ramdisk_addr_r=0x02100000\0" \
-       "script_offset_f=0x3e80000\0" \
        "script_size_f=0x80000\0" \
 
 #if defined(CONFIG_MMC_SDHCI_ZYNQ)
index 189ca81bbe00506cdf8555f2cd3fbf608b2fdefd..22486c0e4cfdcb9368fa384e8d2c7af82202bdad 100644 (file)
        "fdt_high=0x20000000\0"         \
        "initrd_high=0x20000000\0"      \
        "scriptaddr=0x20000\0"  \
-       "script_offset_f=0xFC0000\0"    \
        "script_size_f=0x40000\0"       \
        "fdt_addr_r=0x1f00000\0"        \
        "pxefile_addr_r=0x2000000\0"    \