This series introduces eeprom layout aware capabilities to the existing eeprom command, and then enables this feature on Compulab boards. It is an import of the Compulab eeprom-utility (https://github.com/compulab/eeprom-util), and it introduces 2 new options to the eeprom command:
eeprom print [-l <layout_version>] bus_num device_addr eeprom update [-l <layout_version>] bus_num device_addr <field_name> <field_value> The series starts with importing the code in a way that is very separated from the existing eeprom command code (it uses its own parsing function and its own command execution code, but does reuse the eeprom_read and eeprom_write functions), then activates the feature for all Compulab boards, and finally merges the layout aware code with the layout unaware code so that there is one parsing function, and one command execution function. Features: - print EEPROM layout in a human readable way (field names and formatted data) - update EEPROM data by specifying the field name and the new data in a human readable format (same format as shown by the print command) - Layout can be either auto detected, or manually selected with the -l option - Completely optional and backwards compatible with current eeprom command Tested on cm-t43 and cm-fx6. Final result compile tested on arm. Example of use: CM-T43 # eeprom print 0 0x50 Major Revision 1.04 Minor Revision 0.00 1st MAC Address 01:02:03:04:05:06 2nd MAC Address ff:ff:ff:ff:ff:ff Production Date 01/Jan/2016 Serial Number 0000000000000005a0387754 3rd MAC Address (WIFI) ff:ff:ff:ff:ff:ff 4th MAC Address (Bluetooth) ff:ff:ff:ff:ff:ff Layout Version 02 Reserved fields (83 bytes) Product Name CM-T43 Product Options #1 C1000M-D1G-N4G- Product Options #2 E2-A-WB Product Options #3 Reserved fields (64 bytes) CM-T43 # eeprom update 0 0x50 "Major Revision" 2.30 CM-T43 # eeprom update 0 0x50 "Product Name" CM-T54 CM-T43 # eeprom update 0 0x50 "Productuction Date" 10/Feb/2017 No such field 'Productuction Date' CM-T43 # eeprom update 0 0x50 "Production Date" 10/Feb/2017 CM-T43 # eeprom print 0 0x50 Major Revision 2.30 Minor Revision 0.00 1st MAC Address 01:02:03:04:05:06 2nd MAC Address ff:ff:ff:ff:ff:ff Production Date 10/Feb/2017 Serial Number 0000000000000005a0387754 3rd MAC Address (WIFI) ff:ff:ff:ff:ff:ff 4th MAC Address (Bluetooth) ff:ff:ff:ff:ff:ff Layout Version 02 Reserved fields (83 bytes) Product Name CM-T54 Product Options #1 C1000M-D1G-N4G- Product Options #2 E2-A-WB Product Options #3 Reserved fields (64 bytes) CM-T43 # eeprom print -l legacy 0 0x50 MAC address e6:00:ff:ff:01:02 Board Revision 0304 Serial Number 0506ffffffffffff Board Configuration �Tw8� Reserved fields (176 bytes) CM-T43 # Cc: Heiko Schocher <h...@denx.de> Cc: Marek Vasut <ma...@denx.de> Cc: Simon Glass <s...@chromium.org> Cc: Igor Grinberg <grinb...@compulab.co.il> Cc: Tom Rini <tr...@konsulko.com> Nikita Kiryanov (12): cmd: eeprom: add bus switching support for all i2c drivers cmd: eeprom: add support for layout aware commands compulab: add support for layout aware eeprom commands arm: cm-fx6: add support for eeprom layout comands arm: cm-t335: add support for eeprom layout comands arm: cm-t54: add support for eeprom layout comands arm: cm-t3517: add support for eeprom layout comands arm: cm-t35: add support for eeprom layout comands arm: cm-t43: add support for eeprom layout comands eeprom: refactor i2c bus and devaddr parsing eeprom: use eeprom_execute_command for all eeprom functions eeprom: merge cmdline parsing of eeprom commands README | 1 + board/compulab/common/eeprom.c | 344 +++++++++++++++++++++++++++++++++++++++++ cmd/eeprom.c | 251 +++++++++++++++++++++++++----- common/Makefile | 3 + common/eeprom/eeprom_field.c | 250 ++++++++++++++++++++++++++++++ common/eeprom/eeprom_layout.c | 125 +++++++++++++++ include/configs/cm_fx6.h | 11 ++ include/configs/cm_t335.h | 11 ++ include/configs/cm_t35.h | 11 ++ include/configs/cm_t3517.h | 11 ++ include/configs/cm_t43.h | 11 ++ include/configs/cm_t54.h | 11 ++ include/eeprom_field.h | 39 +++++ include/eeprom_layout.h | 33 ++++ 14 files changed, 1077 insertions(+), 35 deletions(-) create mode 100644 common/eeprom/eeprom_field.c create mode 100644 common/eeprom/eeprom_layout.c create mode 100644 include/eeprom_field.h create mode 100644 include/eeprom_layout.h -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot