Re: [PATCH] sunxi: add fdtoverlay_addr_r environment variable

2021-03-17 Thread Andre Przywara
On Sun, 21 Feb 2021 10:44:47 +0100
Jernej Skrabec  wrote:

> Commit 69076dff2284 ("cmd: pxe: add support for FDT overlays") added
> support for loading DT overlay files to PXE boot. However, it needs
> additional environment variable which points to memory location which
> can be used to temporary store overlay data.
> 
> Add it and in the process unify alignment using spaces.
> 
> Signed-off-by: Jernej Skrabec 

Thanks, looks good. Briefly tested with manually applying a simple
overlay, loaded to that address.
Checked that the other addresses don't change.

One nit below, with that:

Reviewed-by: Andre Przywara 

> ---
>  include/configs/sunxi-common.h | 48 ++
>  1 file changed, 26 insertions(+), 22 deletions(-)
> 
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index ded5aea551d3..4814e898c6ea 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -62,7 +62,7 @@
>  #define SDRAM_OFFSET(x) 0x2##x
>  #define CONFIG_SYS_SDRAM_BASE0x2000
>  #define CONFIG_SYS_LOAD_ADDR 0x2200 /* default load address */
> -/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here 
> +/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
>   * since it needs to fit in with the other values. By also #defining it
>   * we get warnings if the Kconfig value mismatches. */
>  #define CONFIG_SPL_STACK_R_ADDR  0x2fe0
> @@ -72,7 +72,7 @@
>  #define CONFIG_SYS_SDRAM_BASE0x4000
>  #define CONFIG_SYS_LOAD_ADDR 0x4200 /* default load address */
>  /* V3s do not have enough memory to place code at 0x4a00 */
> -/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here 
> +/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
>   * since it needs to fit in with the other values. By also #defining it
>   * we get warnings if the Kconfig value mismatches. */
>  #define CONFIG_SPL_STACK_R_ADDR  0x4fe0
> @@ -259,38 +259,41 @@ extern int soft_i2c_gpio_scl;
>   * Scripts, PXE and DTBs should go afterwards, leaving the rest for the 
> initrd.
>   * Align the initrd to a 2MB page.

This is no longer true. 
But there is no such requirement, so we can just remove this line.

Cheers,
Andre

>   */
> -#define BOOTM_SIZE   __stringify(0xa00)
> -#define KERNEL_ADDR_R__stringify(SDRAM_OFFSET(008))
> -#define FDT_ADDR_R   __stringify(SDRAM_OFFSET(FA0))
> -#define SCRIPT_ADDR_R__stringify(SDRAM_OFFSET(FC0))
> -#define PXEFILE_ADDR_R   __stringify(SDRAM_OFFSET(FD0))
> -#define RAMDISK_ADDR_R   __stringify(SDRAM_OFFSET(FE0))
> +#define BOOTM_SIZE__stringify(0xa00)
> +#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(008))
> +#define FDT_ADDR_R__stringify(SDRAM_OFFSET(FA0))
> +#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(FC0))
> +#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(FD0))
> +#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(FE0))
> +#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(FF0))
>  
>  #else
>  /*
>   * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
>   * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
> - * 1M script, 1M pxe and the ramdisk at the end.
> + * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
>   */
>  #ifndef CONFIG_MACH_SUN8I_V3S
> -#define BOOTM_SIZE __stringify(0xa00)
> -#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(200))
> -#define FDT_ADDR_R __stringify(SDRAM_OFFSET(300))
> -#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(310))
> -#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(320))
> -#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(330))
> +#define BOOTM_SIZE__stringify(0xa00)
> +#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(200))
> +#define FDT_ADDR_R__stringify(SDRAM_OFFSET(300))
> +#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(310))
> +#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(320))
> +#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(330))
> +#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(340))
>  #else
>  /*
>   * 64M RAM minus 2MB heap + 16MB for u-boot, stack, fb, etc.
>   * 16M uncompressed kernel, 8M compressed kernel, 1M fdt,
> - * 1M script, 1M pxe and the ramdisk at the end.
> + * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
>   */
> -#define BOOTM_SIZE __stringify(0x2e0)
> -#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(100))
> -#define FDT_ADDR_R __stringify(SDRAM_OFFSET(180))
> -#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(190))
> -#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(1A0))
> -#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(1B0))
> +#define BOOTM_SIZE__stringify(0x2e0)
> +#define KERNEL_ADDR_R 

[PATCH] sunxi: add fdtoverlay_addr_r environment variable

2021-02-21 Thread Jernej Skrabec
Commit 69076dff2284 ("cmd: pxe: add support for FDT overlays") added
support for loading DT overlay files to PXE boot. However, it needs
additional environment variable which points to memory location which
can be used to temporary store overlay data.

Add it and in the process unify alignment using spaces.

Signed-off-by: Jernej Skrabec 
---
 include/configs/sunxi-common.h | 48 ++
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index ded5aea551d3..4814e898c6ea 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -62,7 +62,7 @@
 #define SDRAM_OFFSET(x) 0x2##x
 #define CONFIG_SYS_SDRAM_BASE  0x2000
 #define CONFIG_SYS_LOAD_ADDR   0x2200 /* default load address */
-/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here 
+/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
  * since it needs to fit in with the other values. By also #defining it
  * we get warnings if the Kconfig value mismatches. */
 #define CONFIG_SPL_STACK_R_ADDR0x2fe0
@@ -72,7 +72,7 @@
 #define CONFIG_SYS_SDRAM_BASE  0x4000
 #define CONFIG_SYS_LOAD_ADDR   0x4200 /* default load address */
 /* V3s do not have enough memory to place code at 0x4a00 */
-/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here 
+/* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
  * since it needs to fit in with the other values. By also #defining it
  * we get warnings if the Kconfig value mismatches. */
 #define CONFIG_SPL_STACK_R_ADDR0x4fe0
@@ -259,38 +259,41 @@ extern int soft_i2c_gpio_scl;
  * Scripts, PXE and DTBs should go afterwards, leaving the rest for the initrd.
  * Align the initrd to a 2MB page.
  */
-#define BOOTM_SIZE __stringify(0xa00)
-#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(008))
-#define FDT_ADDR_R __stringify(SDRAM_OFFSET(FA0))
-#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(FC0))
-#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(FD0))
-#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(FE0))
+#define BOOTM_SIZE__stringify(0xa00)
+#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(008))
+#define FDT_ADDR_R__stringify(SDRAM_OFFSET(FA0))
+#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(FC0))
+#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(FD0))
+#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(FE0))
+#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(FF0))
 
 #else
 /*
  * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
  * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
- * 1M script, 1M pxe and the ramdisk at the end.
+ * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
  */
 #ifndef CONFIG_MACH_SUN8I_V3S
-#define BOOTM_SIZE __stringify(0xa00)
-#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(200))
-#define FDT_ADDR_R __stringify(SDRAM_OFFSET(300))
-#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(310))
-#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(320))
-#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(330))
+#define BOOTM_SIZE__stringify(0xa00)
+#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(200))
+#define FDT_ADDR_R__stringify(SDRAM_OFFSET(300))
+#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(310))
+#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(320))
+#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(330))
+#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(340))
 #else
 /*
  * 64M RAM minus 2MB heap + 16MB for u-boot, stack, fb, etc.
  * 16M uncompressed kernel, 8M compressed kernel, 1M fdt,
- * 1M script, 1M pxe and the ramdisk at the end.
+ * 1M script, 1M pxe, 1M dt overlay and the ramdisk at the end.
  */
-#define BOOTM_SIZE __stringify(0x2e0)
-#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(100))
-#define FDT_ADDR_R __stringify(SDRAM_OFFSET(180))
-#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(190))
-#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(1A0))
-#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(1B0))
+#define BOOTM_SIZE__stringify(0x2e0)
+#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(100))
+#define FDT_ADDR_R__stringify(SDRAM_OFFSET(180))
+#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(190))
+#define PXEFILE_ADDR_R__stringify(SDRAM_OFFSET(1A0))
+#define FDTOVERLAY_ADDR_R __stringify(SDRAM_OFFSET(1B0))
+#define RAMDISK_ADDR_R__stringify(SDRAM_OFFSET(1C0))
 #endif
 #endif
 
@@ -300,6 +303,7 @@ extern int soft_i2c_gpio_scl;
"fdt_addr_r=" FDT_ADDR_R "\0" \
"scriptaddr=" SCRIPT_ADDR_R "\0" \
"pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
+   "fdtoverlay_addr_r=" FDTOVERLAY_ADDR_R "\0" \