diff options
author | Nishanth Menon <nm@ti.com> | 2017-06-16 22:25:04 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-07-10 17:45:35 (GMT) |
commit | e936f997a956dbcd7ccd414770951f981fa586a1 (patch) | |
tree | 6703cc16bb15d3970044205090b2df63f97f2a13 /board/ti/common/board_detect.c | |
parent | a75df9aef0ac642cdaa654ee935a717d3484840d (diff) | |
download | u-boot-e936f997a956dbcd7ccd414770951f981fa586a1.tar.xz |
ti: common: board_detect: Allow settings board detection variables manually
In some situations the EEPROM used for board detection may not be
programmed or simply programmed incorrectly. Therefore, it may be
necessary to "simulate" reading the contents of the EEPROM to set
appropriate variables used in the board detection code.
This may also be helpful in certain boot modes where doing i2c reads
may be costly and the config supports running only a specific board.
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Franklin S Cooper Jr. <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board/ti/common/board_detect.c')
-rw-r--r-- | board/ti/common/board_detect.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 6fdcb61..bf594cb 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -173,6 +173,30 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, return 0; } +int __maybe_unused ti_i2c_eeprom_am_set(const char *name, const char *rev) +{ + struct ti_common_eeprom *ep; + + if (!name || !rev) + return -1; + + ep = TI_EEPROM_DATA; + if (ep->header == TI_EEPROM_HEADER_MAGIC) + goto already_set; + + /* Set to 0 all fields */ + memset(ep, 0, sizeof(*ep)); + strncpy(ep->name, name, TI_EEPROM_HDR_NAME_LEN); + strncpy(ep->version, rev, TI_EEPROM_HDR_REV_LEN); + /* Some dummy serial number to identify the platform */ + strncpy(ep->serial, "0000", TI_EEPROM_HDR_SERIAL_LEN); + /* Mark it with a valid header */ + ep->header = TI_EEPROM_HEADER_MAGIC; + +already_set: + return 0; +} + int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr) { int rc; |