public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board
@ 2012-11-23 15:19 Stefano Babic
  2012-11-23 15:19 ` [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom Stefano Babic
  2012-12-10 20:18 ` [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Stefano Babic @ 2012-11-23 15:19 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 board/teejet/mt_ventoux/mt_ventoux.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
index 9622a81..98b92f3 100644
--- a/board/teejet/mt_ventoux/mt_ventoux.c
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -73,10 +73,10 @@ static struct {
 
 static struct panel_config lcd_cfg[] = {
 	{
-	.timing_h       = PANEL_TIMING_H(4, 8, 41),
-	.timing_v       = PANEL_TIMING_V(2, 4, 10),
-	.pol_freq       = 0x00000000, /* Pol Freq */
-	.divisor        = 0x0001000d, /* 33Mhz Pixel Clock */
+	.timing_h       = PANEL_TIMING_H(40, 5, 2),
+	.timing_v       = PANEL_TIMING_V(8, 8, 2),
+	.pol_freq       = 0x00003000, /* Pol Freq */
+	.divisor        = 0x00010033, /* 9 Mhz Pixel Clock */
 	.panel_type     = 0x01, /* TFT */
 	.data_lines     = 0x03, /* 24 Bit RGB */
 	.load_mode      = 0x02, /* Frame Mode */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom
  2012-11-23 15:19 [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Stefano Babic
@ 2012-11-23 15:19 ` Stefano Babic
  2012-12-10 20:18   ` Tom Rini
  2012-12-10 20:18 ` [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Stefano Babic @ 2012-11-23 15:19 UTC (permalink / raw)
  To: u-boot

Added macros to read SOM information from the I2C
EEPROM.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 board/technexion/twister/twister.c   |   10 ++++--
 board/teejet/mt_ventoux/mt_ventoux.c |   15 ++++++---
 include/configs/tam3517-common.h     |   58 +++++++++++++++++++++++++---------
 3 files changed, 60 insertions(+), 23 deletions(-)

diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c
index 1471559..c9eea9b 100644
--- a/board/technexion/twister/twister.c
+++ b/board/technexion/twister/twister.c
@@ -98,9 +98,12 @@ int board_init(void)
 	return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
 int misc_init_r(void)
 {
 	char *eth_addr;
+	struct tam3517_module_info info;
+	int ret;
 
 	dieid_num_r();
 
@@ -108,12 +111,13 @@ int misc_init_r(void)
 	if (eth_addr)
 		return 0;
 
-#ifndef CONFIG_SPL_BUILD
-	TAM3517_READ_MAC_FROM_EEPROM;
-#endif
+	TAM3517_READ_EEPROM(&info, ret);
+	if (!ret)
+		TAM3517_READ_MAC_FROM_EEPROM(&info);
 
 	return 0;
 }
+#endif
 
 /*
  * Routine: set_muxconf_regs
diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
index 98b92f3..c516c75 100644
--- a/board/teejet/mt_ventoux/mt_ventoux.c
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -258,21 +258,26 @@ int board_init(void)
 	return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
 int misc_init_r(void)
 {
 	char *eth_addr;
+	struct tam3517_module_info info;
+	int ret;
 
+	TAM3517_READ_EEPROM(&info, ret);
 	dieid_num_r();
 
-	eth_addr = getenv("ethaddr");
-	if (eth_addr)
+	if (ret)
 		return 0;
+	eth_addr = getenv("ethaddr");
+	if (!eth_addr)
+		TAM3517_READ_MAC_FROM_EEPROM(&info);
 
-#ifndef CONFIG_SPL_BUILD
-	TAM3517_READ_MAC_FROM_EEPROM;
-#endif
+	TAM3517_PRINT_SOM_INFO(&info);
 	return 0;
 }
+#endif
 
 /*
  * Routine: set_muxconf_regs
diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h
index dd7757c..a3e84a3 100644
--- a/include/configs/tam3517-common.h
+++ b/include/configs/tam3517-common.h
@@ -357,7 +357,6 @@
  * I2C EEPROM
  */
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
-
 /*
  * The I2C EEPROM on the TAM3517 contains
  * mac address and production data
@@ -383,24 +382,29 @@ struct tam3517_module_info {
 	unsigned char _rev[100];
 };
 
-#define TAM3517_READ_MAC_FROM_EEPROM	\
-do {					\
-	struct tam3517_module_info info;\
-	char buf[80], ethname[20];	\
-	int i;				\
+#define TAM3517_READ_EEPROM(info, ret) \
+do {								\
 	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);	\
 	if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,		\
-			(void *)&info, sizeof(info)))		\
-		break;						\
+		(void *)info, sizeof(*info)))			\
+		ret = 1;					\
+	else							\
+		ret = 0;					\
+} while (0)
+
+#define TAM3517_READ_MAC_FROM_EEPROM(info)			\
+do {								\
+	char buf[80], ethname[20];				\
+	int i;							\
 	memset(buf, 0, sizeof(buf));				\
-	for (i = 0 ; i < ARRAY_SIZE(info.eth_addr); i++) {	\
+	for (i = 0 ; i < ARRAY_SIZE((info)->eth_addr); i++) {	\
 		sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",	\
-			info.eth_addr[i][5],			\
-			info.eth_addr[i][4],			\
-			info.eth_addr[i][3],			\
-			info.eth_addr[i][2],			\
-			info.eth_addr[i][1],			\
-			info.eth_addr[i][0]);			\
+			(info)->eth_addr[i][5],			\
+			(info)->eth_addr[i][4],			\
+			(info)->eth_addr[i][3],			\
+			(info)->eth_addr[i][2],			\
+			(info)->eth_addr[i][1],			\
+			(info)->eth_addr[i][0]);			\
 								\
 		if (i)						\
 			sprintf(ethname, "eth%daddr", i);	\
@@ -410,6 +414,30 @@ do {					\
 		setenv(ethname, buf);				\
 	}							\
 } while (0)
+
+/* The following macros are taken from Technexion's documentation */
+#define TAM3517_sequence_number(info) \
+	((info)->sequence_number % 0x1000000000000LL)
+#define TAM3517_week_of_year(info) (((info)->sequence_number >> 48) % 0x100)
+#define TAM3517_year(info) ((info)->sequence_number >> 56)
+#define TAM3517_revision_fixed(info) ((info)->revision % 0x100)
+#define TAM3517_revision_major(info) (((info)->revision >> 8) % 0x100)
+#define TAM3517_revision_tn(info) ((info)->revision >> 16)
+
+#define TAM3517_PRINT_SOM_INFO(info)				\
+do {								\
+	printf("Vendor:%s\n", (info)->customer);		\
+	printf("SOM:   %s\n", (info)->product);			\
+	printf("SeqNr: %02llu%02llu%012llu\n",			\
+		TAM3517_year(info),				\
+		TAM3517_week_of_year(info),			\
+		TAM3517_sequence_number(info));			\
+	printf("Rev:   TN%u %u.%u\n",				\
+		TAM3517_revision_tn(info),			\
+		TAM3517_revision_major(info),			\
+		TAM3517_revision_fixed(info));			\
+} while (0)
+
 #endif
 
 #endif /* __TAM3517_H */
-- 
1.7.9.5

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

* [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board
  2012-11-23 15:19 [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Stefano Babic
  2012-11-23 15:19 ` [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom Stefano Babic
@ 2012-12-10 20:18 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2012-12-10 20:18 UTC (permalink / raw)
  To: u-boot

On Fri, Nov 23, 2012 at 04:19:24PM +0100, Stefano Babic wrote:

> Signed-off-by: Stefano Babic <sbabic@denx.de>

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

-- 
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/20121210/0c6500db/attachment.pgp>

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

* [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom
  2012-11-23 15:19 ` [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom Stefano Babic
@ 2012-12-10 20:18   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2012-12-10 20:18 UTC (permalink / raw)
  To: u-boot

On Fri, Nov 23, 2012 at 04:19:25PM +0100, Stefano Babic wrote:

> Added macros to read SOM information from the I2C
> EEPROM.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>

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

-- 
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/20121210/7179e33a/attachment.pgp>

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

end of thread, other threads:[~2012-12-10 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-23 15:19 [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Stefano Babic
2012-11-23 15:19 ` [U-Boot] [PATCH 2/2] OMAP3: TAM3517: add macros for reading eeprom Stefano Babic
2012-12-10 20:18   ` Tom Rini
2012-12-10 20:18 ` [U-Boot] [PATCH 1/2] OMAP3: fix panel timing on the mt_ventoux board Tom Rini

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