* [U-Boot] [PATCH] nios2: export fdt_blob to the environment variable
@ 2015-10-09 11:46 Thomas Chou
2015-10-11 3:34 ` [U-Boot] [PATCH v2] " Thomas Chou
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Thomas Chou @ 2015-10-09 11:46 UTC (permalink / raw)
To: u-boot
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>
---
arch/nios2/lib/Makefile | 1 +
arch/nios2/lib/misc.c | 16 ++++++++++++++++
include/configs/nios2-generic.h | 1 +
3 files changed, 18 insertions(+)
create mode 100644 arch/nios2/lib/misc.c
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile
index e35d2e9..05deea4 100644
--- a/arch/nios2/lib/Makefile
+++ b/arch/nios2/lib/Makefile
@@ -8,3 +8,4 @@
obj-y += cache.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-y += libgcc.o
+obj-y += misc.o
diff --git a/arch/nios2/lib/misc.c b/arch/nios2/lib/misc.c
new file mode 100644
index 0000000..2cf8574
--- /dev/null
+++ b/arch/nios2/lib/misc.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int misc_init_r(void)
+{
+ setenv_addr("fdt_blob", gd->fdt_blob);
+
+ return 0;
+}
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
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2] nios2: export fdt_blob to the environment variable
2015-10-09 11:46 [U-Boot] [PATCH] nios2: export fdt_blob to the environment variable Thomas Chou
@ 2015-10-11 3:34 ` Thomas Chou
2015-10-11 12:16 ` Marek Vasut
2015-10-12 6:36 ` [U-Boot] [PATCH v3] env: " Thomas Chou
2015-10-16 0:44 ` [U-Boot] [PATCH v4] " Thomas Chou
2 siblings, 1 reply; 8+ messages in thread
From: Thomas Chou @ 2015-10-11 3:34 UTC (permalink / raw)
To: u-boot
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;
+}
+
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
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v2] nios2: export fdt_blob to the environment variable
2015-10-11 3:34 ` [U-Boot] [PATCH v2] " Thomas Chou
@ 2015-10-11 12:16 ` Marek Vasut
0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2015-10-11 12:16 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v3] env: export fdt_blob to the environment variable
2015-10-09 11:46 [U-Boot] [PATCH] nios2: export fdt_blob to the environment variable Thomas Chou
2015-10-11 3:34 ` [U-Boot] [PATCH v2] " Thomas Chou
@ 2015-10-12 6:36 ` Thomas Chou
2015-10-15 13:24 ` Simon Glass
2015-10-16 0:44 ` [U-Boot] [PATCH v4] " Thomas Chou
2 siblings, 1 reply; 8+ messages in thread
From: Thomas Chou @ 2015-10-12 6:36 UTC (permalink / raw)
To: u-boot
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.
v3
move the code to generic, board_r.c.
common/board_r.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/board_r.c b/common/board_r.c
index a4facf8..6f10a31 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -449,6 +449,7 @@ static int initr_env(void)
env_relocate();
else
set_default_env(NULL);
+ setenv_addr("fdt_blob", gd->fdt_blob);
/* Initialize from environment */
load_addr = getenv_ulong("loadaddr", 16, load_addr);
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v3] env: export fdt_blob to the environment variable
2015-10-12 6:36 ` [U-Boot] [PATCH v3] env: " Thomas Chou
@ 2015-10-15 13:24 ` Simon Glass
0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2015-10-15 13:24 UTC (permalink / raw)
To: u-boot
Hi,
On Monday, 12 October 2015, Thomas Chou <thomas@wytron.com.tw> 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.
> v3
> move the code to generic, board_r.c.
>
> common/board_r.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index a4facf8..6f10a31 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -449,6 +449,7 @@ static int initr_env(void)
> env_relocate();
> else
> set_default_env(NULL);
> + setenv_addr("fdt_blob", gd->fdt_blob);
>
> /* Initialize from environment */
> load_addr = getenv_ulong("loadaddr", 16, load_addr);
> --
> 2.1.4
>
We already have fdtcontroladdr, so how about using that instead?
Also please can you add docs to README.fdt-control? Also note that it
is read-only and cannot be changed. In fact changing it will be
ignored.
Regards,
Simon
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v4] env: export fdt_blob to the environment variable
2015-10-09 11:46 [U-Boot] [PATCH] nios2: export fdt_blob to the environment variable Thomas Chou
2015-10-11 3:34 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-10-12 6:36 ` [U-Boot] [PATCH v3] env: " Thomas Chou
@ 2015-10-16 0:44 ` Thomas Chou
2015-10-18 12:47 ` Simon Glass
2 siblings, 1 reply; 8+ messages in thread
From: Thomas Chou @ 2015-10-16 0:44 UTC (permalink / raw)
To: u-boot
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.
v3
move the code to generic, board_r.c.
v4
use fdtcontroladdr as Simon suggested.
common/board_r.c | 3 +++
doc/README.fdt-control | 5 ++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/board_r.c b/common/board_r.c
index a4facf8..d722081 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -449,6 +449,9 @@ static int initr_env(void)
env_relocate();
else
set_default_env(NULL);
+#ifdef CONFIG_OF_CONTROL
+ setenv_addr("fdtcontroladdr", gd->fdt_blob);
+#endif
/* Initialize from environment */
load_addr = getenv_ulong("loadaddr", 16, load_addr);
diff --git a/doc/README.fdt-control b/doc/README.fdt-control
index e6d5ed0..29fd56a 100644
--- a/doc/README.fdt-control
+++ b/doc/README.fdt-control
@@ -156,7 +156,10 @@ address of the fdt binary blob, and will override either of the options.
Be aware that this environment variable is checked prior to relocation,
when only the compiled-in environment is available. Therefore it is not
possible to define this variable in the saved SPI/NAND flash
-environment, for example (it will be ignored).
+environment, for example (it will be ignored). After relocation, this
+variable will be set to the address of the newly relocated fdt blob.
+It is read-only and cannot be changed. It can optionally be used to
+control the boot process of Linux with bootm/bootz commands.
To use this, put something like this in your board header file:
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v4] env: export fdt_blob to the environment variable
2015-10-16 0:44 ` [U-Boot] [PATCH v4] " Thomas Chou
@ 2015-10-18 12:47 ` Simon Glass
2015-10-18 23:16 ` Simon Glass
0 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2015-10-18 12:47 UTC (permalink / raw)
To: u-boot
On 15 October 2015 at 18:44, Thomas Chou <thomas@wytron.com.tw> 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.
> v3
> move the code to generic, board_r.c.
> v4
> use fdtcontroladdr as Simon suggested.
>
> common/board_r.c | 3 +++
> doc/README.fdt-control | 5 ++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
Acked-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH v4] env: export fdt_blob to the environment variable
2015-10-18 12:47 ` Simon Glass
@ 2015-10-18 23:16 ` Simon Glass
0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2015-10-18 23:16 UTC (permalink / raw)
To: u-boot
On 18 October 2015 at 06:47, Simon Glass <sjg@chromium.org> wrote:
> On 15 October 2015 at 18:44, Thomas Chou <thomas@wytron.com.tw> 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.
>> v3
>> move the code to generic, board_r.c.
>> v4
>> use fdtcontroladdr as Simon suggested.
>>
>> common/board_r.c | 3 +++
>> doc/README.fdt-control | 5 ++++-
>> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-10-18 23:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-09 11:46 [U-Boot] [PATCH] nios2: export fdt_blob to the environment variable Thomas Chou
2015-10-11 3:34 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-10-11 12:16 ` Marek Vasut
2015-10-12 6:36 ` [U-Boot] [PATCH v3] env: " Thomas Chou
2015-10-15 13:24 ` Simon Glass
2015-10-16 0:44 ` [U-Boot] [PATCH v4] " Thomas Chou
2015-10-18 12:47 ` Simon Glass
2015-10-18 23:16 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox