Skip to contentSkip to conversation

cm-t35 updates and non-critical fixes

PATCH New Igor Grinberg 2 participants 8 messages May 24, 2012 – May 25, 2012

lore
Share & tools
lore
#0 lore raw

cover cm-t35 updates and non-critical fixes

This patch set fixes various board revsion related issues, adds the PCB revision information printing and reduces the environment size.

Igor Grinberg (1):
cm-t35: reduce the environment size

Nikita Kiryanov (3):
cm-t35: fix incorrect BOARD_REV_SIZE value
cm-t35: fix legacy board revision representation
cm-t35: print PCB revision information

 board/cm_t35/cm_t35.c    |   22 ++++++++++++++++++++++
 board/cm_t35/eeprom.c    |   26 ++++++++++++++++----------
 board/cm_t35/eeprom.h    |    5 +++++
 include/configs/cm_t35.h |    3 +--
 4 files changed, 44 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/4 cm-t35: reduce the environment size

Reduce the environment size (128KB => 16KB) to improve the environment operations time (e.g. reading, ecc calculation).
Also, remove the unused CONFIG_SYS_ENV_SECT_SIZE.

---
 include/configs/cm_t35.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
include/configs/cm_t35.h +1 -2
index cac7bd1..7f13e79 100644
@@ -77,7 +77,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_ENV_SIZE		(128 << 10)	/* 128 KiB */
+#define CONFIG_ENV_SIZE		(16 << 10)	/* 16 KiB */
 					/* Sector */
 #define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + (128 << 10))
 
@@ -325,7 +325,6 @@
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
 #define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
 
-#define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
 #define CONFIG_ENV_OFFSET		SMNAND_ENV_OFFSET
 #define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
 
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 2/4 cm-t35: fix incorrect BOARD_REV_SIZE value

In reply to Igor Grinberg

From: Nikita Kiryanov <[email protected]>

Non-legacy layouts have an extended revision field, but only the first 2 bytes are the PCB revision.

---
 board/cm_t35/eeprom.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
board/cm_t35/eeprom.c +3 -7
index dfa171d..6053811 100644
@@ -27,8 +27,7 @@
 #define BOARD_SERIAL_OFFSET_LEGACY	8
 #define BOARD_REV_OFFSET		0
 #define BOARD_REV_OFFSET_LEGACY		6
-#define BOARD_REV_SIZE			4
-#define BOARD_REV_SIZE_LEGACY		2
+#define BOARD_REV_SIZE			2
 #define MAC_ADDR_OFFSET			4
 #define MAC_ADDR_OFFSET_LEGACY		0
 
@@ -107,17 +106,14 @@ u32 get_board_rev(void)
 {
 	u32 rev = 0;
 	uint offset = BOARD_REV_OFFSET_LEGACY;
-	int len = BOARD_REV_SIZE_LEGACY;
 
 	if (eeprom_setup_layout())
 		return 0;
 
-	if (eeprom_layout != LAYOUT_LEGACY) {
+	if (eeprom_layout != LAYOUT_LEGACY)
 		offset = BOARD_REV_OFFSET;
-		len = BOARD_REV_SIZE;
-	}
 
-	if (cm_t3x_eeprom_read(offset, (uchar *)&rev, len))
+	if (cm_t3x_eeprom_read(offset, (uchar *)&rev, BOARD_REV_SIZE))
 		return 0;
 
 	return rev;
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 3/4 cm-t35: fix legacy board revision representation

In reply to Igor Grinberg

From: Nikita Kiryanov <[email protected]>

Legacy eeprom layout represents the revision number syntactically (i.e. revision 1.00 is written as 0x100). This is inconsistent with the representation in newer layouts, where it is defined semantically (i.e. 0x64).

This patch fixes the issue by replacing the syntactic representation with the semantic one.

---
 board/cm_t35/eeprom.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
board/cm_t35/eeprom.c +10 -0
index 6053811..4986b23 100644
@@ -105,6 +105,7 @@ int cm_t3x_eeprom_read_mac_addr(uchar *buf)
 u32 get_board_rev(void)
 {
 	u32 rev = 0;
+	char str[5]; /* Legacy representation can contain at most 4 digits */
 	uint offset = BOARD_REV_OFFSET_LEGACY;
 
 	if (eeprom_setup_layout())
@@ -116,5 +117,14 @@ u32 get_board_rev(void)
 	if (cm_t3x_eeprom_read(offset, (uchar *)&rev, BOARD_REV_SIZE))
 		return 0;
 
+	/*
+	 * Convert legacy syntactic representation to semantic
+	 * representation. i.e. for rev 1.00: 0x100 --> 0x64
+	 */
+	if (eeprom_layout == LAYOUT_LEGACY) {
+		sprintf(str, "%x", rev);
+		rev = simple_strtoul(str, NULL, 10);
+	}
+
 	return rev;
 };
Signature · 1 line
1.7.3.4
#4 lore raw

PATCH 4/4 cm-t35: print PCB revision information

In reply to Igor Grinberg

From: Nikita Kiryanov <[email protected]>

Buffer the PCB revision to avoid multiple eeprom accesses for the same data and print it as a part of board information.

---
 board/cm_t35/cm_t35.c |   22 ++++++++++++++++++++++
 board/cm_t35/eeprom.c |    6 +++---
 board/cm_t35/eeprom.h |    5 +++++
 3 files changed, 30 insertions(+), 3 deletions(-)
board/cm_t35/cm_t35.c +22 -0
index d5bc581..60e0b06 100644
@@ -101,12 +101,34 @@ int board_init(void)
 	return 0;
 }
 
