mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
nvmem: core: introduce NVMEM layouts
NVMEM layouts are used to generate NVMEM cells during runtime. Think of
an EEPROM with a well-defined conent. For now, the content can be
described by a device tree or a board file. But this only works if the
offsets and lengths are static and don't change. One could also argue
that putting the layout of the EEPROM in the device tree is the wrong
place. Instead, the device tree should just have a specific compatible
string.
Right now there are two use cases:
(1) The NVMEM cell needs special processing. E.g. if it only specifies
a base MAC address offset and you need to add an offset, or it
needs to parse a MAC from ASCII format or some proprietary format.
(Post processing of cells is added in a later commit).
(2) u-boot environment parsing. The cells don't have a particular
offset but it needs parsing the content to determine the offsets
and length.
Co-developed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230404172148.82422-14-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2f555f58f5
commit
266570f496
@@ -239,6 +239,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
|
||||
const char *id);
|
||||
struct nvmem_device *of_nvmem_device_get(struct device_node *np,
|
||||
const char *name);
|
||||
struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem);
|
||||
#else
|
||||
static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
|
||||
const char *id)
|
||||
@@ -251,6 +252,12 @@ static inline struct nvmem_device *of_nvmem_device_get(struct device_node *np,
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static inline struct device_node *
|
||||
of_nvmem_layout_get_container(struct nvmem_device *nvmem)
|
||||
{
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
#endif /* CONFIG_NVMEM && CONFIG_OF */
|
||||
|
||||
#endif /* ifndef _LINUX_NVMEM_CONSUMER_H */
|
||||
|
||||
Reference in New Issue
Block a user