From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lokesh Vutla Date: Wed, 6 Nov 2013 18:55:43 +0530 Subject: [U-Boot] [PATCH 05/14] ARM: AM43XX: board: add support for reading onboard EEPROM In-Reply-To: References: <1383625260-22294-1-git-send-email-lokeshvutla@ti.com> <1383625260-22294-6-git-send-email-lokeshvutla@ti.com> Message-ID: <527A4357.4010809@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday 06 November 2013 06:08 PM, Vaibhav Bedia wrote: > On Mon, Nov 4, 2013 at 11:20 PM, Lokesh Vutla wrote: >> From: Sekhar Nori >> >> Add support for reading onboard EEPROM to enable >> board detection. >> >> Signed-off-by: Sekhar Nori >> Signed-off-by: Lokesh Vutla >> --- >> arch/arm/include/asm/arch-am33xx/omap.h | 2 ++ >> board/ti/am43xx/board.c | 46 +++++++++++++++++++++++++++++++ >> board/ti/am43xx/board.h | 32 +++++++++++++++++++++ >> include/configs/am43xx_evm.h | 7 +++++ >> 4 files changed, 87 insertions(+) >> >> diff --git a/arch/arm/include/asm/arch-am33xx/omap.h b/arch/arm/include/asm/arch-am33xx/omap.h >> index 2250721..10f05c9 100644 >> --- a/arch/arm/include/asm/arch-am33xx/omap.h >> +++ b/arch/arm/include/asm/arch-am33xx/omap.h >> @@ -27,5 +27,7 @@ >> #define NON_SECURE_SRAM_START 0x402F0400 >> #define NON_SECURE_SRAM_END 0x40340000 >> #define SRAM_SCRATCH_SPACE_ADDR 0x4033C000 >> +#define AM4372_BOARD_NAME_START SRAM_SCRATCH_SPACE_ADDR >> +#define AM4372_BOARD_NAME_END SRAM_SCRATCH_SPACE_ADDR + 0xC >> #endif >> #endif >> diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c >> index dcd8cbb..4fc1a40 100644 >> --- a/board/ti/am43xx/board.c >> +++ b/board/ti/am43xx/board.c >> @@ -9,6 +9,8 @@ >> */ >> >> #include >> +#include >> +#include >> #include >> #include >> #include >> @@ -17,6 +19,50 @@ >> >> DECLARE_GLOBAL_DATA_PTR; >> >> +/* >> + * Read header information from EEPROM into global structure. >> + */ >> +static int read_eeprom(struct am43xx_board_id *header) >> +{ >> + /* Check if baseboard eeprom is available */ >> + if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) { >> + printf("Could not probe the EEPROM at 0x%x\n", >> + CONFIG_SYS_I2C_EEPROM_ADDR); >> + return -ENODEV; >> + } >> + >> + /* read the eeprom using i2c */ >> + if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header, >> + sizeof(struct am43xx_board_id))) { >> + printf("Could not read the EEPROM\n"); >> + return -EIO; >> + } >> + >> + if (header->magic != 0xEE3355AA) { > > Why is the header the same as AM335x? Shouldn't it be something > like 0xEE3344AA or whatever? No, the header is still same. It is 0xEE3355AA. Thanks and regards, Lokesh > >> + /* >> + * read the eeprom using i2c again, >> + * but use only a 1 byte address >> + */ >> + if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header, >> + sizeof(struct am43xx_board_id))) { >> + printf("Could not read the EEPROM at 0x%x\n", >> + CONFIG_SYS_I2C_EEPROM_ADDR); >> + return -EIO; >> + } >> + >> + if (header->magic != 0xEE3355AA) { > > Same here. > > Regards, > Vaibhav >