+static u32 cm_t3x_rev;
+
+/*
+ * Routine: get_board_rev
+ * Description: read system revision
+ */
+u32 get_board_rev(void)
+{
+	if (!cm_t3x_rev)
+		cm_t3x_rev = cm_t3x_eeprom_get_board_rev();
+
+	return cm_t3x_rev;
+};
+
 /*
  * Routine: misc_init_r
  * Description: display die ID
  */
 int misc_init_r(void)
 {
+	u32 board_rev = get_board_rev();
+	u32 rev_major = board_rev / 100;
+	u32 rev_minor = board_rev - (rev_major * 100);
+
+	if ((rev_minor / 10) * 10 == rev_minor)
+		rev_minor = rev_minor / 10;
+
+	printf("PCB:   %u.%u\n", rev_major, rev_minor);
 	dieid_num_r();
 
 	return 0;
board/cm_t35/eeprom.c +3 -3
index 4986b23..b0af103 100644
@@ -99,10 +99,10 @@ int cm_t3x_eeprom_read_mac_addr(uchar *buf)
 }
 
 /*
- * Routine: get_board_rev
- * Description: read system revision
+ * Routine: cm_t3x_eeprom_get_board_rev
+ * Description: read system revision from eeprom
  */
-u32 get_board_rev(void)
+u32 cm_t3x_eeprom_get_board_rev(void)
 {
 	u32 rev = 0;
 	char str[5]; /* Legacy representation can contain at most 4 digits */
board/cm_t35/eeprom.h +5 -0
index ec772c6..38824d1 100644
@@ -23,11 +23,16 @@
 
 #ifdef CONFIG_DRIVER_OMAP34XX_I2C
 int cm_t3x_eeprom_read_mac_addr(uchar *buf);
+u32 cm_t3x_eeprom_get_board_rev(void);
 #else
 static inline int cm_t3x_eeprom_read_mac_addr(uchar *buf)
 {
 	return 1;
 }
+static inline u32 cm_t3x_eeprom_get_board_rev(void)
+{
+	return 0;
+}
 #endif
 
 #endif
Signature · 1 line
1.7.3.4
#5 lore raw

PATCH 4/4 cm-t35: print PCB revision information

Quoted 7 lines · Igor Grinberg

From: Nikita Kiryanov <[email protected]>

Buffer the PCB revision to avoid multiple eeprom accesses for the same data and print it as a part of board information.

Note that this doesn't apply directly to mainline as cm_t35 had been switched to the weak dieid-printing only misc_init_r. I've done the trivial fixup to make this work again and will signed-off-by in my pull request.

Signature · 1 line
Tom
#6 lore raw

PATCH 4/4 cm-t35: print PCB revision information

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 7 lines · Igor Grinberg

From: Nikita Kiryanov <[email protected]>

Buffer the PCB revision to avoid multiple eeprom accesses for the same data and print it as a part of board information.

Note that this doesn't apply directly to mainline as cm_t35 had been switched to the weak dieid-printing only misc_init_r.

Yeah, I forgot about that patch... sorry...

Quoted 3 lines

I've done the
trivial fixup to make this work again and will signed-off-by in my pull request.

Thanks a lot!

Signature · 2 lines
Regards,
Igor.
#7 lore raw

cover cm-t35 updates and non-critical fixes

In reply to Igor Grinberg
Quoted 12 lines · Igor Grinberg

This patch set fixes various board revsion related issues, adds the PCB revision information printing and reduces the environment size.

Igor Grinberg (1):
cm-t35: reduce the environment size

Nikita Kiryanov (3):
cm-t35: fix incorrect BOARD_REV_SIZE value
cm-t35: fix legacy board revision representation
cm-t35: print PCB revision information

Quoted 5 lines
 board/cm_t35/cm_t35.c    |   22 ++++++++++++++++++++++
 board/cm_t35/eeprom.c    |   26 ++++++++++++++++----------
 board/cm_t35/eeprom.h    |    5 +++++
 include/configs/cm_t35.h |    3 +--
 4 files changed, 44 insertions(+), 12 deletions(-)

With the note I sent before about fixing up the last patch, applied to u-boot-ti/master, thanks.

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