summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2016-12-01 10:37:03 +0100
committerTom Rini <trini@konsulko.com>2016-12-05 11:04:40 -0500
commita3a23c97b624fd580a9c5cda3f902af1fc17c801 (patch)
treeeed660aaab1fda357340ace59e8ba638fe5c2327 /board
parent1a92541d9c5341c6cdf6f713b056c30c1e06a325 (diff)
downloadu-boot-imx-a3a23c97b624fd580a9c5cda3f902af1fc17c801.zip
u-boot-imx-a3a23c97b624fd580a9c5cda3f902af1fc17c801.tar.gz
u-boot-imx-a3a23c97b624fd580a9c5cda3f902af1fc17c801.tar.bz2
ARM: DRA7: AMxx: Make sure that the SPL always reads the configuration EEPROM
The bootrom may corrupt the area of SRAM used to store the ti_common_eeprom structure. This patch makes sure that it's always read after a reset, even if a valid MAGIC number is found in the SRAM. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board')
-rw-r--r--board/ti/common/board_detect.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 6e7ca91..a5dba94 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -123,8 +123,10 @@ int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr)
struct ti_common_eeprom *ep;
ep = TI_EEPROM_DATA;
+#ifndef CONFIG_SPL_BUILD
if (ep->header == TI_EEPROM_HEADER_MAGIC)
- goto already_read;
+ return 0; /* EEPROM has already been read */
+#endif
/* Initialize with a known bad marker for i2c fails.. */
ep->header = TI_DEAD_EEPROM_MAGIC;
@@ -157,7 +159,6 @@ int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr)
memcpy(ep->mac_addr, am_ep.mac_addr,
TI_EEPROM_HDR_NO_OF_MAC_ADDR * TI_EEPROM_HDR_ETH_ALEN);
-already_read:
return 0;
}
@@ -168,8 +169,10 @@ int __maybe_unused ti_i2c_eeprom_dra7_get(int bus_addr, int dev_addr)
struct ti_common_eeprom *ep;
ep = TI_EEPROM_DATA;
+#ifndef CONFIG_SPL_BUILD
if (ep->header == DRA7_EEPROM_HEADER_MAGIC)
- goto already_read;
+ return 0; /* EEPROM has already been read */
+#endif
/* Initialize with a known bad marker for i2c fails.. */
ep->header = TI_DEAD_EEPROM_MAGIC;
@@ -202,7 +205,6 @@ int __maybe_unused ti_i2c_eeprom_dra7_get(int bus_addr, int dev_addr)
strlcpy(ep->config, dra7_ep.config, TI_EEPROM_HDR_CONFIG_LEN + 1);
ti_eeprom_string_cleanup(ep->config);
-already_read:
return 0;
}