diff mbox

[U-Boot,v2] nios2: export fdt_blob to the environment variable

Message ID 1444534456-6067-1-git-send-email-thomas@wytron.com.tw
State Accepted, archived
Delegated to: Thomas Chou
Headers show

Commit Message

Thomas Chou Oct. 11, 2015, 3:34 a.m. UTC
Export fdt_blob to the environment variable. So that we may
use it to boot Linux.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
v2
  move the code to per board, nios2-generic.c.

 board/altera/nios2-generic/nios2-generic.c | 9 +++++++++
 include/configs/nios2-generic.h            | 1 +
 2 files changed, 10 insertions(+)

Comments

Marek Vasut Oct. 11, 2015, 12:16 p.m. UTC | #1
On Sunday, October 11, 2015 at 05:34:16 AM, Thomas Chou wrote:
> Export fdt_blob to the environment variable. So that we may
> use it to boot Linux.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
> v2
>   move the code to per board, nios2-generic.c.
> 
>  board/altera/nios2-generic/nios2-generic.c | 9 +++++++++
>  include/configs/nios2-generic.h            | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/board/altera/nios2-generic/nios2-generic.c
> b/board/altera/nios2-generic/nios2-generic.c index e7fecd2..f508c00 100644
> --- a/board/altera/nios2-generic/nios2-generic.c
> +++ b/board/altera/nios2-generic/nios2-generic.c
> @@ -14,6 +14,8 @@
>  #include <asm/io.h>
>  #include <asm/gpio.h>
> 
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
>      defined(CONFIG_CFI_FLASH_MTD)
>  static void __early_flash_cmd_reset(void)
> @@ -35,6 +37,13 @@ int board_early_init_f(void)
>  	return 0;
>  }
> 
> +int misc_init_r(void)
> +{
> +	setenv_addr("fdt_blob", gd->fdt_blob);
> +
> +	return 0;
> +}


Shouldn't this go into generic code ?

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index e7fecd2..f508c00 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -14,6 +14,8 @@ 
 #include <asm/io.h>
 #include <asm/gpio.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
     defined(CONFIG_CFI_FLASH_MTD)
 static void __early_flash_cmd_reset(void)
@@ -35,6 +37,13 @@  int board_early_init_f(void)
 	return 0;
 }
 
+int misc_init_r(void)
+{
+	setenv_addr("fdt_blob", gd->fdt_blob);
+
+	return 0;
+}
+
 int checkboard(void)
 {
 #ifdef CONFIG_ALTERA_SYSID
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e4b5abb..14ab37f 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -15,6 +15,7 @@ 
 #include "../board/altera/nios2-generic/custom_fpga.h" /* fpga parameters */
 #define CONFIG_BOARD_NAME "nios2-generic" /* custom board name */
 #define CONFIG_BOARD_EARLY_INIT_F	/* enable early board-spec. init */
+#define CONFIG_MISC_INIT_R
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 #define CONFIG_SYS_NIOS_SYSID_BASE	CONFIG_SYS_SYSID_BASE