u-boot/drivers
Sean Anderson c8ce7ba87d misc: Add support for nvmem cells
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>
2022-06-08 14:00:22 -04:00
..
adc adc: meson-saradc: add AXG variant 2022-04-25 09:25:00 +02:00
ata pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
axi WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
bios_emulator pci: Update dm_pci_bus_to_virt() parameters 2022-05-03 18:33:29 -04:00
block vpl: Add Kconfig options for VPL 2022-05-02 09:58:13 -04:00
bootcount Prepare v2022.04-rc5 2022-03-28 12:36:49 -04:00
bus bus: ti-sysc: change in a normal driver 2021-03-22 19:23:27 +13:00
button button: adc: set state to pressed when the voltage is closest to nominal 2022-02-11 09:00:47 -05:00
cache cache: sifive: Fix -Wint-to-pointer-cast warning 2021-10-20 10:59:09 +08:00
clk clk: sunxi: add and use dummy gate clocks 2022-05-24 01:16:15 +01:00
core dm: core: convert of_machine_is_compatible to livetree 2022-06-06 18:01:21 -04:00
cpu cpu: 83xx: Add missing dependency on CPU_MPC83XX 2022-04-26 17:18:39 +05:30
crypto crypto/fsl: fsl_hash: Fix dcache issue in caam_hash_finish 2022-05-20 12:36:47 +02:00
ddr Convert CONFIG_SPL_COMMON_INIT_DDR to Kconfig 2022-06-06 12:09:12 -04:00
demo demo: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
dfu DFU: Check the number of arguments and argument string strictly 2022-02-11 11:29:23 -05:00
dma dma: bcm6348: Don't check clk_free 2022-03-30 13:02:55 -04:00
fastboot fastboot: only look up real partition names when no alias exists 2022-01-28 11:30:39 -05:00
firmware firmware: firmware-zynqmp: Add zynqmp_pm_set_gem_config api 2022-04-05 15:13:13 +02:00
fpga arm: socfpga: arria10: Enable double peripheral RBF configuration 2021-12-17 12:58:01 +08:00
gpio gpio: rgpio2p: Enhance reading of GPIO pin value 2022-05-23 11:37:58 +02:00
hwspinlock treewide: invaild -> invalid 2022-01-13 07:57:49 -05:00
i2c i2c: ihs: intel: Fix typo in comments (actual) 2022-05-10 06:47:13 +02:00
input input: apple: Add support for Apple SPI keyboard 2022-02-10 16:44:23 -05:00
iommu iommu: Add M1 Pro/Max support to Apple DART driver 2022-02-21 08:35:40 -05:00
led led: Drop led_default_state() 2022-04-28 09:26:44 -04:00
mailbox mailbox: apple: Add driver for Apple IOP mailbox 2022-02-10 16:44:23 -05:00
memory keystone2: Move CONFIG_AEMIF_CNTRL_BASE out of CONFIG namespace 2021-09-27 21:38:34 -04:00
misc misc: Add support for nvmem cells 2022-06-08 14:00:22 -04:00
mmc Convert CONFIG_FIXED_SDHCI_ALIGNED_BUFFER to Kconfig 2022-06-06 12:09:29 -04:00
mtd mtd: mtdpart: Change size type from fdt_addr_t to fdt_size_t 2022-06-06 17:47:17 -04:00
mux treewide: invaild -> invalid 2022-01-13 07:57:49 -05:00
net sandbox: net: Remove fake-host-hwaddr 2022-06-08 13:59:52 -04:00
nvme pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
pch treewide: Simply conditions with the new OF_REAL 2021-09-25 09:46:15 -06:00
pci pci: Handle failed calloc in decode_regions() 2022-06-06 18:01:21 -04:00
pci_endpoint dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
phy phy: zynqmp: Increase timeout value to 10ms 2022-05-18 13:17:54 +02:00
pinctrl pinctrl: probe pinctrl drivers during post-bind 2022-05-17 06:44:06 +02:00
power pmic: pca9450: Add regulator driver 2022-05-20 12:36:48 +02:00
pwm driver: pwm: pwm-imx: separe dm from non dm implementation 2022-04-12 19:10:44 +02:00
qe configs: fsl: migrate FMAN/QE specific defines to Kconfig 2021-11-09 17:18:23 +05:30
ram ram: stm32mp1: Conditionally enable ASR 2022-05-10 13:54:47 +02:00
reboot-mode reboot-mode: migrate uclass to livetree 2021-10-05 08:50:15 -04:00
remoteproc remoteproc: ipu: Add driver to bring up ipu 2022-02-08 11:00:03 -05:00
reset reset: Return 0 if ops unimplemented and remove empty functions 2022-05-05 19:37:11 -04:00
rng rng: add OP-TEE based Random Number Generator 2022-04-11 10:28:04 -04:00
rtc rtc: rv8803: fix off-by-one in month counting 2022-05-05 15:06:02 -04:00
scsi scsi: call device_probe() after scanning 2022-04-09 21:06:31 +02:00
serial serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
smem dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
soc soc: xilinx: zynqmp: fix out of bounds array access 2022-05-13 09:10:02 +02:00
sound sound: Fix buffer overflow in square wave generation 2022-04-29 11:11:36 -04:00
spi spi: spi-uclass: Add new spi_get_bus_and_cs() implementation 2022-05-23 09:33:10 -04:00
spmi spmi: msm: add arbiter version 5 support 2021-10-31 08:46:44 -04:00
sysinfo sysinfo: rcar3: Add Renesas R-Car Gen3 sysinfo driver 2021-07-20 23:33:54 +02:00
sysreset vpl: Add Kconfig options for VPL 2022-05-02 09:58:13 -04:00
tee drivers:optee:rpmb: initialize drivers of mmc devices in UCLASS_BLK for rpmb access 2022-06-06 18:01:21 -04:00
thermal WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
timer arm: omap2plus: Move CONFIG_SYS_PTV out of CONFIG namespace 2022-06-06 12:09:00 -04:00
tpm tpm: add support for TPMv2.x I2C chips 2022-05-23 16:33:58 +03:00
ufs lib: fix selection of CONFIG_CHARSET 2022-05-03 21:39:22 +02:00
usb arm: pxa: Remove CONFIG_CPU_PXA25X 2022-06-06 12:09:12 -04:00
video video: stm32: stm32_ltdc: support several hardware versions 2022-05-10 10:56:39 +02:00
virtio virtio: rng: Check length before copying 2022-06-08 09:24:04 -04:00
w1 arm: Remove zmx25 board and ARCH_MX25 2021-10-01 21:08:18 -04:00
w1-eeprom dm: define LOG_CATEGORY for all uclass 2021-07-06 10:38:03 -06:00
watchdog watchdog: Add MAX6370 watchdog timer driver 2022-05-06 07:06:51 +02:00
xen WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
Kconfig iommu: Add IOMMU uclass 2021-10-31 08:46:44 -04:00
Makefile Introduce Verifying Program Loader (VPL) 2022-05-02 09:58:13 -04:00