All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH v1 0/2] Fix to keystone2 uinitrd fixup logic
@ 2018-09-11  7:36 Nicholas Faustini
  2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 1/2] fdt: add call to ft_board_setup_ex() for ks2 boards Nicholas Faustini
  2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 2/2] board: ks2: move uinitrd fixup logic inside ft_board_setup_ex Nicholas Faustini
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Faustini @ 2018-09-11  7:36 UTC (permalink / raw)
  To: u-boot

For ks2 devices with PAE enabled, the function ft_board_setup() (board/ti/ks2_evm/board.c) is supposed to update at runtime the /chosen fdt node by shifting the initrd start/end addresses into the 36b
it address space. Unfortunately, this mechanism doesn't work since the /chosen node has not been populated at the time of the ft_board_setup() call. The root of the issue is that, at some point in u-boot history, the call sequence of fdt_initrd() and ft_board_setup() (common/image-fdt.c) has been inverted: ft_board_setup() is called before fdt_initrd().

Error shown by Linux during startup is:
[    0.000000] INITRD: 0x8fcec000+0x00313dc8 is not a memory region - disabling initrd

I would propose to move the fdt initrd fixup logic from ft_board_setup() to ft_board_setup_ex() since the latter is called esclusively for keystone devices.

Moreover, cmd/fdt.c command should include the call of ft_board_setup_ex() since keystone2 devices will require it.


Nicholas Faustini (2):
  fdt: add call to ft_board_setup_ex() for ks2 boards
  board: ks2: move uinitrd fixup logic inside ft_board_setup_ex

 board/ti/ks2_evm/board.c | 44 ++++++++++++++++++++--------------------
 cmd/fdt.c                |  3 +++
 2 files changed, 25 insertions(+), 22 deletions(-)

-- 
2.17.1


-- 
Disclaimer: This email and any files transmitted along with it may contain 
Azcom confidential and proprietary information. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action based on the contents of the information contained herein 
is strictly prohibited.
If you are not an intended recipient of this 
transmission and you received it in error, please inform the sender by 
reply e-mail and destroy this and all other copies of this transmission to 
which you have access.
The sender of this email or Azcom does not accept 
liability for any errors or omissions in the contents of this message that 
may occur as a result.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [RFC PATCH v1 1/2] fdt: add call to ft_board_setup_ex() for ks2 boards
  2018-09-11  7:36 [U-Boot] [RFC PATCH v1 0/2] Fix to keystone2 uinitrd fixup logic Nicholas Faustini
@ 2018-09-11  7:36 ` Nicholas Faustini
  2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 2/2] board: ks2: move uinitrd fixup logic inside ft_board_setup_ex Nicholas Faustini
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Faustini @ 2018-09-11  7:36 UTC (permalink / raw)
  To: u-boot

When updating the board FDT, some of the operations
are performed by ft_board_setup_ex() and should be
executed also by the fdt command.

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>
---

 cmd/fdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index 28de467f96..8a19a3fdbf 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -596,6 +596,9 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			       fdt_strerror(err));
 			return CMD_RET_FAILURE;
 		}
+#ifdef CONFIG_SOC_KEYSTONE
+		ft_board_setup_ex(working_fdt, gd->bd);
+#endif
 	}
 #endif
 	/* Create a chosen node */
-- 
2.17.1


-- 
Disclaimer: This email and any files transmitted along with it may contain 
Azcom confidential and proprietary information. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action based on the contents of the information contained herein 
is strictly prohibited.
If you are not an intended recipient of this 
transmission and you received it in error, please inform the sender by 
reply e-mail and destroy this and all other copies of this transmission to 
which you have access.
The sender of this email or Azcom does not accept 
liability for any errors or omissions in the contents of this message that 
may occur as a result.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [RFC PATCH v1 2/2] board: ks2: move uinitrd fixup logic inside ft_board_setup_ex
  2018-09-11  7:36 [U-Boot] [RFC PATCH v1 0/2] Fix to keystone2 uinitrd fixup logic Nicholas Faustini
  2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 1/2] fdt: add call to ft_board_setup_ex() for ks2 boards Nicholas Faustini
@ 2018-09-11  7:36 ` Nicholas Faustini
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Faustini @ 2018-09-11  7:36 UTC (permalink / raw)
  To: u-boot

The uinitrd fixup logic should be executed after the FDT /chosen
node has been properly populated by fdt_initrd()

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>

---

 board/ti/ks2_evm/board.c | 44 ++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index 274f18e942..d81c8e621f 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -146,14 +146,10 @@ int ft_board_setup(void *blob, bd_t *bd)
 	int nbanks;
 	u64 size[2];
 	u64 start[2];
-	int nodeoffset;
 	u32 ddr3a_size;
-	int unitrd_fixup = 0;
 
 	env = env_get("mem_lpae");
 	lpae = env && simple_strtol(env, NULL, 0);
-	env = env_get("uinitrd_fixup");
-	unitrd_fixup = env && simple_strtol(env, NULL, 0);
 
 	ddr3a_size = 0;
 	if (lpae) {
@@ -191,24 +187,41 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 	fdt_fixup_memory_banks(blob, start, size, nbanks);
 
+	return 0;
+}
+
+void ft_board_setup_ex(void *blob, bd_t *bd)
+{
+	int lpae;
+	u64 size;
+	char *env;
+	u64 *reserve_start;
+	int unitrd_fixup = 0;
+
+	env = env_get("mem_lpae");
+	lpae = env && simple_strtol(env, NULL, 0);
+	env = env_get("uinitrd_fixup");
+	unitrd_fixup = env && simple_strtol(env, NULL, 0);
+
 	/* Fix up the initrd */
 	if (lpae && unitrd_fixup) {
+		int nodeoffset;
 		int err;
-		u32 *prop1, *prop2;
+		u64 *prop1, *prop2;
 		u64 initrd_start, initrd_end;
 
 		nodeoffset = fdt_path_offset(blob, "/chosen");
 		if (nodeoffset >= 0) {
-			prop1 = (u32 *)fdt_getprop(blob, nodeoffset,
+			prop1 = (u64 *)fdt_getprop(blob, nodeoffset,
 					    "linux,initrd-start", NULL);
-			prop2 = (u32 *)fdt_getprop(blob, nodeoffset,
+			prop2 = (u64 *)fdt_getprop(blob, nodeoffset,
 					    "linux,initrd-end", NULL);
 			if (prop1 && prop2) {
-				initrd_start = __be32_to_cpu(*prop1);
+				initrd_start = __be64_to_cpu(*prop1);
 				initrd_start -= CONFIG_SYS_SDRAM_BASE;
 				initrd_start += CONFIG_SYS_LPAE_SDRAM_BASE;
 				initrd_start = __cpu_to_be64(initrd_start);
-				initrd_end = __be32_to_cpu(*prop2);
+				initrd_end = __be64_to_cpu(*prop2);
 				initrd_end -= CONFIG_SYS_SDRAM_BASE;
 				initrd_end += CONFIG_SYS_LPAE_SDRAM_BASE;
 				initrd_end = __cpu_to_be64(initrd_end);
@@ -240,19 +253,6 @@ int ft_board_setup(void *blob, bd_t *bd)
 		}
 	}
 
-	return 0;
-}
-
-void ft_board_setup_ex(void *blob, bd_t *bd)
-{
-	int lpae;
-	u64 size;
-	char *env;
-	u64 *reserve_start;
-
-	env = env_get("mem_lpae");
-	lpae = env && simple_strtol(env, NULL, 0);
-
 	if (lpae) {
 		/*
 		 * the initrd and other reserved memory areas are
-- 
2.17.1


-- 
Disclaimer: This email and any files transmitted along with it may contain 
Azcom confidential and proprietary information. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action based on the contents of the information contained herein 
is strictly prohibited.
If you are not an intended recipient of this 
transmission and you received it in error, please inform the sender by 
reply e-mail and destroy this and all other copies of this transmission to 
which you have access.
The sender of this email or Azcom does not accept 
liability for any errors or omissions in the contents of this message that 
may occur as a result.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-11  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  7:36 [U-Boot] [RFC PATCH v1 0/2] Fix to keystone2 uinitrd fixup logic Nicholas Faustini
2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 1/2] fdt: add call to ft_board_setup_ex() for ks2 boards Nicholas Faustini
2018-09-11  7:36 ` [U-Boot] [RFC PATCH v1 2/2] board: ks2: move uinitrd fixup logic inside ft_board_setup_ex Nicholas Faustini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.