Skip to contentSkip to conversation

arm, am335x: siemens board updates

PATCH New Heiko Schocher 2 participants 7 messages Nov 18, 2014 – Dec 5, 2014

lore
Share & tools
lore
#0 lore raw

cover arm, am335x: siemens board updates

This series contains some updates for the am335x based boards from siemens.
- Patch: arm, am335x, siemens: fix factoryset interpretation fixes an error in the siemens factoryset implementation
- Patch: arm, am335x, siemens: read COMP/ver from factoryset reads also the "COMP/ver" value from the siemens factoryset
- Patch: arm, am335x: siemens boards add FIT support
- adds FIT support as we now boot kernels with DT
- create a u-boot envvariable "boardid" which is used for selecting the DT from the FIT image.

Heiko Schocher (3):
arm, am335x, siemens: fix factoryset interpretation arm, am335x, siemens: read COMP/ver from factoryset arm, am335x: siemens boards add FIT support

 board/siemens/common/board.c      |  9 -------
 board/siemens/common/factoryset.c | 52 ++++++++++++++++++++++++++-------------
 board/siemens/common/factoryset.h |  2 ++
 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, 111 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 arm, am335x, siemens: fix factoryset interpretation

a record could contain other records, so after an ">" (begin mark) there not always come an end mark "<", instead a ">" is possible. Take care of this.

---

 board/siemens/common/factoryset.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
board/siemens/common/factoryset.c +18 -8
index 266dbbb..d98e59d 100644
@@ -86,6 +86,7 @@ int get_factory_record_val(unsigned char *eeprom_buf, int size,	uchar *record,
 	int i, nxt = 0;
 	int c;
 	unsigned char end = 0xff;
+	unsigned char tmp;
 
 	for (i = 0; fact_get_char(i) != end; i = nxt) {
 		nxt = i + 1;
@@ -93,6 +94,7 @@ int get_factory_record_val(unsigned char *eeprom_buf, int size,	uchar *record,
 			int pos;
 			int endpos;
 			int z;
+			int level = 0;
 
 			c = strncmp((char *)&eeprom_buf[i + 1], (char *)record,
 				    strlen((char *)record));
@@ -103,22 +105,30 @@ int get_factory_record_val(unsigned char *eeprom_buf, int size,	uchar *record,
 				/* search for "<" */
 				c = -1;
 				for (z = pos; fact_get_char(z) != end; z++) {
-					if ((fact_get_char(z) == '<')  ||
-					    (fact_get_char(z) == '>')) {
-						endpos = z;
-						nxt = endpos;
-						c = 0;
-						break;
+					if (fact_get_char(z) == '<') {
+						if (level == 0) {
+							endpos = z;
+							nxt = endpos;
+							c = 0;
+							break;
+						} else {
+							level--;
+						}
 					}
+					if (fact_get_char(z) == '>')
+						level++;
 				}
+			} else {
+				continue;
 			}
 			if (c == 0) {
 				/* end found -> call get_factory_val */
+				tmp = eeprom_buf[endpos];
 				eeprom_buf[endpos] = end;
 				ret = get_factory_val(&eeprom_buf[pos],
-					size - pos, name, buf, len);
+					endpos - pos, name, buf, len);
 				/* fix buffer */
-				eeprom_buf[endpos] = '<';
+				eeprom_buf[endpos] = tmp;
 				debug("%s: %s.%s = %s\n",
 				      __func__, record, name, buf);
 				return ret;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/3 arm, am335x, siemens: fix factoryset interpretation

Quoted 5 lines · Heiko Schocher

a record could contain other records, so after an ">" (begin mark) there not always come an end mark "<", instead a ">" is possible. Take care of this.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141205/6e8a7f37/attachment.pgp>
#3 lore raw

PATCH 2/3 arm, am335x, siemens: read COMP/ver from factoryset

In reply to Heiko Schocher

---

 board/siemens/common/factoryset.c | 10 ++++++++++
 board/siemens/common/factoryset.h |  1 +
 2 files changed, 11 insertions(+)
board/siemens/common/factoryset.c +10 -0
index d98e59d..be0091d 100644
@@ -249,6 +249,16 @@ int factoryset_read_eeprom(int i2c_addr)
 		debug("version number: %d\n", factory_dat.version);
 	}
 
+	/* Get COMP/ver from factory set if available */
+	if (0 <= get_factory_record_val(cp, size, (uchar *)"COMP",
+					(uchar *)"ver",
+					factory_dat.comp_version,
+					MAX_STRING_LENGTH)) {
+		debug("factoryset COMP/ver: %s\n", factory_dat.comp_version);
+	} else {
+		strcpy((char *)factory_dat.comp_version, "1.0");
+	}
+
 	return 0;
 
 err:
board/siemens/common/factoryset.h +1 -0
index 4d6de10..7667b96 100644
@@ -20,6 +20,7 @@ struct factorysetcontainer {
 #endif
 	unsigned char serial[MAX_STRING_LENGTH];
 	int version;
+	uchar comp_version[MAX_STRING_LENGTH];
 };
 
 int factoryset_read_eeprom(int i2c_addr);
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 2/3 arm, am335x, siemens: read COMP/ver from factoryset

Quoted 1 line · Heiko Schocher

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141205/1153b94c/attachment.pgp>
#5 lore raw

PATCH 3/3 arm, am335x: siemens boards add FIT support

In reply to Heiko Schocher

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.

---

 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(-)
board/siemens/common/board.c +0 -9
index 2782bcc..cc0ac6b 100644
@@ -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)
 /*
board/siemens/common/factoryset.c +8 -10
index be0091d..7baac3d 100644
@@ -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",
board/siemens/common/factoryset.h +1 -0
index 7667b96..3f23d5e 100644
@@ -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];
 };
 
board/siemens/draco/board.c +9 -0
index 9be2e34..ede73ba 100644
@@ -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"
board/siemens/pxm2/board.c +34 -0
index 559af0e..264ba02 100644
@@ -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"
board/siemens/rut/board.c +23 -0
index 1752df2..fb840f7 100644
@@ -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"
include/configs/pxm2.h +4 -0
index d75d562..946b2c8 100644
@@ -150,4 +150,8 @@
 #define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_FIT
+#endif
+
 #endif	/* ! __CONFIG_PXM2_H */
include/configs/rut.h +4 -0
index 6bddede..0067ea4 100644
@@ -154,4 +154,8 @@
 #define CONFIG_SYS_CONSOLE_FG_COL	0x00
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_FIT
+#endif
+
 #endif	/* ! __CONFIG_RUT_H */
Signature · 1 line
1.8.3.1
#6 lore raw

PATCH 3/3 arm, am335x: siemens boards add FIT support

Quoted 5 lines · Heiko Schocher

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.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141205/eaf05516/attachment.pgp>