public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] omap3_logic: Rework MACH_TYPE and fdtfile logic
Date: Tue, 10 Jan 2017 17:22:05 -0500	[thread overview]
Message-ID: <1484086928-2586-1-git-send-email-trini@konsulko.com> (raw)

The MACH_TYPE values for the omap37xx based platforms are no longer
officially valid, so we must not set and pass them.  In order to not
reference them but still be able to set the default fdtfile based on the
board detection logic we need to combine the two steps into one.

Cc: Adam Ford <aford173@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 board/logicpd/omap3som/omap3logic.c | 54 ++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 34 deletions(-)

diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index de6a06021c2c..21b3fdcf49cf 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -60,25 +60,28 @@ U_BOOT_DEVICE(omap3logic_uart) = {
 static struct board_id {
 	char *name;
 	int machine_id;
+	char *fdtfile;
 } boards[2][2] = {
 	{
 		{
 			.name		= "OMAP35xx SOM LV",
 			.machine_id	= MACH_TYPE_OMAP3530_LV_SOM,
+			.fdtfile	= "logicpd-som-lv-35xx-devkit.dtb",
 		},
 		{
 			.name		= "OMAP35xx Torpedo",
 			.machine_id	= MACH_TYPE_OMAP3_TORPEDO,
+			.fdtfile	= "logicpd-torpedo-35xx-devkit.dtb",
 		},
 	},
 	{
 		{
 			.name		= "DM37xx SOM LV",
-			.machine_id	= MACH_TYPE_DM3730_SOM_LV,
+			.fdtfile	= "logicpd-som-lv-37xx-devkit.dtb",
 		},
 		{
 			.name		= "DM37xx Torpedo",
-			.machine_id	= MACH_TYPE_DM3730_TORPEDO,
+			.fdtfile	= "logicpd-torpedo-37xx-devkit.dtb",
 		},
 	},
 };
@@ -165,14 +168,20 @@ int misc_init_r(void)
  */
 int board_init(void)
 {
-	struct board_id *board;
-	unsigned int val;
-
 	gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
 
 	/* boot param addr */
 	gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
 
+	return 0;
+}
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	struct board_id *board;
+	unsigned int val;
+
 	/*
 	 * To identify between a SOM LV and Torpedo module,
 	 * a pulldown resistor is on hsusb0_data5 for the SOM LV module.
@@ -207,39 +216,16 @@ int board_init(void)
 		printf("Board: %s\n", board->name);
 
 		/* Set the machine_id passed to Linux */
-		gd->bd->bi_arch_number = board->machine_id;
+		if (board->machine_id)
+			gd->bd->bi_arch_number = board->machine_id;
+
+		/* If the user has not set fdtimage, set the default */
+		if (!getenv("fdtimage"))
+			setenv("fdtimage", board->fdtfile);
 	}
 
 	/* restore hsusb0_data5 pin as hsusb0_data5 */
 	MUX_VAL(CP(HSUSB0_DATA5),	(IEN  | PTD | DIS | M0));
-
-	return 0;
-}
-
-#ifdef CONFIG_BOARD_LATE_INIT
-int board_late_init(void)
-{
-	/* If we do not have an fdtimage, let's autodetect it*/
-	if (getenv("fdtimage"))
-		return 0;
-
-	switch (gd->bd->bi_arch_number) {
-	case MACH_TYPE_DM3730_TORPEDO:
-		setenv("fdtimage", "logicpd-torpedo-37xx-devkit.dtb");
-		break;
-	case MACH_TYPE_DM3730_SOM_LV:
-		setenv("fdtimage", "logicpd-som-lv-37xx-devkit.dtb");
-		break;
-	case MACH_TYPE_OMAP3_TORPEDO:
-		setenv("fdtimage", "logicpd-torpedo-35xx-devkit.dtb");
-		break;
-	case MACH_TYPE_OMAP3530_LV_SOM:
-		setenv("fdtimage", "logicpd-som-lv-35xx-devkit.dtb");
-		break;
-	default:
-		/* unknown machine type */
-		break;
-	}
 	return 0;
 }
 #endif
-- 
1.9.1

             reply	other threads:[~2017-01-10 22:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 22:22 Tom Rini [this message]
2017-01-10 22:22 ` [U-Boot] [PATCH 2/4] omap3_igep00x0: Rework MACH_TYPE and status LED logic slightly Tom Rini
2017-01-11 14:59   ` Enric Balletbo Serra
2017-01-11 15:05     ` Tom Rini
2017-01-11 15:10       ` Enric Balletbo Serra
2017-01-14 20:57   ` [U-Boot] [U-Boot, " Tom Rini
2017-01-10 22:22 ` [U-Boot] [PATCH 3/4] arm: Remove unregister MACH_TYPE_xxx uses Tom Rini
2017-01-11  0:14   ` Stephen Warren
2017-01-11  1:22     ` Tom Rini
2017-01-14 20:57   ` [U-Boot] [U-Boot, " Tom Rini
2017-01-10 22:22 ` [U-Boot] [PATCH 4/4] arm: Re-sync asm/mach-types.h with Linux Kernel v4.9 Tom Rini
2017-01-11 14:30   ` Adam Ford
2017-01-14 20:57   ` [U-Boot] [U-Boot, " Tom Rini
2017-01-11 13:38 ` [U-Boot] [PATCH 1/4] omap3_logic: Rework MACH_TYPE and fdtfile logic Adam Ford
2017-01-14 20:57 ` [U-Boot] [U-Boot, " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484086928-2586-1-git-send-email-trini@konsulko.com \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox