Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: nvmem: document cell tables and lookup entries

Document the new nvmem kernel APIs.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
4903d19c 506157be

+31
+31
Documentation/nvmem/nvmem.txt
··· 58 58 It is mandatory that the NVMEM provider has a regmap associated with its 59 59 struct device. Failure to do would return error code from nvmem_register(). 60 60 61 + Users of board files can define and register nvmem cells using the 62 + nvmem_cell_table struct: 63 + 64 + static struct nvmem_cell_info foo_nvmem_cells[] = { 65 + { 66 + .name = "macaddr", 67 + .offset = 0x7f00, 68 + .bytes = ETH_ALEN, 69 + } 70 + }; 71 + 72 + static struct nvmem_cell_table foo_nvmem_cell_table = { 73 + .nvmem_name = "i2c-eeprom", 74 + .cells = foo_nvmem_cells, 75 + .ncells = ARRAY_SIZE(foo_nvmem_cells), 76 + }; 77 + 78 + nvmem_add_cell_table(&foo_nvmem_cell_table); 79 + 80 + Additionally it is possible to create nvmem cell lookup entries and register 81 + them with the nvmem framework from machine code as shown in the example below: 82 + 83 + static struct nvmem_cell_lookup foo_nvmem_lookup = { 84 + .nvmem_name = "i2c-eeprom", 85 + .cell_name = "macaddr", 86 + .dev_id = "foo_mac.0", 87 + .con_id = "mac-address", 88 + }; 89 + 90 + nvmem_add_cell_lookups(&foo_nvmem_lookup, 1); 91 + 61 92 NVMEM Consumers 62 93 +++++++++++++++ 63 94