mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
c8ce7ba87d
This adds support for "nvmem cells" as seen in Linux. The nvmem device class in Linux is used for various assorted ROMs and EEPROMs. In this sense, it is similar to UCLASS_MISC, but also includes UCLASS_I2C_EEPROM, UCLASS_RTC, and UCLASS_MTD. New drivers corresponding to a Linux-style nvmem device should be implemented as one of the previously-mentioned uclasses. The nvmem API acts as a compatibility layer to adapt the (slightly different) APIs of these uclasses. It also handles the lookup of nvmem cells. While nvmem devices can be accessed directly, they are most often used by reading/writing contiguous values called "cells". Cells typically hold information like calibration, versions, or configuration (such as mac addresses). nvmem devices can specify "cells" in their device tree: qfprom: eeprom@700000 { #address-cells = <1>; #size-cells = <1>; reg = <0x00700000 0x100000>; /* ... */ tsens_calibration: calib@404 { reg = <0x404 0x10>; }; }; which can then be referenced like: tsens { /* ... */ nvmem-cells = <&tsens_calibration>; nvmem-cell-names = "calibration"; }; The tsens driver could then read the calibration value like: struct nvmem_cell cal_cell; u8 cal[16]; nvmem_cell_get_by_name(dev, "calibration", &cal_cell); nvmem_cell_read(&cal_cell, cal, sizeof(cal)); Because nvmem devices are not all of the same uclass, supported uclasses must register a nvmem_interface struct. This allows CONFIG_NVMEM to be enabled without depending on specific uclasses. At the moment, nvmem_interface is very bare-bones, and assumes that no initialization is necessary. However, this could be amended in the future. Although I2C_EEPROM and MISC are quite similar (and could likely be unified), they present different read/write function signatures. To abstract over this, NVMEM uses the same read/write signature as Linux. In particular, short read/writes are not allowed, which is allowed by MISC. The functionality implemented by nvmem cells is very similar to that provided by i2c_eeprom_partition. "fixed-partition"s for eeproms does not seem to have made its way into Linux or into any device tree other than sandbox. It is possible that with the introduction of this API it would be possible to remove it. Signed-off-by: Sean Anderson <sean.anderson@seco.com> |
||
---|---|---|
.. | ||
imx8 | ||
imx8ulp | ||
ali512x.c | ||
altera_sysid.c | ||
atsha204a-i2c.c | ||
cbmem_console.c | ||
cros_ec.c | ||
cros_ec_i2c.c | ||
cros_ec_lpc.c | ||
cros_ec_sandbox.c | ||
cros_ec_spi.c | ||
ds4510.c | ||
ds4510.h | ||
esm_pmic.c | ||
fs_loader.c | ||
fsl_devdis.c | ||
fsl_ifc.c | ||
fsl_iim.c | ||
fsl_portals.c | ||
fsl_sec_mon.c | ||
gdsys_ioep.c | ||
gdsys_ioep.h | ||
gdsys_rxaui_ctrl.c | ||
gdsys_soc.c | ||
gdsys_soc.h | ||
gpio_led.c | ||
gsc.c | ||
i2c_eeprom.c | ||
i2c_eeprom_emul.c | ||
ihs_fpga.c | ||
ihs_fpga.h | ||
irq-uclass.c | ||
irq_sandbox.c | ||
irq_sandbox_test.c | ||
jz4780_efuse.c | ||
k3_avs.c | ||
k3_esm.c | ||
Kconfig | ||
Makefile | ||
mc9sdz60.c | ||
microchip_flexcom.c | ||
misc-uclass.c | ||
misc_sandbox.c | ||
mpc83xx_serdes.c | ||
mpc83xx_serdes.h | ||
mxc_ocotp.c | ||
mxs_ocotp.c | ||
nuvoton_nct6102d.c | ||
nvmem.c | ||
p2sb-uclass.c | ||
p2sb_emul.c | ||
p2sb_sandbox.c | ||
pca9551_led.c | ||
pwrseq-uclass.c | ||
qfw.c | ||
qfw_mmio.c | ||
qfw_pio.c | ||
qfw_sandbox.c | ||
rockchip-efuse.c | ||
rockchip-otp.c | ||
sandbox_adder.c | ||
sifive-otp.c | ||
sl28cpld.c | ||
smsc_lpc47m.c | ||
smsc_sio1007.c | ||
spltest_sandbox.c | ||
status_led.c | ||
stm32_rcc.c | ||
stm32mp_fuse.c | ||
swap_case.c | ||
syscon_sandbox.c | ||
tegra186_bpmp.c | ||
tegra_car.c | ||
test_drv.c | ||
twl4030_led.c | ||
vexpress_config.c | ||
winbond_w83627.c |