aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/nvmem-provider.h
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-11-30 11:53:20 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-06 15:45:45 +0100
commit16688453661b6d5159be558a1f8c1f54463a420f (patch)
tree39750dfb13626ed1ac89b3efd43815a2d8bd01f0 /include/linux/nvmem-provider.h
parentbinder: filter out nodes when showing binder procs (diff)
downloadwireguard-linux-16688453661b6d5159be558a1f8c1f54463a420f.tar.xz
wireguard-linux-16688453661b6d5159be558a1f8c1f54463a420f.zip
nvmem: add type attribute
Add a type attribute so userspace is able to know how the data is stored as this can help taking the correct decision when selecting which device to use. This will also help program display the proper warnings when burning fuses for example. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/nvmem-provider.h')
-rw-r--r--include/linux/nvmem-provider.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 1e3283c2af77..00ff92571683 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -19,6 +19,20 @@ typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
void *val, size_t bytes);
+enum nvmem_type {
+ NVMEM_TYPE_UNKNOWN = 0,
+ NVMEM_TYPE_EEPROM,
+ NVMEM_TYPE_OTP,
+ NVMEM_TYPE_BATTERY_BACKED,
+};
+
+static const char * const nvmem_type_str[] = {
+ [NVMEM_TYPE_UNKNOWN] = "Unknown",
+ [NVMEM_TYPE_EEPROM] = "EEPROM",
+ [NVMEM_TYPE_OTP] = "OTP",
+ [NVMEM_TYPE_BATTERY_BACKED] = "Battery backed",
+};
+
/**
* struct nvmem_config - NVMEM device configuration
*
@@ -28,6 +42,7 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
* @owner: Pointer to exporter module. Used for refcounting.
* @cells: Optional array of pre-defined NVMEM cells.
* @ncells: Number of elements in cells.
+ * @type: Type of the nvmem storage
* @read_only: Device is read-only.
* @root_only: Device is accessibly to root only.
* @reg_read: Callback to read data.
@@ -51,6 +66,7 @@ struct nvmem_config {
struct module *owner;
const struct nvmem_cell_info *cells;
int ncells;
+ enum nvmem_type type;
bool read_only;
bool root_only;
nvmem_reg_read_t reg_read;