Custom BBB Black board with blank EEPROM

17 views
Skip to first unread message

Rich_d

unread,
May 14, 2020, 7:57:33 AM5/14/20
to BeagleBoard
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

Richard Day

unread,
May 14, 2020, 12:17:15 PM5/14/20
to beagl...@googlegroups.com
Hi,
its fine - nailed it !

Index: git/board/ti/am335x/board.h
===================================================================
--- git.orig/board/ti/am335x/board.h
+++ git/board/ti/am335x/board.h
@@ -30,7 +30,10 @@ static inline int board_is_bone(void)
 
 static inline int board_is_bone_lt(void)
 {
- return board_ti_is("A335BNLT");
+/* return board_ti_is("A335BNLT");  board is Beaglebone Black */
+ puts ("\nFound board - setting up \n");

+ return ti_i2c_eeprom_am_set("A335BNLT", "00C0");
+
 }
 
 static inline int board_is_pb(void)
@@ -50,8 +53,9 @@ static inline int board_is_bben(void)
 
 static inline int board_is_beaglebonex(void)
 {
- return board_is_pb() || board_is_bone() || board_is_bone_lt() ||
-       board_is_bbg1() || board_is_bben();
+ /* return board_is_pb() || board_is_bone() || board_is_bone_lt() ||
+           board_is_bbg1() || board_is_bben(); */
+ return 1;
 }
 
 static inline int board_is_evm_sk(void)
Index: git/board/ti/common/board_detect.c
===================================================================
--- git.orig/board/ti/common/board_detect.c
+++ git/board/ti/common/board_detect.c
@@ -172,10 +172,11 @@ int __maybe_unused ti_i2c_eeprom_am_set(
 {
  struct ti_common_eeprom *ep;
 
- if (!name || !rev)
- return -1;
+/* if (!name || !rev)
+ return -1; */

 
  ep = TI_EEPROM_DATA;
+
  if (ep->header == TI_EEPROM_HEADER_MAGIC)
  goto already_set;
 
@@ -189,7 +190,7 @@ int __maybe_unused ti_i2c_eeprom_am_set(
  ep->header = TI_EEPROM_HEADER_MAGIC;
 
 already_set:
- return 0;
+ return 1;
 }
 
 int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr)

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/3d6e4e2e-a50d-488e-9e50-31a0bc0ff25c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages