Skip to content

Instantly share code, notes, and snippets.

@RobertCNelson
Last active August 15, 2017 21:09
Show Gist options
  • Select an option

  • Save RobertCNelson/f38007e5c92d6e7b4181fa500b8e854b to your computer and use it in GitHub Desktop.

Select an option

Save RobertCNelson/f38007e5c92d6e7b4181fa500b8e854b to your computer and use it in GitHub Desktop.
am335x eeprom programming with u-boot
board_eeprom_header=bbbw_blank
eeprom_program=i2c dev 0; \
i2c md 0x50 0x00.2 20; \
i2c mw 0x50 0x00.2 aa; \
i2c mw 0x50 0x01.2 55; \
i2c mw 0x50 0x02.2 33; \
i2c mw 0x50 0x03.2 ee; \
i2c mw 0x50 0x04.2 41; \
i2c mw 0x50 0x05.2 33; \
i2c mw 0x50 0x06.2 33; \
i2c mw 0x50 0x07.2 35; \
i2c mw 0x50 0x08.2 42; \
i2c mw 0x50 0x09.2 4e; \
i2c mw 0x50 0x0a.2 4c; \
i2c mw 0x50 0x0b.2 54; \
i2c md 0x50 0x00.2 20; \
reset ;
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ff8e1c590d..96ec0b2776 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -90,6 +90,7 @@
"if test ${boot_fit} -eq 1; then " \
"run update_to_fit;" \
"fi;" \
+ "run eeprom_program; " \
"run findfdt; " \
"run init_console; " \
"run envboot; " \
@@ -108,6 +109,7 @@
"bootpart=0:2\0" \
"bootdir=/boot\0" \
"bootfile=zImage\0" \
+ "board_eeprom_header=undefined\0" \
"fdtfile=undefined\0" \
"console=ttyO0,115200n8\0" \
"partitions=" \
@@ -138,6 +140,13 @@
"ramboot=echo Booting from ramdisk ...; " \
"run ramargs; " \
"bootz ${loadaddr} ${rdaddr} ${fdtaddr}\0" \
+ "eeprom_program="\
+ "if test $board_eeprom_header = bbb_blank; then " \
+ "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_dump; reset; fi; " \
+ "if test $board_eeprom_header = bbbl_blank; then " \
+ "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_bbbl_footer; run eeprom_dump; reset; fi; " \
+ "if test $board_eeprom_header = bbbw_blank; then " \
+ "run eeprom_dump; run eeprom_blank; run eeprom_bbb_header; run eeprom_bbbw_footer; run eeprom_dump; reset; fi; \0" \
"findfdt="\
"echo board_name=[$board_name] ...; " \
"if test $board_name = A335BONE; then " \
@@ -167,6 +176,12 @@
"fi; " \
"fi; " \
"if test $board_name = A335BLNK; then " \
+ "if test -e mmc 0:1 /boot/.eeprom.txt; then " \
+ "load mmc 0:1 ${loadaddr} /boot/.eeprom.txt;" \
+ "env import -t ${loadaddr} ${filesize};" \
+ "echo Loaded environment from /boot/.eeprom.txt;" \
+ "run eeprom_program; " \
+ "fi;" \
"setenv fdtfile am335x-boneblack-emmc-overlay.dtb; setenv fdtbase am335x-boneblack-emmc-overlay; fi; " \
"if test $board_name = BBBW; then " \
"setenv fdtfile am335x-boneblack-wireless.dtb; setenv fdtbase am335x-boneblack-wireless; fi; " \
@@ -199,6 +214,7 @@
EEWIKI_NFS \
EEWIKI_BOOT \
EEWIKI_UNAME_BOOT \
+ EEPROM_PROGRAMMING \
NANDARGS \
NETARGS \
DFUARGS \
diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h
index ab88befd48..a6850f1cd2 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -132,6 +132,72 @@
/* Boot Argument Buffer Size */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
+#define EEPROM_PROGRAMMING \
+ "eeprom_dump=i2c dev 0; " \
+ "i2c md 0x50 0x00.2 20; " \
+ "\0" \
+ "eeprom_blank=i2c dev 0; " \
+ "i2c mw 0x50 0x00.2 ff; " \
+ "i2c mw 0x50 0x01.2 ff; " \
+ "i2c mw 0x50 0x02.2 ff; " \
+ "i2c mw 0x50 0x03.2 ff; " \
+ "i2c mw 0x50 0x04.2 ff; " \
+ "i2c mw 0x50 0x05.2 ff; " \
+ "i2c mw 0x50 0x06.2 ff; " \
+ "i2c mw 0x50 0x07.2 ff; " \
+ "i2c mw 0x50 0x08.2 ff; " \
+ "i2c mw 0x50 0x09.2 ff; " \
+ "i2c mw 0x50 0x0a.2 ff; " \
+ "i2c mw 0x50 0x0b.2 ff; " \
+ "i2c mw 0x50 0x0c.2 ff; " \
+ "i2c mw 0x50 0x0d.2 ff; " \
+ "i2c mw 0x50 0x0e.2 ff; " \
+ "i2c mw 0x50 0x0f.2 ff; " \
+ "i2c mw 0x50 0x10.2 ff; " \
+ "i2c mw 0x50 0x11.2 ff; " \
+ "i2c mw 0x50 0x12.2 ff; " \
+ "i2c mw 0x50 0x13.2 ff; " \
+ "i2c mw 0x50 0x14.2 ff; " \
+ "i2c mw 0x50 0x15.2 ff; " \
+ "i2c mw 0x50 0x16.2 ff; " \
+ "i2c mw 0x50 0x17.2 ff; " \
+ "i2c mw 0x50 0x18.2 ff; " \
+ "i2c mw 0x50 0x19.2 ff; " \
+ "i2c mw 0x50 0x1a.2 ff; " \
+ "i2c mw 0x50 0x1b.2 ff; " \
+ "i2c mw 0x50 0x1c.2 ff; " \
+ "i2c mw 0x50 0x1d.2 ff; " \
+ "i2c mw 0x50 0x1e.2 ff; " \
+ "i2c mw 0x50 0x1f.2 ff; " \
+ "\0" \
+ "eeprom_bbb_header=i2c dev 0; " \
+ "i2c mw 0x50 0x00.2 aa; " \
+ "i2c mw 0x50 0x01.2 55; " \
+ "i2c mw 0x50 0x02.2 33; " \
+ "i2c mw 0x50 0x03.2 ee; " \
+ "i2c mw 0x50 0x04.2 41; " \
+ "i2c mw 0x50 0x05.2 33; " \
+ "i2c mw 0x50 0x06.2 33; " \
+ "i2c mw 0x50 0x07.2 35; " \
+ "i2c mw 0x50 0x08.2 42; " \
+ "i2c mw 0x50 0x09.2 4e; " \
+ "i2c mw 0x50 0x0a.2 4c; " \
+ "i2c mw 0x50 0x0b.2 54; " \
+ "\0" \
+ "eeprom_bbbw_footer= " \
+ "i2c mw 0x50 0x0c.2 42; " \
+ "i2c mw 0x50 0x0d.2 57; " \
+ "i2c mw 0x50 0x0e.2 41; " \
+ "i2c mw 0x50 0x0f.2 35; " \
+ "\0" \
+ "eeprom_bbbl_footer= " \
+ "i2c mw 0x50 0x0c.2 42; " \
+ "i2c mw 0x50 0x0d.2 4c; " \
+ "i2c mw 0x50 0x0e.2 41; " \
+ "i2c mw 0x50 0x0f.2 32; " \
+ "\0" \
+
+
#define EEWIKI_NFS \
"server_ip=192.168.1.100\0" \
"gw_ip=192.168.1.1\0" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment