Skip to content

split tlv_eeprom command into a separate library

Josua Mayer u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12cmd: tlv_eeprom: remove use of global variable current_devcmd/tlv_eeprom.c include/tlv_eeprom.h+27 -262 replies
2/12cmd: tlv_eeprom: remove use of global variable has_been_readcmd/tlv_eeprom.c+12 -131 reply
3/12cmd: tlv_eeprom: do_tlv_eeprom: stop using non-api read_eeprom functioncmd/tlv_eeprom.c+2 -21 reply
4/12cmd: tlv_eeprom: convert functions used by command to api functionscmd/tlv_eeprom.c include/tlv_eeprom.h+76 -375 replies
5/12cmd: tlv_eeprom: remove empty function implementations from headerinclude/tlv_eeprom.h+2 -220 replies
6/12cmd: tlv_eeprom: move missing declarations and defines to headercmd/tlv_eeprom.c include/tlv_eeprom.h+54 -340 replies
7/12cmd: tlv_eeprom: hide access to static tlv_devices array behind accessorcmd/tlv_eeprom.c include/tlv_eeprom.h+17 -20 replies
8/12cmd: tlv_eeprom: clean up two defines for one thingcmd/tlv_eeprom.c+5 -70 replies
9/12cmd: tlv_eeprom: add my copyrightcmd/tlv_eeprom.c+1 -00 replies
10/12cmd: tlv_eeprom: split off tlv library from commandcmd/Kconfig cmd/tlv_eeprom.c lib/Kconfig +4 more+786 -7320 replies
11/12arm: mvebu: clearfog: enable tlv library for spl in favour of eeprom cmdconfigs/clearfog_defconfig+2 -10 replies
12/12lib: tlv_eeprom: add function for reading one entry into a C stringinclude/tlv_eeprom.h lib/tlv/tlv_eeprom.c+37 -00 replies

Reviews trailers per patch

3 of 12 patches have a Reviewed-by or Acked-by.

PatchStefan Roese
1/12R-b
2/12R-b
3/12R-b
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/12] split tlv_eeprom command into a separate library

The tlv_eeprom command provides much more than just a cli command:
- de- and encoding tlv format
- for reading and writing eeprom
- setting the eth?addr environment variable
- setting the serial# environment variable

One device (Clearfog) is already using the decoding functionality to choose the correct memory size based on eeprom data.

This patchset massages the implementation in many places removing stateful behaviour and global variables as much as possible and changing some functions to be usable as a library.
Then finally everything but the handling of the cli command is split off into a separate tlv library that can be used independently from the command.

SolidRun is starting to flash more devices with tlv data at the factory, and we plan to use this information for device identification purposes in future board files. This refactoring will make those implementations easier and reduce the amount of duplicate code to carry around.

Josua Mayer (12):
cmd: tlv_eeprom: remove use of global variable current_dev
cmd: tlv_eeprom: remove use of global variable has_been_read
cmd: tlv_eeprom: do_tlv_eeprom: stop using non-api read_eeprom
function
cmd: tlv_eeprom: convert functions used by command to api functions
cmd: tlv_eeprom: remove empty function implementations from header
cmd: tlv_eeprom: move missing declarations and defines to header
cmd: tlv_eeprom: hide access to static tlv_devices array behind
accessor
cmd: tlv_eeprom: clean up two defines for one thing
cmd: tlv_eeprom: add my copyright
cmd: tlv_eeprom: split off tlv library from command
arm: mvebu: clearfog: enable tlv library for spl in favour of eeprom
cmd
lib: tlv_eeprom: add function for reading one entry into a C string

 cmd/Kconfig                |   2 +
 cmd/tlv_eeprom.c           | 817 ++-----------------------------------
 configs/clearfog_defconfig |   3 +-
 include/tlv_eeprom.h       | 122 +++++-
 lib/Kconfig                |   2 +
 lib/Makefile               |   2 +
 lib/tlv/Kconfig            |  15 +
 lib/tlv/Makefile           |   5 +
 lib/tlv/tlv_eeprom.c       | 775 +++++++++++++++++++++++++++++++++++
 9 files changed, 944 insertions(+), 799 deletions(-)
 create mode 100644 lib/tlv/Kconfig
 create mode 100644 lib/tlv/Makefile
 create mode 100644 lib/tlv/tlv_eeprom.c
Cc Jon Nettleton <[email protected]>
Signature · 1 line
2.34.1