public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] imx-common: cpu: add fdt_file environment variable
@ 2014-03-29 22:34 Troy Kisky
  2014-03-29 23:04 ` Otavio Salvador
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Troy Kisky @ 2014-03-29 22:34 UTC (permalink / raw)
  To: u-boot

This removes one block in the move toward 1 u-boot
for both a mx6q (quad) and mx6dl (duallite) processor.

Now fdt_file hardcoded value can be removed.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
 arch/arm/imx-common/cpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/lib/board.c      |  7 +++++++
 2 files changed, 51 insertions(+)

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index a77c4de..5d48011 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -180,3 +180,47 @@ void arch_preboot_os(void)
 	ipuv3_fb_shutdown();
 }
 #endif
+
+const char *get_dtb_prefix(u32 imxtype)
+{
+	switch (imxtype) {
+	case MXC_CPU_MX6Q:
+	case MXC_CPU_MX6D:
+		return "imx6q";		/* Quad/Dual-core version of the mx6 */
+	case MXC_CPU_MX6DL:
+	case MXC_CPU_MX6SOLO:
+		return "imx6dl";	/* Dual Lite/Solo version of the mx6 */
+	case MXC_CPU_MX6SL:
+		return "imx6sl";	/* Solo-Lite version of the mx6 */
+	case MXC_CPU_MX51:
+		return "imx51";
+	case MXC_CPU_MX53:
+		return "imx53";
+	}
+	return "??";
+}
+
+int cpu_late_init(void)
+{
+	char buf[128];
+	const char *board;
+	u32 imxtype = (get_cpu_rev() >> 12) & 0xff;
+
+	if (getenv("fdt_file"))
+		return 0;
+	board = getenv("board");
+	if (!board) {
+		board = CONFIG_SYS_BOARD;
+		if ((board[0] == 'm') && (board[1] == 'x')) {
+			if (board[2] == '6') {
+				board += 3;
+			} else if (board[2] == '5') {
+				if ((board[3] == '1') || (board[3] == '3'))
+					board += 4;
+			}
+		}
+	}
+	sprintf(buf, "%s-%s.dtb", get_dtb_prefix(imxtype), board);
+	setenv("fdt_file", buf);
+	return 0;
+}
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index e9a7708..61cee98 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -496,6 +496,11 @@ static void display_fdt_model(const void *blob)
 }
 #endif
 
+int __weak cpu_late_init(void)
+{
+	return 0;
+}
+
 /************************************************************************
  *
  * This is the next part if the initialization sequence: we are now
@@ -649,6 +654,8 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	board_late_init();
 #endif
 
+	cpu_late_init();
+
 #ifdef CONFIG_BITBANGMII
 	bb_miiphy_init();
 #endif
-- 
1.8.1.2

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

end of thread, other threads:[~2014-04-01  7:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29 22:34 [U-Boot] [PATCH 1/1] imx-common: cpu: add fdt_file environment variable Troy Kisky
2014-03-29 23:04 ` Otavio Salvador
2014-03-30 14:52   ` Marek Vasut
2014-03-31 18:30     ` Troy Kisky
2014-03-29 23:11 ` Eric Nelson
2014-03-31 18:36   ` Troy Kisky
2014-03-31 19:22     ` Marek Vasut
2014-03-31 19:38       ` Otavio Salvador
2014-03-31 19:47         ` Marek Vasut
2014-03-31 21:09           ` Troy Kisky
2014-04-01  7:45             ` Marek Vasut
2014-03-30 16:30 ` Stefano Babic
2014-03-31 18:29   ` Troy Kisky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox