[PATCH v4 00/16] Add support for NVMEM API
Sean Anderson
sean.anderson at seco.com
Thu May 5 19:11:29 CEST 2022
This adds support for the nvmem-cells properties cropping up in manyb
device trees. This is an easy way to load configuration, version
information, or calibration data from a non-volatile memory source. For
more information, refer to patch 6 ("misc: Add support for nvmem
cells").
For the moment I have only added some integration tests using the
ethernet addresses. This hits the main code paths (looking up nvmem
cells) but doesn't test writing. I can add a few stand-alone tests if
desired.
CI: https://dev.azure.com/u-boot/u-boot/_build/results?buildId=4167&view=results
The patches are structured in the following manner:
1-9: These are general cleanups, and may be applied independently of
the rest of the series.
10-12: Add NVMEM support
13-15: Support reading ethernet addresses using the NVMEM API and add
some tests.
16: Example demonstrating how this series could be reworked to be a
uclass. It should not be applied.
Changes in v4:
- Fix dm_test_alias_highest_id test failing because we changed the
number of aliases
- Fix segmentation fault if DSA master fails to probe
- Add fallbacks for i2c_eeprom_* functions. This fixes build errors if
CONFIG_I2C_EEPROM was not enabled.
- Fix failing to find nvmem devices if some supported uclasses were not
enabled.
- Remove typedefs from documentation
- Document some of the design background, and why a new uclass was not
created.
- Enable CONFIG_NVMEM for sandbox_spl_defconfig
- Enable CONFIG_I2C_EEPROM for sandbox_spl_defconfig
- Add RFC patch illustrating how this series could be reworked to use a
more conventional, uclass-based approach.
Changes in v3:
- Add aliases for ethernet devices
- Add mac address for eth8 to environment
- Move patch adding test earlier in the series
- Add test for eth8 as well
Changes in v2:
- Call the appropriate API functions directly from
nvmem_cell_(read|write). This means we can drop the nvmem_interface
machinery.
Sean Anderson (16):
sandbox: net: Add aliases for ethernet devices
sandbox: net: Add mac address for eth8 to environment
test: eth: Add test for ethernet addresses
sandbox: net: Remove fake-host-hwaddr
sandbox: Remove eth2addr from environment
sandbox: Move some mac addresses to device tree
net: dsa: Fix segmentation fault if master fails to probe
misc: i2c_eeprom: Make i2c_eeprom_write use a const buf
misc: i2c_eeprom: Add fallbacks
misc: Add support for nvmem cells
sandbox: Enable NVMEM
net: Add support for reading mac addresses from nvmem cells
test: Load mac address with i2c eeprom
test: Load mac address using RTC
test: Load mac address using misc device
[RFC] misc: nvmem: Convert to using udevices
MAINTAINERS | 7 ++
arch/sandbox/dts/sandbox.dts | 1 -
arch/sandbox/dts/sandbox64.dts | 1 -
arch/sandbox/dts/test.dts | 34 +++++-
board/sandbox/sandbox.env | 4 -
configs/sandbox64_defconfig | 1 +
configs/sandbox_defconfig | 1 +
configs/sandbox_flattree_defconfig | 1 +
configs/sandbox_noinst_defconfig | 1 +
configs/sandbox_spl_defconfig | 3 +
doc/api/index.rst | 1 +
doc/api/nvmem.rst | 7 ++
drivers/misc/Kconfig | 16 +++
drivers/misc/Makefile | 1 +
drivers/misc/i2c_eeprom.c | 40 ++++++-
drivers/misc/i2c_eeprom_emul.c | 4 +
drivers/misc/misc-uclass.c | 58 ++++++++-
drivers/misc/misc_sandbox.c | 3 +
drivers/misc/nvmem.c | 106 +++++++++++++++++
drivers/net/sandbox.c | 10 +-
drivers/rtc/i2c_rtc_emul.c | 10 ++
drivers/rtc/rtc-uclass.c | 46 ++++++-
include/dm/uclass-id.h | 1 +
include/i2c_eeprom.h | 27 ++++-
include/nvmem.h | 185 +++++++++++++++++++++++++++++
net/dsa-uclass.c | 6 +-
net/eth-uclass.c | 13 +-
test/dm/eth.c | 29 +++++
test/dm/test-fdt.c | 2 +-
29 files changed, 584 insertions(+), 35 deletions(-)
create mode 100644 doc/api/nvmem.rst
create mode 100644 drivers/misc/nvmem.c
create mode 100644 include/nvmem.h
--
2.35.1.1320.gc452695387.dirty
More information about the U-Boot
mailing list