Lines Matching +full:nvmem +full:- +full:cells

1 .. SPDX-License-Identifier: GPL-2.0
4 NVMEM Subsystem
9 This document explains the NVMEM Framework along with the APIs provided,
14 *NVMEM* is the abbreviation for Non Volatile Memory layer. It is used to
18 Before this framework existed, NVMEM drivers like eeprom were stored in
20 register a sysfs file, allow in-kernel users to access the content of the
23 This was also a problem as far as other in-kernel users were involved, since
33 NVMEM Providers
36 NVMEM provider refers to an entity that implements methods to initialize, read
37 and write the non-volatile memory.
39 2. Registering/Unregistering the NVMEM provider
42 A NVMEM provider can register with NVMEM core by supplying relevant
43 nvmem configuration to nvmem_register(), on success core would return a valid
46 nvmem_unregister(nvmem) is used to unregister a previously registered provider.
58 econfig.dev = &pdev->dev;
59 nvmem = nvmem_register(&econfig);
63 It is mandatory that the NVMEM provider has a regmap associated with its
66 Users of board files can define and register nvmem cells using the
78 .nvmem_name = "i2c-eeprom",
79 .cells = foo_nvmem_cells,
85 Additionally it is possible to create nvmem cell lookup entries and register
86 them with the nvmem framework from machine code as shown in the example below::
89 .nvmem_name = "i2c-eeprom",
92 .con_id = "mac-address",
97 NVMEM Consumers
100 NVMEM consumers are the entities which make use of the NVMEM provider to
101 read from and to NVMEM.
103 3. NVMEM cell based consumer APIs
106 NVMEM cells are the data entries/fields in the NVMEM.
107 The NVMEM framework provides 3 APIs to read/write NVMEM cells::
118 `*nvmem_cell_get()` apis will get a reference to nvmem cell for a given id,
123 4. Direct NVMEM device based consumer APIs
126 In some instances it is necessary to directly read/write the NVMEM.
127 To facilitate such consumers NVMEM framework provides below apis::
134 void nvmem_device_put(struct nvmem_device *nvmem);
135 int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset,
137 int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset,
139 int nvmem_device_cell_read(struct nvmem_device *nvmem,
141 int nvmem_device_cell_write(struct nvmem_device *nvmem,
144 Before the consumers can read/write NVMEM directly, it should get hold
150 5. Releasing a reference to the NVMEM
153 When a consumer no longer needs the NVMEM, it has to release the reference
154 to the NVMEM it has obtained using the APIs mentioned in the above section.
155 The NVMEM framework provides 2 APIs to release a reference to the NVMEM::
159 void nvmem_device_put(struct nvmem_device *nvmem);
160 void devm_nvmem_device_put(struct device *dev, struct nvmem_device *nvmem);
162 Both these APIs are used to release a reference to the NVMEM and
164 with this NVMEM.
172 Userspace can read/write the raw NVMEM file located at::
174 /sys/bus/nvmem/devices/*/nvmem
178 hexdump /sys/bus/nvmem/devices/qfprom0/nvmem
191 See Documentation/devicetree/bindings/nvmem/nvmem.txt