* [PATCH 0/5] nvmem: patches or v4.13
@ 2017-06-09 9:59 Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes Srinivas Kandagatla
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh; +Cc: srinivas.kandagatla, linux-kernel
Hi Greg,
This patchset contains few fixes to core, Broadcom OTP driver and a patch
for new compatible to support rockchip rk322x-efuse.
Can you please queue these for v4.13.
Thanks,
srini
Andrey Smirnov (1):
nvmem: core: Call put_device() in nvmem_unregister()
Finley Xiao (1):
nvmem: rockchip-efuse: add support for rk322x-efuse
Heiner Kallweit (1):
nvmem: core: add locking to nvmem_find_cell
Johan Hovold (1):
nvmem: core: fix leaks on registration errors
Oza Pawandeep (1):
nvmem: correct Broadcom OTP controller driver writes
.../devicetree/bindings/nvmem/rockchip-efuse.txt | 1 +
drivers/nvmem/bcm-ocotp.c | 4 ++--
drivers/nvmem/core.c | 22 ++++++++++++++++------
drivers/nvmem/rockchip-efuse.c | 4 ++++
4 files changed, 23 insertions(+), 8 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
@ 2017-06-09 9:59 ` Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 2/5] nvmem: core: fix leaks on registration errors Srinivas Kandagatla
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh; +Cc: srinivas.kandagatla, linux-kernel, Oza Pawandeep, Scott Branden
From: Oza Pawandeep <oza.oza@broadcom.com>
- use data write offset to write otp data instead of read offset
- use OTP program command 0x8 to write otp with ECC rather than just
command 0xA without ECC
Fixes: 9d59c6e8ae27 ("nvmem: Add the Broadcom OTP controller driver")
Signed-off-by: Oza Pawandeep <oza.oza@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/bcm-ocotp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c
index 646cadbf1f93..3c56e3b2bd65 100644
--- a/drivers/nvmem/bcm-ocotp.c
+++ b/drivers/nvmem/bcm-ocotp.c
@@ -34,7 +34,7 @@
#define OTPC_CMD_READ 0x0
#define OTPC_CMD_OTP_PROG_ENABLE 0x2
#define OTPC_CMD_OTP_PROG_DISABLE 0x3
-#define OTPC_CMD_PROGRAM 0xA
+#define OTPC_CMD_PROGRAM 0x8
/* OTPC Status Bits */
#define OTPC_STAT_CMD_DONE BIT(1)
@@ -209,7 +209,7 @@ static int bcm_otpc_write(void *context, unsigned int offset, void *val,
set_command(priv->base, OTPC_CMD_PROGRAM);
set_cpu_address(priv->base, address++);
for (i = 0; i < priv->map->otpc_row_size; i++) {
- writel(*buf, priv->base + priv->map->data_r_offset[i]);
+ writel(*buf, priv->base + priv->map->data_w_offset[i]);
buf++;
bytes_written += sizeof(*buf);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] nvmem: core: fix leaks on registration errors
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes Srinivas Kandagatla
@ 2017-06-09 9:59 ` Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 3/5] nvmem: core: Call put_device() in nvmem_unregister() Srinivas Kandagatla
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh
Cc: srinivas.kandagatla, linux-kernel, Johan Hovold, stable # 4 . 3,
Andrew Lunn, Mika Westerberg
From: Johan Hovold <johan@kernel.org>
Make sure to deregister and release the nvmem device and underlying
memory on registration errors.
Note that the private data must be freed using put_device() once the
struct device has been initialised.
Also note that there's a related reference leak in the deregistration
function as reported by Mika Westerberg which is being fixed separately.
Fixes: b6c217ab9be6 ("nvmem: Add backwards compatibility support for older EEPROM drivers.")
Fixes: eace75cfdcf7 ("nvmem: Add a simple NVMEM framework for nvmem providers")
Cc: stable <stable@vger.kernel.org> # 4.3
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/core.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 8c830a80a648..6cf916d9db6d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -489,21 +489,24 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
rval = device_add(&nvmem->dev);
if (rval)
- goto out;
+ goto err_put_device;
if (config->compat) {
rval = nvmem_setup_compat(nvmem, config);
if (rval)
- goto out;
+ goto err_device_del;
}
if (config->cells)
nvmem_add_cells(nvmem, config);
return nvmem;
-out:
- ida_simple_remove(&nvmem_ida, nvmem->id);
- kfree(nvmem);
+
+err_device_del:
+ device_del(&nvmem->dev);
+err_put_device:
+ put_device(&nvmem->dev);
+
return ERR_PTR(rval);
}
EXPORT_SYMBOL_GPL(nvmem_register);
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] nvmem: core: Call put_device() in nvmem_unregister()
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 2/5] nvmem: core: fix leaks on registration errors Srinivas Kandagatla
@ 2017-06-09 9:59 ` Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 4/5] nvmem: core: add locking to nvmem_find_cell Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 5/5] nvmem: rockchip-efuse: add support for rk322x-efuse Srinivas Kandagatla
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh
Cc: srinivas.kandagatla, linux-kernel, Andrey Smirnov, cphealy,
Maxime Ripard
From: Andrey Smirnov <andrew.smirnov@gmail.com>
Call put_device() in nvmem_unregister() to make sure nvmem_release
gets called freeing up allocated resources.
Cc: cphealy@gmail.com
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 6cf916d9db6d..0cbac71195b5 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -532,6 +532,7 @@ int nvmem_unregister(struct nvmem_device *nvmem)
nvmem_device_remove_all_cells(nvmem);
device_del(&nvmem->dev);
+ put_device(&nvmem->dev);
return 0;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] nvmem: core: add locking to nvmem_find_cell
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
` (2 preceding siblings ...)
2017-06-09 9:59 ` [PATCH 3/5] nvmem: core: Call put_device() in nvmem_unregister() Srinivas Kandagatla
@ 2017-06-09 9:59 ` Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 5/5] nvmem: rockchip-efuse: add support for rk322x-efuse Srinivas Kandagatla
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh; +Cc: srinivas.kandagatla, linux-kernel, Heiner Kallweit
From: Heiner Kallweit <hkallweit1@gmail.com>
Adding entries to nvmem_cells and deleting entries from it is
protected by nvmem_cells_mutex. Therefore this mutex should
also protect iterating over the list.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 0cbac71195b5..4c49285168fb 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -287,9 +287,15 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id)
{
struct nvmem_cell *p;
+ mutex_lock(&nvmem_cells_mutex);
+
list_for_each_entry(p, &nvmem_cells, node)
- if (p && !strcmp(p->name, cell_id))
+ if (p && !strcmp(p->name, cell_id)) {
+ mutex_unlock(&nvmem_cells_mutex);
return p;
+ }
+
+ mutex_unlock(&nvmem_cells_mutex);
return NULL;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] nvmem: rockchip-efuse: add support for rk322x-efuse
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
` (3 preceding siblings ...)
2017-06-09 9:59 ` [PATCH 4/5] nvmem: core: add locking to nvmem_find_cell Srinivas Kandagatla
@ 2017-06-09 9:59 ` Srinivas Kandagatla
4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2017-06-09 9:59 UTC (permalink / raw)
To: gregkh; +Cc: srinivas.kandagatla, linux-kernel, Finley Xiao
From: Finley Xiao <finley.xiao@rock-chips.com>
This adds the necessary data for handling eFuse on the rk322x.
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt | 1 +
drivers/nvmem/rockchip-efuse.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
index 94aeeeabadd5..194926f77194 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
@@ -4,6 +4,7 @@ Required properties:
- compatible: Should be one of the following.
- "rockchip,rk3066a-efuse" - for RK3066a SoCs.
- "rockchip,rk3188-efuse" - for RK3188 SoCs.
+ - "rockchip,rk322x-efuse" - for RK322x SoCs.
- "rockchip,rk3288-efuse" - for RK3288 SoCs.
- "rockchip,rk3399-efuse" - for RK3399 SoCs.
- reg: Should contain the registers location and exact eFuse size
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index 423907bdd259..a0d4ede9b8fc 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -170,6 +170,10 @@ static const struct of_device_id rockchip_efuse_match[] = {
.data = (void *)&rockchip_rk3288_efuse_read,
},
{
+ .compatible = "rockchip,rk322x-efuse",
+ .data = (void *)&rockchip_rk3288_efuse_read,
+ },
+ {
.compatible = "rockchip,rk3288-efuse",
.data = (void *)&rockchip_rk3288_efuse_read,
},
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-06-09 10:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 9:59 [PATCH 0/5] nvmem: patches or v4.13 Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 2/5] nvmem: core: fix leaks on registration errors Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 3/5] nvmem: core: Call put_device() in nvmem_unregister() Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 4/5] nvmem: core: add locking to nvmem_find_cell Srinivas Kandagatla
2017-06-09 9:59 ` [PATCH 5/5] nvmem: rockchip-efuse: add support for rk322x-efuse Srinivas Kandagatla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).