aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-08 21:58:55 +0100
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-14 14:10:51 +0100
commit7d7aa2fd924c27829ec25f825481554dd81bce97 (patch)
tree658b87b89331670266163e522ea5fb52535633cb /target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch
parente7bfda2c243e66a75ff966ba04c28b1590b5d24c (diff)
downloadupstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.gz
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.bz2
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.zip
brcm2708: rename target to bcm27xx
This change makes the names of Broadcom targets consistent by using the common notation based on SoC/CPU ID (which is used internally anyway), bcmXXXX instead of brcmXXXX. This is even used for target TITLE in make menuconfig already, only the short target name used brcm so far. Despite, since subtargets range from bcm2708 to bcm2711, it seems appropriate to use bcm27xx instead of bcm2708 (again, as already done for BOARDNAME). This also renames the packages brcm2708-userland and brcm2708-gpu-fw. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch')
-rw-r--r--target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch131
1 files changed, 131 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch b/target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch
new file mode 100644
index 0000000000..661ba8e33d
--- /dev/null
+++ b/target/linux/bcm27xx/patches-4.19/950-0338-nvmem-add-type-attribute.patch
@@ -0,0 +1,131 @@
+From c9e76146066660a2884e61216c1ce227cf509bf8 Mon Sep 17 00:00:00 2001
+From: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Date: Fri, 30 Nov 2018 11:53:20 +0000
+Subject: [PATCH] nvmem: add type attribute
+
+commit 16688453661b6d5159be558a1f8c1f54463a420f upstream.
+
+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>
+---
+ drivers/nvmem/core.c | 21 +++++++++++++++++++++
+ include/linux/nvmem-provider.h | 16 ++++++++++++++++
+ 2 files changed, 37 insertions(+)
+
+--- a/drivers/nvmem/core.c
++++ b/drivers/nvmem/core.c
+@@ -36,6 +36,7 @@ struct nvmem_device {
+ size_t size;
+ bool read_only;
+ int flags;
++ enum nvmem_type type;
+ struct bin_attribute eeprom;
+ struct device *base_dev;
+ nvmem_reg_read_t reg_read;
+@@ -84,6 +85,21 @@ static int nvmem_reg_write(struct nvmem_
+ return -EINVAL;
+ }
+
++static ssize_t type_show(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ struct nvmem_device *nvmem = to_nvmem_device(dev);
++
++ return sprintf(buf, "%s\n", nvmem_type_str[nvmem->type]);
++}
++
++static DEVICE_ATTR_RO(type);
++
++static struct attribute *nvmem_attrs[] = {
++ &dev_attr_type.attr,
++ NULL,
++};
++
+ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *attr,
+ char *buf, loff_t pos, size_t count)
+@@ -169,6 +185,7 @@ static struct bin_attribute *nvmem_bin_r
+
+ static const struct attribute_group nvmem_bin_rw_group = {
+ .bin_attrs = nvmem_bin_rw_attributes,
++ .attrs = nvmem_attrs,
+ };
+
+ static const struct attribute_group *nvmem_rw_dev_groups[] = {
+@@ -192,6 +209,7 @@ static struct bin_attribute *nvmem_bin_r
+
+ static const struct attribute_group nvmem_bin_ro_group = {
+ .bin_attrs = nvmem_bin_ro_attributes,
++ .attrs = nvmem_attrs,
+ };
+
+ static const struct attribute_group *nvmem_ro_dev_groups[] = {
+@@ -216,6 +234,7 @@ static struct bin_attribute *nvmem_bin_r
+
+ static const struct attribute_group nvmem_bin_rw_root_group = {
+ .bin_attrs = nvmem_bin_rw_root_attributes,
++ .attrs = nvmem_attrs,
+ };
+
+ static const struct attribute_group *nvmem_rw_root_dev_groups[] = {
+@@ -239,6 +258,7 @@ static struct bin_attribute *nvmem_bin_r
+
+ static const struct attribute_group nvmem_bin_ro_root_group = {
+ .bin_attrs = nvmem_bin_ro_root_attributes,
++ .attrs = nvmem_attrs,
+ };
+
+ static const struct attribute_group *nvmem_ro_root_dev_groups[] = {
+@@ -485,6 +505,7 @@ struct nvmem_device *nvmem_register(cons
+ nvmem->dev.bus = &nvmem_bus_type;
+ nvmem->dev.parent = config->dev;
+ nvmem->priv = config->priv;
++ nvmem->type = config->type;
+ nvmem->reg_read = config->reg_read;
+ nvmem->reg_write = config->reg_write;
+ nvmem->dev.of_node = config->dev->of_node;
+--- a/include/linux/nvmem-provider.h
++++ b/include/linux/nvmem-provider.h
+@@ -22,6 +22,20 @@ typedef int (*nvmem_reg_read_t)(void *pr
+ 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
+ *
+@@ -31,6 +45,7 @@ typedef int (*nvmem_reg_write_t)(void *p
+ * @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.
+@@ -54,6 +69,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;