All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730
@ 2012-01-02 14:01 Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file Igor Grinberg
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

This patch series some what clean up cm-t35 board files,
add separate EEPROM handling file,
fixes the incorrect board revision passed to Linux.

Nikita Kiryanov (6):
  cm-t35: cleanup the config file
  cm-t35: various cleanups
  cm-t35: add EEPROM module and pass Linux a serial number
  omap3: make get_board_rev() function weak
  cm-t35: pass correct revision information to Linux
  cm-t35: use the new EEPROM module to read the MAC address

 arch/arm/cpu/armv7/omap3/sys_info.c |    3 +-
 board/cm_t35/Makefile               |    4 +-
 board/cm_t35/cm_t35.c               |   16 ++---
 board/cm_t35/eeprom.c               |  125 +++++++++++++++++++++++++++++++++++
 board/cm_t35/eeprom.h               |   45 +++++++++++++
 include/configs/cm_t35.h            |   80 +++++++++++-----------
 6 files changed, 223 insertions(+), 50 deletions(-)
 create mode 100644 board/cm_t35/eeprom.c
 create mode 100644 board/cm_t35/eeprom.h

-- 
1.7.3.4

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

* [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-03  6:35   ` Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 2/6] cm-t35: various cleanups Igor Grinberg
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Remove values from boolean defines, fix indentation, etc..
No functional changes.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 include/configs/cm_t35.h |   78 +++++++++++++++++++++++-----------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 0385ee8..61226d5 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -1,6 +1,5 @@
 /*
- * (C) Copyright 2011
- * CompuLab, Ltd.
+ * (C) Copyright 2011 CompuLab, Ltd.
  * Mike Rapoport <mike@compulab.co.il>
  * Igor Grinberg <grinberg@compulab.co.il>
  *
@@ -36,9 +35,9 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP		1	/* in a TI OMAP core */
-#define CONFIG_OMAP34XX		1	/* which is a 34XX */
-#define CONFIG_CM_T3X		1	/* working with CM-T35 and CM-T3730 */
+#define CONFIG_OMAP	/* in a TI OMAP core */
+#define CONFIG_OMAP34XX	/* which is a 34XX */
+#define CONFIG_CM_T3X	/* working with CM-T35 and CM-T3730 */
 
 #define CONFIG_SYS_TEXT_BASE	0x80008000
 
@@ -50,8 +49,8 @@
 /*
  * Display CPU and Board information
  */
-#define CONFIG_DISPLAY_CPUINFO		1
-#define CONFIG_DISPLAY_BOARDINFO	1
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
 
 /* Clock Defines */
 #define V_OSCK			26000000	/* Clock output from T2 */
@@ -69,17 +68,17 @@
  */
 #define CONFIG_SYS_BOOTMAPSZ	        0x4000
 
-#define CONFIG_CMDLINE_TAG		1	/* enable passing of ATAGs */
-#define CONFIG_SETUP_MEMORY_TAGS	1
-#define CONFIG_INITRD_TAG		1
-#define CONFIG_REVISION_TAG		1
+#define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
 
 /*
  * Size of malloc() pool
  */
-#define CONFIG_ENV_SIZE			(128 << 10)	/* 128 KiB */
-						/* Sector */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (128 << 10))
+#define CONFIG_ENV_SIZE		(128 << 10)	/* 128 KiB */
+					/* Sector */
+#define CONFIG_SYS_MALLOC_LEN	(CONFIG_ENV_SIZE + (128 << 10))
 
 /*
  * Hardware drivers
@@ -107,20 +106,21 @@
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
 					115200}
-#define CONFIG_GENERIC_MMC		1
-#define CONFIG_MMC			1
-#define CONFIG_OMAP_HSMMC		1
-#define CONFIG_DOS_PARTITION		1
+
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_OMAP_HSMMC
+#define CONFIG_DOS_PARTITION
 
 /* USB */
-#define CONFIG_MUSB_UDC			1
-#define CONFIG_USB_OMAP3		1
-#define CONFIG_TWL4030_USB		1
+#define CONFIG_MUSB_UDC
+#define CONFIG_USB_OMAP3
+#define CONFIG_TWL4030_USB
 
 /* USB device configuration */
-#define CONFIG_USB_DEVICE		1
-#define CONFIG_USB_TTY			1
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV	1
+#define CONFIG_USB_DEVICE
+#define CONFIG_USB_TTY
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
 
 /* commands to include */
 #include <config_cmd_default.h>
@@ -131,10 +131,10 @@
 #define CONFIG_CMD_JFFS2	/* JFFS2 Support		*/
 #define CONFIG_CMD_MTDPARTS	/* Enable MTD parts commands */
 #define CONFIG_MTD_DEVICE	/* needed for mtdparts commands */
-#define MTDIDS_DEFAULT			"nand0=nand"
-#define MTDPARTS_DEFAULT		"mtdparts=nand:512k(x-loader),"\
-					"1920k(u-boot),128k(u-boot-env),"\
-					"4m(kernel),-(fs)"
+#define MTDIDS_DEFAULT		"nand0=nand"
+#define MTDPARTS_DEFAULT	"mtdparts=nand:512k(x-loader),"\
+				"1920k(u-boot),128k(u-boot-env),"\
+				"4m(kernel),-(fs)"
 
 #define CONFIG_CMD_I2C		/* I2C serial bus support	*/
 #define CONFIG_CMD_MMC		/* MMC support			*/
@@ -147,30 +147,30 @@
 #undef CONFIG_CMD_IMLS		/* List all found images	*/
 
 #define CONFIG_SYS_NO_FLASH
-#define CONFIG_HARD_I2C			1
+#define CONFIG_HARD_I2C
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
 #define CONFIG_SYS_I2C_BUS_SELECT	1
-#define CONFIG_DRIVER_OMAP34XX_I2C	1
+#define CONFIG_DRIVER_OMAP34XX_I2C
 
 /*
  * TWL4030
  */
-#define CONFIG_TWL4030_POWER		1
-#define CONFIG_TWL4030_LED		1
+#define CONFIG_TWL4030_POWER
+#define CONFIG_TWL4030_LED
 
 /*
  * Board NAND Info.
  */
-#define CONFIG_SYS_NAND_QUIET_TEST	1
+#define CONFIG_SYS_NAND_QUIET_TEST
 #define CONFIG_NAND_OMAP_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
 							/* to access nand */
 #define CONFIG_SYS_NAND_BASE		NAND_BASE	/* physical address */
 							/* to access nand at */
 							/* CS0 */
-#define GPMC_NAND_ECC_LP_x16_LAYOUT	1
+#define GPMC_NAND_ECC_LP_x16_LAYOUT
 
 #define CONFIG_SYS_MAX_NAND_DEVICE	1		/* Max number of NAND */
 							/* devices */
@@ -244,7 +244,7 @@
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_TIMESTAMP
-#define CONFIG_SYS_AUTOLOAD     "no"
+#define CONFIG_SYS_AUTOLOAD		"no"
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser */
 #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
@@ -308,7 +308,7 @@
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
 
-#define CONFIG_ENV_IS_IN_NAND		1
+#define CONFIG_ENV_IS_IN_NAND
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
 #define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
 
@@ -333,8 +333,8 @@
 					 GENERATED_GBL_DATA_SIZE)
 
 /* Status LED */
-#define CONFIG_STATUS_LED		1 /* Status LED enabled */
-#define CONFIG_BOARD_SPECIFIC_LED	1
+#define CONFIG_STATUS_LED		/* Status LED enabled */
+#define CONFIG_BOARD_SPECIFIC_LED
 #define STATUS_LED_GREEN		0
 #define STATUS_LED_BIT			STATUS_LED_GREEN
 #define STATUS_LED_STATE		STATUS_LED_ON
@@ -344,7 +344,7 @@
 
 /* GPIO banks */
 #ifdef CONFIG_STATUS_LED
-#define CONFIG_OMAP3_GPIO_6		1 /* GPIO186 is in GPIO bank 6  */
+#define CONFIG_OMAP3_GPIO_6	/* GPIO186 is in GPIO bank 6  */
 #endif
 
 #endif /* __CONFIG_H */
-- 
1.7.3.4

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

* [U-Boot] [PATCH 2/6] cm-t35: various cleanups
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number Igor Grinberg
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Move #ifdef CONFIG_SMC911X out of board_eth_init() function,
simplify the board_mmc_init() function, and enclose handle_mac_address()
in the CONFIG_SMC911X.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 board/cm_t35/cm_t35.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 420cd70..ff372d8 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -1,6 +1,5 @@
 /*
- * (C) Copyright 2011
- * CompuLab, Ltd. <www.compulab.co.il>
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
  *
  * Authors: Mike Rapoport <mike@compulab.co.il>
  *	    Igor Grinberg <grinberg@compulab.co.il>
@@ -316,8 +315,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0);
-	return 0;
+	return omap_mmc_init(0);
 }
 #endif
 
@@ -370,6 +368,7 @@ static void reset_net_chip(void)
 static inline void reset_net_chip(void) {}
 #endif
 
+#ifdef CONFIG_SMC911X
 /*
  * Routine: handle_mac_address
  * Description: prepare MAC address for on-board Ethernet.
@@ -404,7 +403,6 @@ int board_eth_init(bd_t *bis)
 {
 	int rc = 0, rc1 = 0;
 
-#ifdef CONFIG_SMC911X
 	setup_net_chip_gmpc();
 	reset_net_chip();
 
@@ -419,7 +417,7 @@ int board_eth_init(bd_t *bis)
 	rc1 = smc911x_initialize(1, SB_T35_SMC911X_BASE);
 	if (rc1 > 0)
 		rc++;
-#endif
 
 	return rc;
 }
+#endif
-- 
1.7.3.4

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

* [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 2/6] cm-t35: various cleanups Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-03 14:52   ` Tom Rini
  2012-01-02 14:01 ` [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak Igor Grinberg
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Add board specific EEPROM handling module,
read the serial number from the EEPROM and pass it to Linux.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 board/cm_t35/Makefile    |    4 ++-
 board/cm_t35/eeprom.c    |   79 ++++++++++++++++++++++++++++++++++++++++++++++
 board/cm_t35/eeprom.h    |   38 ++++++++++++++++++++++
 include/configs/cm_t35.h |    2 +
 4 files changed, 122 insertions(+), 1 deletions(-)
 create mode 100644 board/cm_t35/eeprom.c
 create mode 100644 board/cm_t35/eeprom.h

diff --git a/board/cm_t35/Makefile b/board/cm_t35/Makefile
index 27693f0..894fa09 100644
--- a/board/cm_t35/Makefile
+++ b/board/cm_t35/Makefile
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= cm_t35.o leds.o
+COBJS-$(CONFIG_DRIVER_OMAP34XX_I2C) += eeprom.o
+
+COBJS	:= cm_t35.o leds.o $(COBJS-y)
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
new file mode 100644
index 0000000..3bd7751
--- /dev/null
+++ b/board/cm_t35/eeprom.c
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <i2c.h>
+
+#define EEPROM_ADDR			0x50
+
+#define EEPROM_LAYOUT_VER_OFFSET	44
+#define BOARD_SERIAL_OFFSET		20
+#define BOARD_SERIAL_OFFSET_LEGACY	8
+
+#define LAYOUT_INVALID	0
+#define LAYOUT_LEGACY	0xff
+
+static uchar eeprom_layout; /* Implicitly LAYOUT_INVALID */
+
+static int cm_t3x_eeprom_read(uint offset, uchar *buf, int len)
+{
+	return i2c_read(EEPROM_ADDR, offset, CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
+								buf, len);
+}
+
+static int eeprom_setup_layout(void)
+{
+	int res;
+
+	if (eeprom_layout != LAYOUT_INVALID)
+		return 0;
+
+	res = cm_t3x_eeprom_read(EEPROM_LAYOUT_VER_OFFSET, &eeprom_layout, 1);
+	if (res) {
+		eeprom_layout = LAYOUT_INVALID;
+		return res;
+	}
+
+	if (eeprom_layout == 0 || eeprom_layout >= 0x20)
+		eeprom_layout = LAYOUT_LEGACY;
+
+	return 0;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	u32 serial[2];
+	uint offset;
+
+	memset(serialnr, 0, sizeof(*serialnr));
+	if (eeprom_setup_layout())
+		return;
+
+	offset = (eeprom_layout != LAYOUT_LEGACY) ?
+			BOARD_SERIAL_OFFSET : BOARD_SERIAL_OFFSET_LEGACY;
+	if (cm_t3x_eeprom_read(offset, (uchar *)serial, 8))
+		return;
+
+	if (serial[0] != 0xffffffff && serial[1] != 0xffffffff) {
+		serialnr->low = serial[0];
+		serialnr->high = serial[1];
+	}
+}
diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h
new file mode 100644
index 0000000..97a002a
--- /dev/null
+++ b/board/cm_t35/eeprom.h
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#ifndef _EEPROM_
+#define _EEPROM_
+
+#include <common.h>
+
+#ifndef CONFIG_DRIVER_OMAP34XX_I2C
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	/*
+	 * This corresponds to what happens when we can communicate with the
+	 * eeprom but don't get a valid board serial value.
+	 */
+	serialnr->low = 0;
+	serialnr->high = 0;
+};
+#endif /* CONFIG_DRIVER_OMAP34XX_I2C */
+
+#endif
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 61226d5..f868f78 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -72,6 +72,7 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
 
 /*
  * Size of malloc() pool
@@ -153,6 +154,7 @@
 #define CONFIG_SYS_I2C_BUS		0
 #define CONFIG_SYS_I2C_BUS_SELECT	1
 #define CONFIG_DRIVER_OMAP34XX_I2C
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
 
 /*
  * TWL4030
-- 
1.7.3.4

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

* [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
                   ` (2 preceding siblings ...)
  2012-01-02 14:01 ` [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-03 14:36   ` Tom Rini
  2012-01-02 14:01 ` [U-Boot] [PATCH 5/6] cm-t35: pass correct revision information to Linux Igor Grinberg
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 arch/arm/cpu/armv7/omap3/sys_info.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/sys_info.c b/arch/arm/cpu/armv7/omap3/sys_info.c
index 22887ae..cde4093 100644
--- a/arch/arm/cpu/armv7/omap3/sys_info.c
+++ b/arch/arm/cpu/armv7/omap3/sys_info.c
@@ -197,10 +197,11 @@ u32 get_gpmc0_width(void)
  * get_board_rev() - setup to pass kernel board revision information
  * returns:(bit[0-3] sub version, higher bit[7-4] is higher version)
  *************************************************************************/
-u32 get_board_rev(void)
+u32 __get_board_rev(void)
 {
 	return 0x20;
 }
+u32 get_board_rev(void) __attribute__((weak, alias("__get_board_rev")));
 
 /********************************************************
  *  get_base(); get upper addr of current execution
-- 
1.7.3.4

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

* [U-Boot] [PATCH 5/6] cm-t35: pass correct revision information to Linux
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
                   ` (3 preceding siblings ...)
  2012-01-02 14:01 ` [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-02 14:01 ` [U-Boot] [PATCH 6/6] cm-t35: use the new EEPROM module to read the MAC address Igor Grinberg
  2012-01-03 15:15 ` [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Tom Rini
  6 siblings, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Read revision from EEPROM and pass it to Linux.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 board/cm_t35/eeprom.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
index 3bd7751..8386d18 100644
--- a/board/cm_t35/eeprom.c
+++ b/board/cm_t35/eeprom.c
@@ -27,6 +27,10 @@
 #define EEPROM_LAYOUT_VER_OFFSET	44
 #define BOARD_SERIAL_OFFSET		20
 #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 LAYOUT_INVALID	0
 #define LAYOUT_LEGACY	0xff
@@ -77,3 +81,27 @@ void get_board_serial(struct tag_serialnr *serialnr)
 		serialnr->high = serial[1];
 	}
 }
+
+/*
+ * Routine: get_board_rev
+ * Description: read system revision
+ */
+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) {
+		offset = BOARD_REV_OFFSET;
+		len = BOARD_REV_SIZE;
+	}
+
+	if (cm_t3x_eeprom_read(offset, (uchar *)&rev, len))
+		return 0;
+
+	return rev;
+};
-- 
1.7.3.4

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

* [U-Boot] [PATCH 6/6] cm-t35: use the new EEPROM module to read the MAC address
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
                   ` (4 preceding siblings ...)
  2012-01-02 14:01 ` [U-Boot] [PATCH 5/6] cm-t35: pass correct revision information to Linux Igor Grinberg
@ 2012-01-02 14:01 ` Igor Grinberg
  2012-01-12 13:28   ` [U-Boot] [PATCH v2 " Igor Grinberg
  2012-01-03 15:15 ` [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Tom Rini
  6 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-01-02 14:01 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Switch to the new EEPROM module and fix the problem of MAC address
being read from the wrong offset due to lack of distinction between
EEPROM layouts.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 board/cm_t35/cm_t35.c |    6 +++---
 board/cm_t35/eeprom.c |   18 ++++++++++++++++++
 board/cm_t35/eeprom.h |    9 ++++++++-
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index ff372d8..caafe06 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -41,6 +41,8 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
 
+#include "eeprom.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 const omap3_sysinfo sysinfo = {
@@ -382,11 +384,9 @@ static int handle_mac_address(void)
 	if (rc)
 		return 0;
 
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
-	rc = i2c_read(0x50, 0, 1, enetaddr, 6);
+	rc = cm_t3x_eeprom_read_mac_addr(enetaddr);
 	if (rc)
 		return rc;
-#endif
 
 	if (!is_valid_ether_addr(enetaddr))
 		return -1;
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
index 8386d18..e975855 100644
--- a/board/cm_t35/eeprom.c
+++ b/board/cm_t35/eeprom.c
@@ -31,6 +31,8 @@
 #define BOARD_REV_OFFSET_LEGACY		6
 #define BOARD_REV_SIZE			4
 #define BOARD_REV_SIZE_LEGACY		2
+#define MAC_ADDR_OFFSET			4
+#define MAC_ADDR_OFFSET_LEGACY		0
 
 #define LAYOUT_INVALID	0
 #define LAYOUT_LEGACY	0xff
@@ -83,6 +85,22 @@ void get_board_serial(struct tag_serialnr *serialnr)
 }
 
 /*
+ * Routine: cm_t3x_eeprom_read_mac_addr
+ * Description: read mac address and store it in buf.
+ */
+int cm_t3x_eeprom_read_mac_addr(uchar *buf)
+{
+	uint offset;
+
+	if (eeprom_setup_layout())
+		return 0;
+
+	offset = (eeprom_layout != LAYOUT_LEGACY) ?
+			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
+	return cm_t3x_eeprom_read(offset, buf, 6);
+}
+
+/*
  * Routine: get_board_rev
  * Description: read system revision
  */
diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h
index 97a002a..e8680d7 100644
--- a/board/cm_t35/eeprom.h
+++ b/board/cm_t35/eeprom.h
@@ -23,7 +23,9 @@
 
 #include <common.h>
 
-#ifndef CONFIG_DRIVER_OMAP34XX_I2C
+#ifdef CONFIG_DRIVER_OMAP34XX_I2C
+int cm_t3x_eeprom_read_mac_addr(uchar *buf);
+#else
 void get_board_serial(struct tag_serialnr *serialnr)
 {
 	/*
@@ -33,6 +35,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
 	serialnr->low = 0;
 	serialnr->high = 0;
 };
+
+int cm_t3x_eeprom_read_mac_addr(uchar *buf)
+{
+	return 1;
+}
 #endif /* CONFIG_DRIVER_OMAP34XX_I2C */
 
 #endif
-- 
1.7.3.4

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

* [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file
  2012-01-02 14:01 ` [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file Igor Grinberg
@ 2012-01-03  6:35   ` Igor Grinberg
  0 siblings, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-03  6:35 UTC (permalink / raw)
  To: u-boot

On 01/02/12 16:01, Igor Grinberg wrote:
> From: Nikita Kiryanov <nikita@compulab.co.il>
> 
> Remove values from boolean defines, fix indentation, etc..
> No functional changes.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> ---

Forgot to mention that this patch depends on Thomas' clean up
patch, either [1] or [2] (they are the same).

[1] http://patchwork.ozlabs.org/patch/133915/
[2] http://patchwork.ozlabs.org/patch/131793/


-- 
Regards,
Igor.

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

* [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak
  2012-01-02 14:01 ` [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak Igor Grinberg
@ 2012-01-03 14:36   ` Tom Rini
  2012-01-05 12:03     ` [U-Boot] [PATCH v2 " Igor Grinberg
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Rini @ 2012-01-03 14:36 UTC (permalink / raw)
  To: u-boot

On 01/02/2012 07:01 AM, Igor Grinberg wrote:
> From: Nikita Kiryanov <nikita@compulab.co.il>
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>

Please add <linux/compiler.h> and just put __weak in front of
get_board_rev, thanks.

-- 
Tom

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

* [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-02 14:01 ` [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number Igor Grinberg
@ 2012-01-03 14:52   ` Tom Rini
  2012-01-05 12:02     ` [U-Boot] [PATCH v2 " Igor Grinberg
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Rini @ 2012-01-03 14:52 UTC (permalink / raw)
  To: u-boot

On 01/02/2012 07:01 AM, Igor Grinberg wrote:
> From: Nikita Kiryanov <nikita@compulab.co.il>
> 
> Add board specific EEPROM handling module,
> read the serial number from the EEPROM and pass it to Linux.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
[snip]
> +#define EEPROM_ADDR			0x50

Some grepping around says this is usually CONFIG_SYS_I2C_EEPROM_ADDR (in
the config.h).  Thanks.

-- 
Tom

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

* [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730
  2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
                   ` (5 preceding siblings ...)
  2012-01-02 14:01 ` [U-Boot] [PATCH 6/6] cm-t35: use the new EEPROM module to read the MAC address Igor Grinberg
@ 2012-01-03 15:15 ` Tom Rini
  2012-01-13 17:21   ` Tom Rini
  6 siblings, 1 reply; 24+ messages in thread
From: Tom Rini @ 2012-01-03 15:15 UTC (permalink / raw)
  To: u-boot

On 01/02/2012 07:01 AM, Igor Grinberg wrote:
> This patch series some what clean up cm-t35 board files,
> add separate EEPROM handling file,
> fixes the incorrect board revision passed to Linux.
> 
> Nikita Kiryanov (6):
>   cm-t35: cleanup the config file
>   cm-t35: various cleanups
>   cm-t35: add EEPROM module and pass Linux a serial number
>   omap3: make get_board_rev() function weak
>   cm-t35: pass correct revision information to Linux
>   cm-t35: use the new EEPROM module to read the MAC address
> 
>  arch/arm/cpu/armv7/omap3/sys_info.c |    3 +-
>  board/cm_t35/Makefile               |    4 +-
>  board/cm_t35/cm_t35.c               |   16 ++---
>  board/cm_t35/eeprom.c               |  125 +++++++++++++++++++++++++++++++++++
>  board/cm_t35/eeprom.h               |   45 +++++++++++++
>  include/configs/cm_t35.h            |   80 +++++++++++-----------
>  6 files changed, 223 insertions(+), 50 deletions(-)
>  create mode 100644 board/cm_t35/eeprom.c
>  create mode 100644 board/cm_t35/eeprom.h

I've read the whole series now and commented on a few of them.  Thanks.

-- 
Tom

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-03 14:52   ` Tom Rini
@ 2012-01-05 12:02     ` Igor Grinberg
  2012-01-05 14:56       ` Wolfgang Denk
  0 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-01-05 12:02 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Add board specific EEPROM handling module,
read the serial number from the EEPROM and pass it to Linux.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
Changes in v2:
  * Use CONFIG_SYS_I2C_EEPROM_ADDR instead of a custom define
  * Fix strange linker warning: ".bss section overlaps previous sections"
    by changing the type of the eeprom_layout static global variable to int
    (probably this is a compiler bug).

 board/cm_t35/Makefile    |    4 ++-
 board/cm_t35/eeprom.c    |   78 ++++++++++++++++++++++++++++++++++++++++++++++
 board/cm_t35/eeprom.h    |   38 ++++++++++++++++++++++
 include/configs/cm_t35.h |    3 ++
 4 files changed, 122 insertions(+), 1 deletions(-)
 create mode 100644 board/cm_t35/eeprom.c
 create mode 100644 board/cm_t35/eeprom.h

diff --git a/board/cm_t35/Makefile b/board/cm_t35/Makefile
index 27693f0..894fa09 100644
--- a/board/cm_t35/Makefile
+++ b/board/cm_t35/Makefile
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= cm_t35.o leds.o
+COBJS-$(CONFIG_DRIVER_OMAP34XX_I2C) += eeprom.o
+
+COBJS	:= cm_t35.o leds.o $(COBJS-y)
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
new file mode 100644
index 0000000..93ed6cb
--- /dev/null
+++ b/board/cm_t35/eeprom.c
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <i2c.h>
+
+#define EEPROM_LAYOUT_VER_OFFSET	44
+#define BOARD_SERIAL_OFFSET		20
+#define BOARD_SERIAL_OFFSET_LEGACY	8
+
+#define LAYOUT_INVALID	0
+#define LAYOUT_LEGACY	0xff
+
+static int eeprom_layout; /* Implicitly LAYOUT_INVALID */
+
+static int cm_t3x_eeprom_read(uint offset, uchar *buf, int len)
+{
+	return i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
+			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
+}
+
+static int eeprom_setup_layout(void)
+{
+	int res;
+
+	if (eeprom_layout != LAYOUT_INVALID)
+		return 0;
+
+	res = cm_t3x_eeprom_read(EEPROM_LAYOUT_VER_OFFSET,
+						(uchar *)&eeprom_layout, 1);
+	if (res) {
+		eeprom_layout = LAYOUT_INVALID;
+		return res;
+	}
+
+	if (eeprom_layout == 0 || eeprom_layout >= 0x20)
+		eeprom_layout = LAYOUT_LEGACY;
+
+	return 0;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	u32 serial[2];
+	uint offset;
+
+	memset(serialnr, 0, sizeof(*serialnr));
+	if (eeprom_setup_layout())
+		return;
+
+	offset = (eeprom_layout != LAYOUT_LEGACY) ?
+			BOARD_SERIAL_OFFSET : BOARD_SERIAL_OFFSET_LEGACY;
+	if (cm_t3x_eeprom_read(offset, (uchar *)serial, 8))
+		return;
+
+	if (serial[0] != 0xffffffff && serial[1] != 0xffffffff) {
+		serialnr->low = serial[0];
+		serialnr->high = serial[1];
+	}
+}
diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h
new file mode 100644
index 0000000..97a002a
--- /dev/null
+++ b/board/cm_t35/eeprom.h
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#ifndef _EEPROM_
+#define _EEPROM_
+
+#include <common.h>
+
+#ifndef CONFIG_DRIVER_OMAP34XX_I2C
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	/*
+	 * This corresponds to what happens when we can communicate with the
+	 * eeprom but don't get a valid board serial value.
+	 */
+	serialnr->low = 0;
+	serialnr->high = 0;
+};
+#endif /* CONFIG_DRIVER_OMAP34XX_I2C */
+
+#endif
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 61226d5..fe91c10 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -72,6 +72,7 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
 
 /*
  * Size of malloc() pool
@@ -153,6 +154,8 @@
 #define CONFIG_SYS_I2C_BUS		0
 #define CONFIG_SYS_I2C_BUS_SELECT	1
 #define CONFIG_DRIVER_OMAP34XX_I2C
+#define CONFIG_SYS_I2C_EEPROM_ADDR	0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
 
 /*
  * TWL4030
-- 
1.7.3.4

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

* [U-Boot] [PATCH v2 4/6] omap3: make get_board_rev() function weak
  2012-01-03 14:36   ` Tom Rini
@ 2012-01-05 12:03     ` Igor Grinberg
  0 siblings, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-05 12:03 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Current get_board_rev() function returns a hard coded value which is
obviously incorrect for the majority of boards.
Allow boards to provide a correct implementation by making this function
weak.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
Changes in v2:
  * Changed the way get_board_rev is defined as weak -
    remove alias and just add __weak in definition.

 arch/arm/cpu/armv7/omap3/sys_info.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/sys_info.c b/arch/arm/cpu/armv7/omap3/sys_info.c
index 22887ae..3c80113 100644
--- a/arch/arm/cpu/armv7/omap3/sys_info.c
+++ b/arch/arm/cpu/armv7/omap3/sys_info.c
@@ -30,6 +30,7 @@
 #include <asm/arch/mem.h>	/* get mem tables */
 #include <asm/arch/sys_proto.h>
 #include <i2c.h>
+#include <linux/compiler.h>
 
 extern omap3_sysinfo sysinfo;
 static struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
@@ -197,7 +198,7 @@ u32 get_gpmc0_width(void)
  * get_board_rev() - setup to pass kernel board revision information
  * returns:(bit[0-3] sub version, higher bit[7-4] is higher version)
  *************************************************************************/
-u32 get_board_rev(void)
+u32 __weak get_board_rev(void)
 {
 	return 0x20;
 }
-- 
1.7.3.4

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-05 12:02     ` [U-Boot] [PATCH v2 " Igor Grinberg
@ 2012-01-05 14:56       ` Wolfgang Denk
  2012-01-09  8:30         ` Nikita Kiryanov
  2012-01-12 13:26         ` [U-Boot] [PATCH v3 " Igor Grinberg
  0 siblings, 2 replies; 24+ messages in thread
From: Wolfgang Denk @ 2012-01-05 14:56 UTC (permalink / raw)
  To: u-boot

Dear Igor Grinberg,

In message <1325764937-7342-1-git-send-email-grinberg@compulab.co.il> you wrote:
> From: Nikita Kiryanov <nikita@compulab.co.il>
> 
> Add board specific EEPROM handling module,
> read the serial number from the EEPROM and pass it to Linux.
...

>   * Fix strange linker warning: ".bss section overlaps previous sections"
>     by changing the type of the eeprom_layout static global variable to int
>     (probably this is a compiler bug).

Probably it is now.  Did you inspect the linke rmap?

> +static int cm_t3x_eeprom_read(uint offset, uchar *buf, int len)
> +{
> +	return i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
> +			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
> +}

Is there any specific reason why you cannot use the standard
eeprom_read() function here?

> --- /dev/null
> +++ b/board/cm_t35/eeprom.h
...
> +#ifndef CONFIG_DRIVER_OMAP34XX_I2C
> +void get_board_serial(struct tag_serialnr *serialnr)
> +{
> +	/*
> +	 * This corresponds to what happens when we can communicate with the
> +	 * eeprom but don't get a valid board serial value.
> +	 */
> +	serialnr->low = 0;
> +	serialnr->high = 0;
> +};
> +#endif /* CONFIG_DRIVER_OMAP34XX_I2C */

Please do NOT place code into header files.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A mouse is an elephant built by the Japanese.

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-05 14:56       ` Wolfgang Denk
@ 2012-01-09  8:30         ` Nikita Kiryanov
  2012-02-06 22:56           ` Albert ARIBAUD
  2012-01-12 13:26         ` [U-Boot] [PATCH v3 " Igor Grinberg
  1 sibling, 1 reply; 24+ messages in thread
From: Nikita Kiryanov @ 2012-01-09  8:30 UTC (permalink / raw)
  To: u-boot

On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
> Dear Igor Grinberg,
>
> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>  you wrote:
>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>
>> Add board specific EEPROM handling module,
>> read the serial number from the EEPROM and pass it to Linux.
> ...
>
>>    * Fix strange linker warning: ".bss section overlaps previous sections"
>>      by changing the type of the eeprom_layout static global variable to int
>>      (probably this is a compiler bug).
> Probably it is now.  Did you inspect the linke rmap?

u-boot.map shows the bss section aligning perfectly with the start of 
rel.dyn.

The difference between the original "working" version and the version 
with the warning
was an additional byte added by uchar eeprom_layout to the size of 
libcm_t35.o.
This shouldn't be a problem because the bss section is followed by an 
ALIGN(4), but
we decided to try changing eeprom_layout to an int and the problem went 
away.
When we tried to define 4 uchars the problem reappeared.

This suggests that this might be a compiler bug.

There's been some discussion about this in the following threads:
http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
and we're not aware of any fix to the issue.

>> +static int cm_t3x_eeprom_read(uint offset, uchar *buf, int len)
>> +{
>> +	return i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
>> +			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
>> +}
> Is there any specific reason why you cannot use the standard
> eeprom_read() function here?

The inclusion of the entire eeprom library for this one function will just
increase the image size needlessly. Moreover we don't want to add
eeprom commands, because the eeprom on this module is for internal
use only.

>> --- /dev/null
>> +++ b/board/cm_t35/eeprom.h
> ...
>> +#ifndef CONFIG_DRIVER_OMAP34XX_I2C
>> +void get_board_serial(struct tag_serialnr *serialnr)
>> +{
>> +	/*
>> +	 * This corresponds to what happens when we can communicate with the
>> +	 * eeprom but don't get a valid board serial value.
>> +	 */
>> +	serialnr->low = 0;
>> +	serialnr->high = 0;
>> +};
>> +#endif /* CONFIG_DRIVER_OMAP34XX_I2C */
> Please do NOT place code into header files.

Will be fixed in the next version.

> Best regards,
>
> Wolfgang Denk
>

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

* [U-Boot] [PATCH v3 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-05 14:56       ` Wolfgang Denk
  2012-01-09  8:30         ` Nikita Kiryanov
@ 2012-01-12 13:26         ` Igor Grinberg
  1 sibling, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-12 13:26 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Add board specific EEPROM handling module,
read the serial number from the EEPROM and pass it to Linux.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
Changes in v2:
 * Use CONFIG_SYS_I2C_EEPROM_ADDR instead of a custom define
 * Fix strange linker warning: ".bss section overlaps previous sections"
   by changing the type of the eeprom_layout static global variable to int
   (probably this is a compiler bug).

Changes in v3:
 * Move the default implementation of get_board_serial out of eeprom.h and into
   cm_t35.c
 * Make get_board_serial default implementation weak.

 board/cm_t35/Makefile    |    4 ++-
 board/cm_t35/cm_t35.c    |   11 ++++++
 board/cm_t35/eeprom.c    |   78 ++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/cm_t35.h |    3 ++
 4 files changed, 95 insertions(+), 1 deletions(-)
 create mode 100644 board/cm_t35/eeprom.c

diff --git a/board/cm_t35/Makefile b/board/cm_t35/Makefile
index 27693f0..894fa09 100644
--- a/board/cm_t35/Makefile
+++ b/board/cm_t35/Makefile
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= cm_t35.o leds.o
+COBJS-$(CONFIG_DRIVER_OMAP34XX_I2C) += eeprom.o
+
+COBJS	:= cm_t35.o leds.o $(COBJS-y)
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index ff372d8..0d5a401 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -33,6 +33,7 @@
 #include <net.h>
 #include <i2c.h>
 #include <twl4030.h>
+#include <linux/compiler.h>
 
 #include <asm/io.h>
 #include <asm/arch/mem.h>
@@ -421,3 +422,13 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 #endif
+
+void __weak get_board_serial(struct tag_serialnr *serialnr)
+{
+	/*
+	 * This corresponds to what happens when we can communicate with the
+	 * eeprom but don't get a valid board serial value.
+	 */
+	serialnr->low = 0;
+	serialnr->high = 0;
+};
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
new file mode 100644
index 0000000..93ed6cb
--- /dev/null
+++ b/board/cm_t35/eeprom.c
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#include <common.h>
+#include <i2c.h>
+
+#define EEPROM_LAYOUT_VER_OFFSET	44
+#define BOARD_SERIAL_OFFSET		20
+#define BOARD_SERIAL_OFFSET_LEGACY	8
+
+#define LAYOUT_INVALID	0
+#define LAYOUT_LEGACY	0xff
+
+static int eeprom_layout; /* Implicitly LAYOUT_INVALID */
+
+static int cm_t3x_eeprom_read(uint offset, uchar *buf, int len)
+{
+	return i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, offset,
+			CONFIG_SYS_I2C_EEPROM_ADDR_LEN, buf, len);
+}
+
+static int eeprom_setup_layout(void)
+{
+	int res;
+
+	if (eeprom_layout != LAYOUT_INVALID)
+		return 0;
+
+	res = cm_t3x_eeprom_read(EEPROM_LAYOUT_VER_OFFSET,
+						(uchar *)&eeprom_layout, 1);
+	if (res) {
+		eeprom_layout = LAYOUT_INVALID;
+		return res;
+	}
+
+	if (eeprom_layout == 0 || eeprom_layout >= 0x20)
+		eeprom_layout = LAYOUT_LEGACY;
+
+	return 0;
+}
+
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+	u32 serial[2];
+	uint offset;
+
+	memset(serialnr, 0, sizeof(*serialnr));
+	if (eeprom_setup_layout())
+		return;
+
+	offset = (eeprom_layout != LAYOUT_LEGACY) ?
+			BOARD_SERIAL_OFFSET : BOARD_SERIAL_OFFSET_LEGACY;
+	if (cm_t3x_eeprom_read(offset, (uchar *)serial, 8))
+		return;
+
+	if (serial[0] != 0xffffffff && serial[1] != 0xffffffff) {
+		serialnr->low = serial[0];
+		serialnr->high = serial[1];
+	}
+}
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 61226d5..fe91c10 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -72,6 +72,7 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
 
 /*
  * Size of malloc() pool
@@ -153,6 +154,8 @@
 #define CONFIG_SYS_I2C_BUS		0
 #define CONFIG_SYS_I2C_BUS_SELECT	1
 #define CONFIG_DRIVER_OMAP34XX_I2C
+#define CONFIG_SYS_I2C_EEPROM_ADDR	0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
 
 /*
  * TWL4030
-- 
1.7.3.4

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

* [U-Boot] [PATCH v2 6/6] cm-t35: use the new EEPROM module to read the MAC address
  2012-01-02 14:01 ` [U-Boot] [PATCH 6/6] cm-t35: use the new EEPROM module to read the MAC address Igor Grinberg
@ 2012-01-12 13:28   ` Igor Grinberg
  0 siblings, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-01-12 13:28 UTC (permalink / raw)
  To: u-boot

From: Nikita Kiryanov <nikita@compulab.co.il>

Switch to the new EEPROM module and fix the problem of MAC address
being read from the wrong offset due to lack of distinction between
EEPROM layouts.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
Changes in v2:
 * Make the cm_t3x_eeprom_read_mac_addr() stub static inline.
 * Remove unused include from eeprom.h


 board/cm_t35/cm_t35.c |    6 +++---
 board/cm_t35/eeprom.c |   18 ++++++++++++++++++
 board/cm_t35/eeprom.h |   33 +++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100644 board/cm_t35/eeprom.h

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 0d5a401..0a04994 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -42,6 +42,8 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
 
+#include "eeprom.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 const omap3_sysinfo sysinfo = {
@@ -383,11 +385,9 @@ static int handle_mac_address(void)
 	if (rc)
 		return 0;
 
-#ifdef CONFIG_DRIVER_OMAP34XX_I2C
-	rc = i2c_read(0x50, 0, 1, enetaddr, 6);
+	rc = cm_t3x_eeprom_read_mac_addr(enetaddr);
 	if (rc)
 		return rc;
-#endif
 
 	if (!is_valid_ether_addr(enetaddr))
 		return -1;
diff --git a/board/cm_t35/eeprom.c b/board/cm_t35/eeprom.c
index b3d332f..dfa171d 100644
--- a/board/cm_t35/eeprom.c
+++ b/board/cm_t35/eeprom.c
@@ -29,6 +29,8 @@
 #define BOARD_REV_OFFSET_LEGACY		6
 #define BOARD_REV_SIZE			4
 #define BOARD_REV_SIZE_LEGACY		2
+#define MAC_ADDR_OFFSET			4
+#define MAC_ADDR_OFFSET_LEGACY		0
 
 #define LAYOUT_INVALID	0
 #define LAYOUT_LEGACY	0xff
@@ -82,6 +84,22 @@ void get_board_serial(struct tag_serialnr *serialnr)
 }
 
 /*
+ * Routine: cm_t3x_eeprom_read_mac_addr
+ * Description: read mac address and store it in buf.
+ */
+int cm_t3x_eeprom_read_mac_addr(uchar *buf)
+{
+	uint offset;
+
+	if (eeprom_setup_layout())
+		return 0;
+
+	offset = (eeprom_layout != LAYOUT_LEGACY) ?
+			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
+	return cm_t3x_eeprom_read(offset, buf, 6);
+}
+
+/*
  * Routine: get_board_rev
  * Description: read system revision
  */
diff --git a/board/cm_t35/eeprom.h b/board/cm_t35/eeprom.h
new file mode 100644
index 0000000..ec772c6
--- /dev/null
+++ b/board/cm_t35/eeprom.h
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
+ *
+ * Authors: Nikita Kiryanov <nikita@compulab.co.il>
+ *	    Igor Grinberg <grinberg@compulab.co.il>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+#ifndef _EEPROM_
+#define _EEPROM_
+
+#ifdef CONFIG_DRIVER_OMAP34XX_I2C
+int cm_t3x_eeprom_read_mac_addr(uchar *buf);
+#else
+static inline int cm_t3x_eeprom_read_mac_addr(uchar *buf)
+{
+	return 1;
+}
+#endif
+
+#endif
-- 
1.7.3.4

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

* [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730
  2012-01-03 15:15 ` [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Tom Rini
@ 2012-01-13 17:21   ` Tom Rini
  0 siblings, 0 replies; 24+ messages in thread
From: Tom Rini @ 2012-01-13 17:21 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 3, 2012 at 8:15 AM, Tom Rini <trini@ti.com> wrote:
> On 01/02/2012 07:01 AM, Igor Grinberg wrote:
>> This patch series some what clean up cm-t35 board files,
>> add separate EEPROM handling file,
>> fixes the incorrect board revision passed to Linux.
>>
>> Nikita Kiryanov (6):
>> ? cm-t35: cleanup the config file
>> ? cm-t35: various cleanups
>> ? cm-t35: add EEPROM module and pass Linux a serial number
>> ? omap3: make get_board_rev() function weak
>> ? cm-t35: pass correct revision information to Linux
>> ? cm-t35: use the new EEPROM module to read the MAC address
>>
>> ?arch/arm/cpu/armv7/omap3/sys_info.c | ? ?3 +-
>> ?board/cm_t35/Makefile ? ? ? ? ? ? ? | ? ?4 +-
>> ?board/cm_t35/cm_t35.c ? ? ? ? ? ? ? | ? 16 ++---
>> ?board/cm_t35/eeprom.c ? ? ? ? ? ? ? | ?125 +++++++++++++++++++++++++++++++++++
>> ?board/cm_t35/eeprom.h ? ? ? ? ? ? ? | ? 45 +++++++++++++
>> ?include/configs/cm_t35.h ? ? ? ? ? ?| ? 80 +++++++++++-----------
>> ?6 files changed, 223 insertions(+), 50 deletions(-)
>> ?create mode 100644 board/cm_t35/eeprom.c
>> ?create mode 100644 board/cm_t35/eeprom.h
>
> I've read the whole series now and commented on a few of them. ?Thanks.

As the comments have been addressed, I've taken the
latest-in-patchwork versions into u-boot-ti/master, thanks!

-- 
Tom

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-01-09  8:30         ` Nikita Kiryanov
@ 2012-02-06 22:56           ` Albert ARIBAUD
  2012-02-07  8:01             ` Igor Grinberg
  0 siblings, 1 reply; 24+ messages in thread
From: Albert ARIBAUD @ 2012-02-06 22:56 UTC (permalink / raw)
  To: u-boot

Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>> Dear Igor Grinberg,
>>
>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>> you wrote:
>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>
>>> Add board specific EEPROM handling module,
>>> read the serial number from the EEPROM and pass it to Linux.
>> ...
>>
>>> * Fix strange linker warning: ".bss section overlaps previous sections"
>>> by changing the type of the eeprom_layout static global variable to int
>>> (probably this is a compiler bug).
>> Probably it is now. Did you inspect the linke rmap?
>
> u-boot.map shows the bss section aligning perfectly with the start of
> rel.dyn.
>
> The difference between the original "working" version and the version
> with the warning
> was an additional byte added by uchar eeprom_layout to the size of
> libcm_t35.o.
> This shouldn't be a problem because the bss section is followed by an
> ALIGN(4), but
> we decided to try changing eeprom_layout to an int and the problem went
> away.
> When we tried to define 4 uchars the problem reappeared.
>
> This suggests that this might be a compiler bug.
>
> There's been some discussion about this in the following threads:
> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
> and we're not aware of any fix to the issue.

Which prompted me to test --no-check-sections with CS 2009q1. Adding it 
to LDFLAGS_u-boot does reduce the annoyance from errors to a warning, 
but there is no way to completely make it disappear.

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-02-06 22:56           ` Albert ARIBAUD
@ 2012-02-07  8:01             ` Igor Grinberg
  2012-02-17  9:50               ` Albert ARIBAUD
  0 siblings, 1 reply; 24+ messages in thread
From: Igor Grinberg @ 2012-02-07  8:01 UTC (permalink / raw)
  To: u-boot

Hi Albert,

On 02/07/12 00:56, Albert ARIBAUD wrote:
> Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
>> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>>> Dear Igor Grinberg,
>>>
>>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>>> you wrote:
>>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>>
>>>> Add board specific EEPROM handling module,
>>>> read the serial number from the EEPROM and pass it to Linux.
>>> ...
>>>
>>>> * Fix strange linker warning: ".bss section overlaps previous sections"
>>>> by changing the type of the eeprom_layout static global variable to int
>>>> (probably this is a compiler bug).
>>> Probably it is now. Did you inspect the linke rmap?
>>
>> u-boot.map shows the bss section aligning perfectly with the start of
>> rel.dyn.
>>
>> The difference between the original "working" version and the version
>> with the warning
>> was an additional byte added by uchar eeprom_layout to the size of
>> libcm_t35.o.
>> This shouldn't be a problem because the bss section is followed by an
>> ALIGN(4), but
>> we decided to try changing eeprom_layout to an int and the problem went
>> away.
>> When we tried to define 4 uchars the problem reappeared.
>>
>> This suggests that this might be a compiler bug.
>>
>> There's been some discussion about this in the following threads:
>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
>> and we're not aware of any fix to the issue.
> 
> Which prompted me to test --no-check-sections with CS 2009q1.
> Adding it to LDFLAGS_u-boot does reduce the annoyance from errors to a warning,
> but there is no way to completely make it disappear.

So the conclusion is still a tool chain bug, right?
Probably it doesn't hurt besides the annoying warning.


-- 
Regards,
Igor.

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-02-07  8:01             ` Igor Grinberg
@ 2012-02-17  9:50               ` Albert ARIBAUD
  2012-02-17 17:10                 ` Tom Rini
  2012-02-21 13:44                 ` Igor Grinberg
  0 siblings, 2 replies; 24+ messages in thread
From: Albert ARIBAUD @ 2012-02-17  9:50 UTC (permalink / raw)
  To: u-boot

Hi Igor,

Le 07/02/2012 09:01, Igor Grinberg a ?crit :
> Hi Albert,
>
> On 02/07/12 00:56, Albert ARIBAUD wrote:
>> Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
>>> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>>>> Dear Igor Grinberg,
>>>>
>>>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>>>> you wrote:
>>>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>>>
>>>>> Add board specific EEPROM handling module,
>>>>> read the serial number from the EEPROM and pass it to Linux.
>>>> ...
>>>>
>>>>> * Fix strange linker warning: ".bss section overlaps previous sections"
>>>>> by changing the type of the eeprom_layout static global variable to int
>>>>> (probably this is a compiler bug).
>>>> Probably it is now. Did you inspect the linke rmap?
>>>
>>> u-boot.map shows the bss section aligning perfectly with the start of
>>> rel.dyn.
>>>
>>> The difference between the original "working" version and the version
>>> with the warning
>>> was an additional byte added by uchar eeprom_layout to the size of
>>> libcm_t35.o.
>>> This shouldn't be a problem because the bss section is followed by an
>>> ALIGN(4), but
>>> we decided to try changing eeprom_layout to an int and the problem went
>>> away.
>>> When we tried to define 4 uchars the problem reappeared.
>>>
>>> This suggests that this might be a compiler bug.
>>>
>>> There's been some discussion about this in the following threads:
>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
>>> and we're not aware of any fix to the issue.
>>
>> Which prompted me to test --no-check-sections with CS 2009q1.
>> Adding it to LDFLAGS_u-boot does reduce the annoyance from errors to a warning,
>> but there is no way to completely make it disappear.
>
> So the conclusion is still a tool chain bug, right?
> Probably it doesn't hurt besides the annoying warning.

Sorry for being slow.

Yes, it seems to be a toolchain bug and limited to a spurious warning. 
However, spurious warnings are always a pain when doing a MAKEALL arm, 
because the board is listed among the unclean and failed builds and then 
one must go through these individually and remember that this specific 
warning is both unimportant and unavoidable.

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-02-17  9:50               ` Albert ARIBAUD
@ 2012-02-17 17:10                 ` Tom Rini
  2012-02-18 10:30                   ` Albert ARIBAUD
  2012-02-21 13:44                 ` Igor Grinberg
  1 sibling, 1 reply; 24+ messages in thread
From: Tom Rini @ 2012-02-17 17:10 UTC (permalink / raw)
  To: u-boot

On 02/17/2012 02:50 AM, Albert ARIBAUD wrote:
> Hi Igor,
>
> Le 07/02/2012 09:01, Igor Grinberg a ?crit :
>> Hi Albert,
>>
>> On 02/07/12 00:56, Albert ARIBAUD wrote:
>>> Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
>>>> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>>>>> Dear Igor Grinberg,
>>>>>
>>>>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>>>>> you wrote:
>>>>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>>>>
>>>>>> Add board specific EEPROM handling module,
>>>>>> read the serial number from the EEPROM and pass it to Linux.
>>>>> ...
>>>>>
>>>>>> * Fix strange linker warning: ".bss section overlaps previous
>>>>>> sections"
>>>>>> by changing the type of the eeprom_layout static global variable
>>>>>> to int
>>>>>> (probably this is a compiler bug).
>>>>> Probably it is now. Did you inspect the linke rmap?
>>>>
>>>> u-boot.map shows the bss section aligning perfectly with the start of
>>>> rel.dyn.
>>>>
>>>> The difference between the original "working" version and the version
>>>> with the warning
>>>> was an additional byte added by uchar eeprom_layout to the size of
>>>> libcm_t35.o.
>>>> This shouldn't be a problem because the bss section is followed by an
>>>> ALIGN(4), but
>>>> we decided to try changing eeprom_layout to an int and the problem went
>>>> away.
>>>> When we tried to define 4 uchars the problem reappeared.
>>>>
>>>> This suggests that this might be a compiler bug.
>>>>
>>>> There's been some discussion about this in the following threads:
>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
>>>> and we're not aware of any fix to the issue.
>>>
>>> Which prompted me to test --no-check-sections with CS 2009q1.
>>> Adding it to LDFLAGS_u-boot does reduce the annoyance from errors to
>>> a warning,
>>> but there is no way to completely make it disappear.
>>
>> So the conclusion is still a tool chain bug, right?
>> Probably it doesn't hurt besides the annoying warning.
>
> Sorry for being slow.
>
> Yes, it seems to be a toolchain bug and limited to a spurious warning.
> However, spurious warnings are always a pain when doing a MAKEALL arm,
> because the board is listed among the unclean and failed builds and then
> one must go through these individually and remember that this specific
> warning is both unimportant and unavoidable.

Have we gone and bugged any toolchain folks about what caused / fixed 
this problem so that perhaps we can option around it or otherwise squash 
this?

-- 
Tom

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-02-17 17:10                 ` Tom Rini
@ 2012-02-18 10:30                   ` Albert ARIBAUD
  0 siblings, 0 replies; 24+ messages in thread
From: Albert ARIBAUD @ 2012-02-18 10:30 UTC (permalink / raw)
  To: u-boot

Le 17/02/2012 18:10, Tom Rini a ?crit :
> On 02/17/2012 02:50 AM, Albert ARIBAUD wrote:
>> Hi Igor,
>>
>> Le 07/02/2012 09:01, Igor Grinberg a ?crit :
>>> Hi Albert,
>>>
>>> On 02/07/12 00:56, Albert ARIBAUD wrote:
>>>> Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
>>>>> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>>>>>> Dear Igor Grinberg,
>>>>>>
>>>>>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>>>>>> you wrote:
>>>>>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>>>>>
>>>>>>> Add board specific EEPROM handling module,
>>>>>>> read the serial number from the EEPROM and pass it to Linux.
>>>>>> ...
>>>>>>
>>>>>>> * Fix strange linker warning: ".bss section overlaps previous
>>>>>>> sections"
>>>>>>> by changing the type of the eeprom_layout static global variable
>>>>>>> to int
>>>>>>> (probably this is a compiler bug).
>>>>>> Probably it is now. Did you inspect the linke rmap?
>>>>>
>>>>> u-boot.map shows the bss section aligning perfectly with the start of
>>>>> rel.dyn.
>>>>>
>>>>> The difference between the original "working" version and the version
>>>>> with the warning
>>>>> was an additional byte added by uchar eeprom_layout to the size of
>>>>> libcm_t35.o.
>>>>> This shouldn't be a problem because the bss section is followed by an
>>>>> ALIGN(4), but
>>>>> we decided to try changing eeprom_layout to an int and the problem
>>>>> went
>>>>> away.
>>>>> When we tried to define 4 uchars the problem reappeared.
>>>>>
>>>>> This suggests that this might be a compiler bug.
>>>>>
>>>>> There's been some discussion about this in the following threads:
>>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
>>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
>>>>> and we're not aware of any fix to the issue.
>>>>
>>>> Which prompted me to test --no-check-sections with CS 2009q1.
>>>> Adding it to LDFLAGS_u-boot does reduce the annoyance from errors to
>>>> a warning,
>>>> but there is no way to completely make it disappear.
>>>
>>> So the conclusion is still a tool chain bug, right?
>>> Probably it doesn't hurt besides the annoying warning.
>>
>> Sorry for being slow.
>>
>> Yes, it seems to be a toolchain bug and limited to a spurious warning.
>> However, spurious warnings are always a pain when doing a MAKEALL arm,
>> because the board is listed among the unclean and failed builds and then
>> one must go through these individually and remember that this specific
>> warning is both unimportant and unavoidable.
>
> Have we gone and bugged any toolchain folks about what caused / fixed
> this problem so that perhaps we can option around it or otherwise squash
> this?

I haven't, as I work mostly with ELDK42 and occasionally recent (2010 
and later) CS and current Ubuntu-provided Linaro toolchains, and don't 
see the warning -- and I don't think toolchain providers will bother 
about warnings from old releases that do not still exist in current 
ones, just like we don't bother with issues present only in older 
version of U-Boot.

But if somebody on the list is using the current version of some 
toolchain that does emit this warning, then yes, they should indeed 
bring the issue to the toolchain provider, or at least raise their hand 
here.

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH v2 3/6] cm-t35: add EEPROM module and pass Linux a serial number
  2012-02-17  9:50               ` Albert ARIBAUD
  2012-02-17 17:10                 ` Tom Rini
@ 2012-02-21 13:44                 ` Igor Grinberg
  1 sibling, 0 replies; 24+ messages in thread
From: Igor Grinberg @ 2012-02-21 13:44 UTC (permalink / raw)
  To: u-boot

On 02/17/12 11:50, Albert ARIBAUD wrote:
> Hi Igor,
> 
> Le 07/02/2012 09:01, Igor Grinberg a ?crit :
>> Hi Albert,
>>
>> On 02/07/12 00:56, Albert ARIBAUD wrote:
>>> Le 09/01/2012 09:30, Nikita Kiryanov a ?crit :
>>>> On 01/05/2012 04:56 PM, Wolfgang Denk wrote:
>>>>> Dear Igor Grinberg,
>>>>>
>>>>> In message<1325764937-7342-1-git-send-email-grinberg@compulab.co.il>
>>>>> you wrote:
>>>>>> From: Nikita Kiryanov<nikita@compulab.co.il>
>>>>>>
>>>>>> Add board specific EEPROM handling module,
>>>>>> read the serial number from the EEPROM and pass it to Linux.
>>>>> ...
>>>>>
>>>>>> * Fix strange linker warning: ".bss section overlaps previous sections"
>>>>>> by changing the type of the eeprom_layout static global variable to int
>>>>>> (probably this is a compiler bug).
>>>>> Probably it is now. Did you inspect the linke rmap?
>>>>
>>>> u-boot.map shows the bss section aligning perfectly with the start of
>>>> rel.dyn.
>>>>
>>>> The difference between the original "working" version and the version
>>>> with the warning
>>>> was an additional byte added by uchar eeprom_layout to the size of
>>>> libcm_t35.o.
>>>> This shouldn't be a problem because the bss section is followed by an
>>>> ALIGN(4), but
>>>> we decided to try changing eeprom_layout to an int and the problem went
>>>> away.
>>>> When we tried to define 4 uchars the problem reappeared.
>>>>
>>>> This suggests that this might be a compiler bug.
>>>>
>>>> There's been some discussion about this in the following threads:
>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/114646
>>>> http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/90723
>>>> and we're not aware of any fix to the issue.
>>>
>>> Which prompted me to test --no-check-sections with CS 2009q1.
>>> Adding it to LDFLAGS_u-boot does reduce the annoyance from errors to a warning,
>>> but there is no way to completely make it disappear.
>>
>> So the conclusion is still a tool chain bug, right?
>> Probably it doesn't hurt besides the annoying warning.
> 
> Sorry for being slow.

This is fine, I was also out  for a week or so...

> 
> Yes, it seems to be a toolchain bug and limited to a spurious warning. However, spurious warnings are always a pain when doing a MAKEALL arm, because the board is listed among the unclean and failed builds and then one must go through these individually and remember that this specific warning is both unimportant and unavoidable.

That is exactly the reason why we tried (and succeeded) to workaround the issue...


-- 
Regards,
Igor.

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

end of thread, other threads:[~2012-02-21 13:44 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-02 14:01 [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 1/6] cm-t35: cleanup the config file Igor Grinberg
2012-01-03  6:35   ` Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 2/6] cm-t35: various cleanups Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 3/6] cm-t35: add EEPROM module and pass Linux a serial number Igor Grinberg
2012-01-03 14:52   ` Tom Rini
2012-01-05 12:02     ` [U-Boot] [PATCH v2 " Igor Grinberg
2012-01-05 14:56       ` Wolfgang Denk
2012-01-09  8:30         ` Nikita Kiryanov
2012-02-06 22:56           ` Albert ARIBAUD
2012-02-07  8:01             ` Igor Grinberg
2012-02-17  9:50               ` Albert ARIBAUD
2012-02-17 17:10                 ` Tom Rini
2012-02-18 10:30                   ` Albert ARIBAUD
2012-02-21 13:44                 ` Igor Grinberg
2012-01-12 13:26         ` [U-Boot] [PATCH v3 " Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 4/6] omap3: make get_board_rev() function weak Igor Grinberg
2012-01-03 14:36   ` Tom Rini
2012-01-05 12:03     ` [U-Boot] [PATCH v2 " Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 5/6] cm-t35: pass correct revision information to Linux Igor Grinberg
2012-01-02 14:01 ` [U-Boot] [PATCH 6/6] cm-t35: use the new EEPROM module to read the MAC address Igor Grinberg
2012-01-12 13:28   ` [U-Boot] [PATCH v2 " Igor Grinberg
2012-01-03 15:15 ` [U-Boot] [PATCH 0/6] Cleanups and updates for cm-t35/3730 Tom Rini
2012-01-13 17:21   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.