linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6
@ 2019-04-02 15:45 Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

Add SID support for H6, and do some cleanup.
For endianness issue, add a new ref_read func.

Yangtao Li (5):
  nvmem: sunxi-sid: fix wrong description in kernel doc
  nvmem: sunxi-sid: add binding for H6's SID controller
  nvmem: sunxi-sid: convert to SPDX license tags
  nvmem: sunxi-sid: add new reg_read func
  nvmem: sunxi-sid: add support for H6's SID controller
---
v2:
-add a new ref_read func
-only support H6 now
---
 .../bindings/nvmem/allwinner,sunxi-sid.txt    |  3 +-
 drivers/nvmem/sunxi_sid.c                     | 47 +++++++++++++++----
 2 files changed, 39 insertions(+), 11 deletions(-)

-- 
2.17.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
@ 2019-04-02 15:45 ` Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 2/5] nvmem: sunxi-sid: add binding for H6's SID controller Yangtao Li
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

qfprom->sunxi-sid

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt b/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
index 99c4ba6a3f61..d37017e343b1 100644
--- a/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
+++ b/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
@@ -12,7 +12,7 @@ Required properties:
 - reg: Should contain registers location and length
 
 = Data cells =
-Are child nodes of qfprom, bindings of which as described in
+Are child nodes of sunxi-sid, bindings of which as described in
 bindings/nvmem/nvmem.txt
 
 Example for sun4i:
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/5] nvmem: sunxi-sid: add binding for H6's SID controller
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
@ 2019-04-02 15:45 ` Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 3/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

Add a binding for H6's SID controller.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt b/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
index d37017e343b1..cfb18b4ef8f7 100644
--- a/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
+++ b/Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt
@@ -8,6 +8,7 @@ Required properties:
   "allwinner,sun8i-h3-sid"
   "allwinner,sun50i-a64-sid"
   "allwinner,sun50i-h5-sid"
