Hi,
I have made a custom Beaglebone black board to go in a medical product I am designing. Its been silly-fiddly to get this up and running. 1) the SD card socket I sourced has the card-in switch inverted. This bit was easy to fix. 2) The EEPROM is blank and I understand I forgot to remove the write protect [school boy error] so they way forward is to just bypass the detection and make a patch to hard-wire the code for Beaglebone black or green.
Right now all I get is a single character on boot, which appears to be a ASCII 3 or ETX (end of text)
There was a patch for this for the old linux (around version 3), but I am migrating to the Wind River linux version 5.4.33 (or LTS10) which is a really nice version.
It did work, but I dont see why as it appears to put a pair of strings into a numeric return value.
Is there a newer reference anywhere for bypassing the EEPROM ? , as I can only find a really old one that doesnt work well.
Much appreciated.
Cheers
Richard
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 56f4984..e5f953e 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -57,7 +57,8 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
*/
static inline int __maybe_unused read_eeprom(void)
{
- return ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR);
+ puts ("\nUse hard coded Board Name and Revision in case the EEPROM is not programmed.\n");
+ return ti_i2c_eeprom_am_set("A335BNLT", "00C0");
}
#ifndef CONFIG_DM_SERIAL
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -160,6 +160,30 @@ already_read:
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_dra7_get(int bus_addr, int dev_addr)
{
int rc, offset = 0;
--- a/board/ti/common/board_detect.h
+++ b/board/ti/common/board_detect.h
@@ -111,6 +111,24 @@ struct ti_common_eeprom {
int ti_i2c_eeprom_am_get(int bus_addr, int dev_addr);
/**
+ * ti_i2c_eeprom_am_set() - Setup the eeprom data with predefined values
+ * @name: Name of the board
+ * @rev: Revision of the board
+ *
+ * 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.
+ * For those platforms, provide a handy function to pre-program information.
+ *
+ * NOTE: many eeprom information such as serial number, mac address etc is not
+ * available.
+ *
+ * Return: 0 if all went fine, else return error.
+ */
+int ti_i2c_eeprom_am_set(const char *name, const char *rev);
+
+/**
* ti_i2c_eeprom_dra7_get() - Consolidated eeprom data for DRA7 TI EVMs
* @bus_addr: I2C bus address
* @dev_addr: I2C slave address