public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 3/3] arm, am335x: siemens boards add FIT support
Date: Tue, 18 Nov 2014 11:51:06 +0100	[thread overview]
Message-ID: <1416307867-32182-4-git-send-email-hs@denx.de> (raw)
In-Reply-To: <1416307867-32182-1-git-send-email-hs@denx.de>

add FIT support and set "boardid" from factoryset records
"DEV/id" and "COMP/ver". "boardid" is used for selecting
which fit configuration gets booted on the board.

Signed-off-by: Heiko Schocher <hs@denx.de>
---

 board/siemens/common/board.c      |  9 ---------
 board/siemens/common/factoryset.c | 18 ++++++++----------
 board/siemens/common/factoryset.h |  1 +
 board/siemens/draco/board.c       |  9 +++++++++
 board/siemens/pxm2/board.c        | 34 ++++++++++++++++++++++++++++++++++
 board/siemens/rut/board.c         | 23 +++++++++++++++++++++++
 include/configs/pxm2.h            |  4 ++++
 include/configs/rut.h             |  4 ++++
 8 files changed, 83 insertions(+), 19 deletions(-)

diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c
index 2782bcc..cc0ac6b 100644
--- a/board/siemens/common/board.c
+++ b/board/siemens/common/board.c
@@ -96,15 +96,6 @@ const struct dpll_params *get_dpll_ddr_params(void)
 	return &dpll_ddr;
 }
 
-#ifdef CONFIG_BOARD_LATE_INIT
-int board_late_init(void)
-{
-	omap_nand_switch_ecc(1, 8);
-
-	return 0;
-}
-#endif
-
 #ifndef CONFIG_SPL_BUILD
 #if defined(BOARD_DFU_BUTTON_GPIO)
 /*
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index be0091d..7baac3d 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -220,15 +220,6 @@ int factoryset_read_eeprom(int i2c_addr)
 	printf("DFU USB: VID = 0x%4x, PID = 0x%4x\n", factory_dat.usb_vendor_id,
 	       factory_dat.usb_product_id);
 #endif
-	if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
-					(uchar *)"id", buf,
-					MAX_STRING_LENGTH)) {
-		if (strncmp((const char *)buf, "PXM50", 5) == 0)
-			factory_dat.pxm50 = 1;
-		else
-			factory_dat.pxm50 = 0;
-	}
-	debug("PXM50: %d\n", factory_dat.pxm50);
 #if defined(CONFIG_VIDEO)
 	if (0 <= get_factory_record_val(cp, size, (uchar *)"DISP1",
 					(uchar *)"name", factory_dat.disp_name,
@@ -248,7 +239,14 @@ int factoryset_read_eeprom(int i2c_addr)
 							    NULL, 16);
 		debug("version number: %d\n", factory_dat.version);
 	}
-
+	/* Get ASN from factory set if available */
+	if (0 <= get_factory_record_val(cp, size, (uchar *)"DEV",
+					(uchar *)"id", factory_dat.asn,
+					MAX_STRING_LENGTH)) {
+		debug("factoryset asn: %s\n", factory_dat.asn);
+	} else {
+		factory_dat.asn[0] = 0;
+	}
 	/* Get COMP/ver from factory set if available */
 	if (0 <= get_factory_record_val(cp, size, (uchar *)"COMP",
 					(uchar *)"ver",
diff --git a/board/siemens/common/factoryset.h b/board/siemens/common/factoryset.h
index 7667b96..3f23d5e 100644
--- a/board/siemens/common/factoryset.h
+++ b/board/siemens/common/factoryset.h
@@ -20,6 +20,7 @@ struct factorysetcontainer {
 #endif
 	unsigned char serial[MAX_STRING_LENGTH];
 	int version;
+	uchar asn[MAX_STRING_LENGTH];
 	uchar comp_version[MAX_STRING_LENGTH];
 };
 
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index 9be2e34..ede73ba 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -280,4 +280,13 @@ U_BOOT_CMD(
 #endif /* #if defined(CONFIG_DRIVER_TI_CPSW) */
 #endif /* #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) */
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	omap_nand_switch_ecc(1, 8);
+
+	return 0;
+}
+#endif
+
 #include "../common/board.c"
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 559af0e..264ba02 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -428,4 +428,38 @@ static int board_video_init(void)
 	return 0;
 }
 #endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	int ret;
+
+	omap_nand_switch_ecc(1, 8);
+
+#ifdef CONFIG_FACTORYSET
+	if (factory_dat.asn[0] != 0) {
+		char tmp[2 * MAX_STRING_LENGTH + 2];
+
+		if (strncmp((const char *)factory_dat.asn, "PXM50", 5) == 0)
+			factory_dat.pxm50 = 1;
+		else
+			factory_dat.pxm50 = 0;
+		sprintf(tmp, "%s_%s", factory_dat.asn,
+			factory_dat.comp_version);
+		ret = setenv("boardid", tmp);
+		if (ret)
+			printf("error setting board id\n");
+	} else {
+		factory_dat.pxm50 = 1;
+		ret = setenv("boardid", "PXM50_1.0");
+		if (ret)
+			printf("error setting board id\n");
+	}
+	debug("PXM50: %d\n", factory_dat.pxm50);
+#endif
+
+	return 0;
+}
+#endif
+
 #include "../common/board.c"
diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c
index 1752df2..fb840f7 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -467,4 +467,27 @@ static int board_video_init(void)
 	return 0;
 }
 #endif /* ifdef CONFIG_VIDEO */
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	int ret;
+	char tmp[2 * MAX_STRING_LENGTH + 2];
+
+	omap_nand_switch_ecc(1, 8);
+
+	if (factory_dat.asn[0] != 0)
+		sprintf(tmp, "%s_%s", factory_dat.asn,
+			factory_dat.comp_version);
+	else
+		sprintf(tmp, "QMX7.E38_4.0");
+
+	ret = setenv("boardid", tmp);
+	if (ret)
+		printf("error setting board id\n");
+
+	return 0;
+}
+#endif
+
 #include "../common/board.c"
diff --git a/include/configs/pxm2.h b/include/configs/pxm2.h
index d75d562..946b2c8 100644
--- a/include/configs/pxm2.h
+++ b/include/configs/pxm2.h
@@ -150,4 +150,8 @@
 #define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_FIT
+#endif
+
 #endif	/* ! __CONFIG_PXM2_H */
diff --git a/include/configs/rut.h b/include/configs/rut.h
index 6bddede..0067ea4 100644
--- a/include/configs/rut.h
+++ b/include/configs/rut.h
@@ -154,4 +154,8 @@
 #define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_FIT
+#endif
+
 #endif	/* ! __CONFIG_RUT_H */
-- 
1.8.3.1

  parent reply	other threads:[~2014-11-18 10:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 10:51 [U-Boot] [PATCH v1 0/3] arm, am335x: siemens board updates Heiko Schocher
2014-11-18 10:51 ` [U-Boot] [PATCH v1 1/3] arm, am335x, siemens: fix factoryset interpretation Heiko Schocher
2014-12-05 14:53   ` [U-Boot] [U-Boot, v1, " Tom Rini
2014-11-18 10:51 ` [U-Boot] [PATCH v1 2/3] arm, am335x, siemens: read COMP/ver from factoryset Heiko Schocher
2014-12-05 14:53   ` [U-Boot] [U-Boot, v1, " Tom Rini
2014-11-18 10:51 ` Heiko Schocher [this message]
2014-12-05 14:53   ` [U-Boot] [U-Boot, v1, 3/3] arm, am335x: siemens boards add FIT support 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=1416307867-32182-4-git-send-email-hs@denx.de \
    --to=hs@denx.de \
    --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