+  "allwinner,sun50i-h6-sid"
 
 - reg: Should contain registers location and length
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/5] nvmem: sunxi-sid: convert to SPDX license tags
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 2/5] nvmem: sunxi-sid: add binding for H6's SID controller Yangtao Li
@ 2019-04-02 15:45 ` Yangtao Li
  2019-04-02 15:45 ` [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func Yangtao Li
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

Updates license to use SPDX-License-Identifier.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/nvmem/sunxi_sid.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 570a2e354f30..54620d72ddb9 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -1,18 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Allwinner sunXi SoCs Security ID support.
  *
  * Copyright (c) 2013 Oliver Schinagl <oliver@schinagl.nl>
  * Copyright (C) 2014 Maxime Ripard <maxime.ripard@free-electrons.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <linux/device.h>
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
                   ` (2 preceding siblings ...)
  2019-04-02 15:45 ` [PATCH v2 3/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
@ 2019-04-02 15:45 ` Yangtao Li
  2019-04-04 10:59   ` Srinivas Kandagatla
  2019-04-02 15:45 ` [PATCH v2 5/5] nvmem: sunxi-sid: add support for H6's SID controller Yangtao Li
  2019-04-04 11:00 ` [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Srinivas Kandagatla
  5 siblings, 1 reply; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

Because there was an endianness issue. It seems that reg_read
function which the nvmem the driver currently exposes is wrong.
So add the new read function, the new function is used when the
native_endian flag is set.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/nvmem/sunxi_sid.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 54620d72ddb9..5b8a42f686cd 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -37,6 +37,7 @@ struct sunxi_sid_cfg {
 	u32	value_offset;
 	u32	size;
 	bool	need_register_readout;
+	bool	native_endian;
 };
 
 struct sunxi_sid {
@@ -75,6 +76,31 @@ static int sunxi_sid_read(void *context, unsigned int offset,
 	return 0;
 }
 
+static u8 sunxi_sid_read_byte_native(const struct sunxi_sid *sid,
+			      const unsigned int offset)
+{
+	u32 sid_key;
+
+	sid_key = ioread32(sid->base + round_down(offset, 4));
+	sid_key >>= (offset % 4) * 8;
+
+	return sid_key;
+}
+
+static int sunxi_sid_read_native(void *context, unsigned int offset,
+			  void *val, size_t bytes)
+{
+	struct sunxi_sid *sid = context;
+	u8 *buf = val;
+
+	offset += sid->value_offset;
+
+	while (bytes--)
+		*buf++ = sunxi_sid_read_byte_native(sid, offset++);
+
+	return 0;
+}
+
 static int sun8i_sid_register_readout(const struct sunxi_sid *sid,
 				      const unsigned int offset,
 				      u32 *out)
@@ -169,9 +195,12 @@ static int sunxi_sid_probe(struct platform_device *pdev)
 	econfig.dev = dev;
 	if (cfg->need_register_readout)
 		econfig.reg_read = sun8i_sid_read_by_reg;
+	else if (cfg->native_endian)
+		econfig.reg_read = sunxi_sid_read_native;
 	else
 		econfig.reg_read = sunxi_sid_read;
 	econfig.priv = sid;
+
 	nvmem = devm_nvmem_register(dev, &econfig);
 	if (IS_ERR(nvmem))
 		return PTR_ERR(nvmem);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 5/5] nvmem: sunxi-sid: add support for H6's SID controller
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
                   ` (3 preceding siblings ...)
  2019-04-02 15:45 ` [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func Yangtao Li
@ 2019-04-02 15:45 ` Yangtao Li
  2019-04-04 11:00 ` [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Srinivas Kandagatla
  5 siblings, 0 replies; 10+ messages in thread
From: Yangtao Li @ 2019-04-02 15:45 UTC (permalink / raw)
  To: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

Add support for H6's SID controller. It supports 4K-bit
EFUSE, bigger than before. And convert to use sunxi_sid_read_native
func.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/nvmem/sunxi_sid.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 5b8a42f686cd..3c2b06140490 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -239,11 +239,18 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
 	.size = 0x100,
 };
 
+static const struct sunxi_sid_cfg sun50i_h6_cfg = {
+	.value_offset = 0x200,
+	.size = 0x200,
+	.native_endian = true,
+};
+
 static const struct of_device_id sunxi_sid_of_match[] = {
 	{ .compatible = "allwinner,sun4i-a10-sid", .data = &sun4i_a10_cfg },
 	{ .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg },
 	{ .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg },
 	{ .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg },
+	{ .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg },
 	{/* sentinel */},
 };
 MODULE_DEVICE_TABLE(of, sunxi_sid_of_match);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func
  2019-04-02 15:45 ` [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func Yangtao Li
@ 2019-04-04 10:59   ` Srinivas Kandagatla
  2019-04-04 11:05     ` Maxime Ripard
  0 siblings, 1 reply; 10+ messages in thread
From: Srinivas Kandagatla @ 2019-04-04 10:59 UTC (permalink / raw)
  To: Yangtao Li, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel



On 02/04/2019 16:45, Yangtao Li wrote:
> Because there was an endianness issue. It seems that reg_read
> function which the nvmem the driver currently exposes is wrong.
> So add the new read function, the new function is used when the
> native_endian flag is set.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

This patch and 5/5 does not apply cleanly on nvmem-next.
Also I would need an ack from Maxime to be able to apply it.

thanks,
srini

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6
  2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
                   ` (4 preceding siblings ...)
  2019-04-02 15:45 ` [PATCH v2 5/5] nvmem: sunxi-sid: add support for H6's SID controller Yangtao Li
@ 2019-04-04 11:00 ` Srinivas Kandagatla
  5 siblings, 0 replies; 10+ messages in thread
From: Srinivas Kandagatla @ 2019-04-04 11:00 UTC (permalink / raw)
  To: Yangtao Li, robh+dt, mark.rutland, maxime.ripard, wens
  Cc: devicetree, linux-arm-kernel, linux-kernel



On 02/04/2019 16:45, Yangtao Li wrote:
> Add SID support for H6, and do some cleanup.
> For endianness issue, add a new ref_read func.
> 
> Yangtao Li (5):
>    nvmem: sunxi-sid: fix wrong description in kernel doc
>    nvmem: sunxi-sid: add binding for H6's SID controller
>    nvmem: sunxi-sid: convert to SPDX license tags

Applied first 3 patches, please resend last two patches after rebase on 
top of next.

Thanks,
srini

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func
  2019-04-04 10:59   ` Srinivas Kandagatla
@ 2019-04-04 11:05     ` Maxime Ripard
  2019-04-04 13:36       ` Chen-Yu Tsai
  0 siblings, 1 reply; 10+ messages in thread
From: Maxime Ripard @ 2019-04-04 11:05 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Yangtao Li, robh+dt, mark.rutland, wens, devicetree,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On Thu, Apr 04, 2019 at 11:59:44AM +0100, Srinivas Kandagatla wrote:
>
>
> On 02/04/2019 16:45, Yangtao Li wrote:
> > Because there was an endianness issue. It seems that reg_read
> > function which the nvmem the driver currently exposes is wrong.
> > So add the new read function, the new function is used when the
> > native_endian flag is set.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
>
> This patch and 5/5 does not apply cleanly on nvmem-next.
> Also I would need an ack from Maxime to be able to apply it.

Chen-Yu has mostly been taking care of this recently, so I'd like his
feedback on this.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func
  2019-04-04 11:05     ` Maxime Ripard
@ 2019-04-04 13:36       ` Chen-Yu Tsai
  0 siblings, 0 replies; 10+ messages in thread
From: Chen-Yu Tsai @ 2019-04-04 13:36 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Srinivas Kandagatla, Yangtao Li, Rob Herring, Mark Rutland,
	devicetree, linux-arm-kernel, linux-kernel

On Thu, Apr 4, 2019 at 7:05 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> On Thu, Apr 04, 2019 at 11:59:44AM +0100, Srinivas Kandagatla wrote:
> >
> >
> > On 02/04/2019 16:45, Yangtao Li wrote:
> > > Because there was an endianness issue. It seems that reg_read
> > > function which the nvmem the driver currently exposes is wrong.
> > > So add the new read function, the new function is used when the
> > > native_endian flag is set.
> > >
> > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> >
> > This patch and 5/5 does not apply cleanly on nvmem-next.
> > Also I would need an ack from Maxime to be able to apply it.
>
> Chen-Yu has mostly been taking care of this recently, so I'd like his
> feedback on this.

As you previously requested, my patches already switch everything
to native endianess. There's no need to differentiate between the
old and the new now. So this patch and the native_endian flag is
not needed.

ChenYu

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-04 13:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 15:45 [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 Yangtao Li
2019-04-02 15:45 ` [PATCH v2 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
2019-04-02 15:45 ` [PATCH v2 2/5] nvmem: sunxi-sid: add binding for H6's SID controller Yangtao Li
2019-04-02 15:45 ` [PATCH v2 3/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
2019-04-02 15:45 ` [PATCH v2 4/5] nvmem: sunxi-sid: add new reg_read func Yangtao Li
2019-04-04 10:59   ` Srinivas Kandagatla
2019-04-04 11:05     ` Maxime Ripard
2019-04-04 13:36       ` Chen-Yu Tsai
2019-04-02 15:45 ` [PATCH v2 5/5] nvmem: sunxi-sid: add support for H6's SID controller Yangtao Li
2019-04-04 11:00 ` [PATCH v2 0/5] nvmem: sunxi-sid: add SID controller support for H6 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).