Commit 8b977c54 authored by Yangtao Li's avatar Yangtao Li Committed by Greg Kroah-Hartman

nvmem: core: add nvmem_cell_read_u64

Add nvmem_cell_read_u64() helper to ease read of an u64 value on consumer
side. This helper is useful on some sunxi platform that has 64 bits data
cells stored in no volatile memory.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200310132257.23358-4-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bb317ce
...@@ -1146,6 +1146,21 @@ int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val) ...@@ -1146,6 +1146,21 @@ int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val)
} }
EXPORT_SYMBOL_GPL(nvmem_cell_read_u32); EXPORT_SYMBOL_GPL(nvmem_cell_read_u32);
/**
* nvmem_cell_read_u64() - Read a cell value as an u64
*
* @dev: Device that requests the nvmem cell.
* @cell_id: Name of nvmem cell to read.
* @val: pointer to output value.
*
* Return: 0 on success or negative errno.
*/
int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val)
{
return nvmem_cell_read_common(dev, cell_id, val, sizeof(*val));
}
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
/** /**
* nvmem_device_cell_read() - Read a given nvmem device and cell * nvmem_device_cell_read() - Read a given nvmem device and cell
* *
......
...@@ -63,6 +63,7 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); ...@@ -63,6 +63,7 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len);
int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);
int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val);
int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val);
int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val);
/* direct nvmem device read/write interface */ /* direct nvmem device read/write interface */
struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);
...@@ -138,6 +139,12 @@ static inline int nvmem_cell_read_u32(struct device *dev, ...@@ -138,6 +139,12 @@ static inline int nvmem_cell_read_u32(struct device *dev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline int nvmem_cell_read_u64(struct device *dev,
const char *cell_id, u64 *val)
{
return -EOPNOTSUPP;
}
static inline struct nvmem_device *nvmem_device_get(struct device *dev, static inline struct nvmem_device *nvmem_device_get(struct device *dev,
const char *name) const char *name)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment