]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Documentation: nvmem: document cell tables and lookup entries
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 21 Sep 2018 13:40:18 +0000 (06:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Sep 2018 13:14:54 +0000 (15:14 +0200)
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>
Documentation/nvmem/nvmem.txt

index 8d8d8f58f96fbd2420a8c2b00a9988259220700a..fc2fe4b186552448113759a87de993e4d174cddb 100644 (file)
@@ -58,6 +58,37 @@ static int qfprom_probe(struct platform_device *pdev)
 It is mandatory that the NVMEM provider has a regmap associated with its
 struct device. Failure to do would return error code from nvmem_register().
 
+Users of board files can define and register nvmem cells using the
+nvmem_cell_table struct:
+
+static struct nvmem_cell_info foo_nvmem_cells[] = {
+       {
+               .name           = "macaddr",
+               .offset         = 0x7f00,
+               .bytes          = ETH_ALEN,
+       }
+};
+
+static struct nvmem_cell_table foo_nvmem_cell_table = {
+       .nvmem_name             = "i2c-eeprom",
+       .cells                  = foo_nvmem_cells,
+       .ncells                 = ARRAY_SIZE(foo_nvmem_cells),
+};
+
+nvmem_add_cell_table(&foo_nvmem_cell_table);
+
+Additionally it is possible to create nvmem cell lookup entries and register
+them with the nvmem framework from machine code as shown in the example below:
+
+static struct nvmem_cell_lookup foo_nvmem_lookup = {
+       .nvmem_name             = "i2c-eeprom",
+       .cell_name              = "macaddr",
+       .dev_id                 = "foo_mac.0",
+       .con_id                 = "mac-address",
+};
+
+nvmem_add_cell_lookups(&foo_nvmem_lookup, 1);
+
 NVMEM Consumers
 +++++++++++++++