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

Add SID controller support for H5 and H6, and do some
cleanup without functional changes.

Yangtao Li (5):
  nvmem: sunxi-sid: fix wrong description in kernel doc
  nvmem: sunxi-sid: add support for H5's SID controller
  nvmem: sunxi-sid: add binding for H6's SID controller
  nvmem: sunxi-sid: add support for H6's SID controller
  nvmem: sunxi-sid: convert to SPDX license tags

 .../bindings/nvmem/allwinner,sunxi-sid.txt    |  3 ++-
 drivers/nvmem/sunxi_sid.c                     | 23 +++++++++++--------
 2 files changed, 15 insertions(+), 11 deletions(-)

-- 
2.17.0


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

* [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc
  2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
@ 2019-02-17 16:23 ` Yangtao Li
  2019-02-18  8:48   ` Maxime Ripard
  2019-02-28 19:03   ` Rob Herring
  2019-02-17 16:23 ` [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller Yangtao Li
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Yangtao Li @ 2019-02-17 16:23 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

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] 16+ messages in thread

* [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
  2019-02-17 16:23 ` [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
@ 2019-02-17 16:23 ` Yangtao Li
  2019-02-18  8:49   ` Maxime Ripard
  2019-02-17 16:23 ` [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's " Yangtao Li
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Yangtao Li @ 2019-02-17 16:23 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 H5's SID controller.

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

diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 570a2e354f30..036029e90921 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
 	.size = 0x100,
 };
 
+static const struct sunxi_sid_cfg sun50i_h5_cfg = {
+	.value_offset = 0x200,
+	.size = 0x100,
+};
+
 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-h5-sid", .data = &sun50i_h5_cfg },
 	{/* sentinel */},
 };
 MODULE_DEVICE_TABLE(of, sunxi_sid_of_match);
-- 
2.17.0


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

* [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's SID controller
  2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
  2019-02-17 16:23 ` [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
  2019-02-17 16:23 ` [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller Yangtao Li
@ 2019-02-17 16:23 ` Yangtao Li
  2019-02-18  8:50   ` Maxime Ripard
  2019-02-28 19:03   ` Rob Herring
  2019-02-17 16:23 ` [PATCH 4/5] nvmem: sunxi-sid: add support " Yangtao Li
  2019-02-17 16:23 ` [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
  4 siblings, 2 replies; 16+ messages in thread
From: Yangtao Li @ 2019-02-17 16:23 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.

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] 16+ messages in thread

* [PATCH 4/5] nvmem: sunxi-sid: add support for H6's SID controller
  2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
                   ` (2 preceding siblings ...)
  2019-02-17 16:23 ` [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's " Yangtao Li
@ 2019-02-17 16:23 ` Yangtao Li
  2019-02-17 16:23 ` [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
  4 siblings, 0 replies; 16+ messages in thread
From: Yangtao Li @ 2019-02-17 16:23 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.

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

diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 036029e90921..8692b58d76ce 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -224,12 +224,18 @@ static const struct sunxi_sid_cfg sun50i_h5_cfg = {
 	.size = 0x100,
 };
 
+static const struct sunxi_sid_cfg sun50i_h6_cfg = {
+	.value_offset = 0x200,
+	.size = 0x200,
+};
+
 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-h5-sid", .data = &sun50i_h5_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] 16+ messages in thread

* [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags
  2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
                   ` (3 preceding siblings ...)
  2019-02-17 16:23 ` [PATCH 4/5] nvmem: sunxi-sid: add support " Yangtao Li
@ 2019-02-17 16:23 ` Yangtao Li
  2019-02-18  8:50   ` Maxime Ripard
  4 siblings, 1 reply; 16+ messages in thread
From: Yangtao Li @ 2019-02-17 16:23 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.

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 8692b58d76ce..f56c9f713cb4 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] 16+ messages in thread

* Re: [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc
  2019-02-17 16:23 ` [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
@ 2019-02-18  8:48   ` Maxime Ripard
  2019-02-28 19:03   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Maxime Ripard @ 2019-02-18  8:48 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, wens, devicetree,
	linux-arm-kernel, linux-kernel

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

On Sun, Feb 17, 2019 at 11:23:12AM -0500, Yangtao Li wrote:
> qfprom->sunxi-sid
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

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] 16+ messages in thread

* Re: [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-17 16:23 ` [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller Yangtao Li
@ 2019-02-18  8:49   ` Maxime Ripard
  2019-02-18  9:19     ` Chen-Yu Tsai
  2019-02-20 14:05     ` Frank Lee
  0 siblings, 2 replies; 16+ messages in thread
From: Maxime Ripard @ 2019-02-18  8:49 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, wens, devicetree,
	linux-arm-kernel, linux-kernel

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

On Sun, Feb 17, 2019 at 11:23:13AM -0500, Yangtao Li wrote:
> Add support for H5's SID controller.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/nvmem/sunxi_sid.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> index 570a2e354f30..036029e90921 100644
> --- a/drivers/nvmem/sunxi_sid.c
> +++ b/drivers/nvmem/sunxi_sid.c
> @@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
>  	.size = 0x100,
>  };
>  
> +static const struct sunxi_sid_cfg sun50i_h5_cfg = {
> +	.value_offset = 0x200,
> +	.size = 0x100,
> +};

IIRC, there was an endianness issue on the newer SoCs, with the driver
converting the data from big endian to little endian, while it's
actually stored little endian in the SID.

Have you checked the SID content?

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] 16+ messages in thread

* Re: [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's SID controller
  2019-02-17 16:23 ` [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's " Yangtao Li
@ 2019-02-18  8:50   ` Maxime Ripard
  2019-02-28 19:03   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Maxime Ripard @ 2019-02-18  8:50 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, wens, devicetree,
	linux-arm-kernel, linux-kernel

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

On Sun, Feb 17, 2019 at 11:23:14AM -0500, Yangtao Li wrote:
> Add a binding for H6's SID controller.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

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] 16+ messages in thread

* Re: [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags
  2019-02-17 16:23 ` [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
@ 2019-02-18  8:50   ` Maxime Ripard
  0 siblings, 0 replies; 16+ messages in thread
From: Maxime Ripard @ 2019-02-18  8:50 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, wens, devicetree,
	linux-arm-kernel, linux-kernel

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

On Sun, Feb 17, 2019 at 11:23:16AM -0500, Yangtao Li wrote:
> Updates license to use SPDX-License-Identifier.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

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] 16+ messages in thread

* Re: [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-18  8:49   ` Maxime Ripard
@ 2019-02-18  9:19     ` Chen-Yu Tsai
  2019-02-19 15:03       ` Maxime Ripard
  2019-02-20 14:05     ` Frank Lee
  1 sibling, 1 reply; 16+ messages in thread
From: Chen-Yu Tsai @ 2019-02-18  9:19 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Yangtao Li, Srinivas Kandagatla, Rob Herring, Mark Rutland,
	devicetree, linux-arm-kernel, linux-kernel

On Mon, Feb 18, 2019 at 4:49 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> On Sun, Feb 17, 2019 at 11:23:13AM -0500, Yangtao Li wrote:
> > Add support for H5's SID controller.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/nvmem/sunxi_sid.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> > index 570a2e354f30..036029e90921 100644
> > --- a/drivers/nvmem/sunxi_sid.c
> > +++ b/drivers/nvmem/sunxi_sid.c
> > @@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
> >       .size = 0x100,
> >  };
> >
> > +static const struct sunxi_sid_cfg sun50i_h5_cfg = {
> > +     .value_offset = 0x200,
> > +     .size = 0x100,
> > +};
>
> IIRC, there was an endianness issue on the newer SoCs, with the driver
> converting the data from big endian to little endian, while it's
> actually stored little endian in the SID.

About that, it seems the internals are either little endian or native (same
as the bus). Either way the nvmem the driver currently exposes is wrong.

My idea is to keep the current one with the current name, but have it not
associate itself with the DT node. We then register an extra one, called
"sunxi-sid-native" which uses the native endian. This one will be associated
with the DT node, so the THS driver can consume nvmem cells.

What do you think?

> Have you checked the SID content?

On the A64 and H5, directly dumping the SID registers (not using the H3
read method) shows the contents are little or native endian.

ChenYu

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

* Re: [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-18  9:19     ` Chen-Yu Tsai
@ 2019-02-19 15:03       ` Maxime Ripard
  2019-02-19 15:07         ` Chen-Yu Tsai
  0 siblings, 1 reply; 16+ messages in thread
From: Maxime Ripard @ 2019-02-19 15:03 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Yangtao Li, Srinivas Kandagatla, Rob Herring, Mark Rutland,
	devicetree, linux-arm-kernel, linux-kernel

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

Hi,

On Mon, Feb 18, 2019 at 05:19:40PM +0800, Chen-Yu Tsai wrote:
> On Mon, Feb 18, 2019 at 4:49 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
> >
> > On Sun, Feb 17, 2019 at 11:23:13AM -0500, Yangtao Li wrote:
> > > Add support for H5's SID controller.
> > >
> > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > ---
> > >  drivers/nvmem/sunxi_sid.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> > > index 570a2e354f30..036029e90921 100644
> > > --- a/drivers/nvmem/sunxi_sid.c
> > > +++ b/drivers/nvmem/sunxi_sid.c
> > > @@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
> > >       .size = 0x100,
> > >  };
> > >
> > > +static const struct sunxi_sid_cfg sun50i_h5_cfg = {
> > > +     .value_offset = 0x200,
> > > +     .size = 0x100,
> > > +};
> >
> > IIRC, there was an endianness issue on the newer SoCs, with the driver
> > converting the data from big endian to little endian, while it's
> > actually stored little endian in the SID.
> 
> About that, it seems the internals are either little endian or native (same
> as the bus). Either way the nvmem the driver currently exposes is wrong.

Do you mean that it can be configured either way, or it's little
endian and since you are running a little endian system you can't
tell?

> My idea is to keep the current one with the current name, but have it not
> associate itself with the DT node. We then register an extra one, called
> "sunxi-sid-native" which uses the native endian. This one will be associated
> with the DT node, so the THS driver can consume nvmem cells.
> 
> What do you think?

I thought about this some more, and I don't think anyone really has
used the sysfs interface for it. Since the data are in an unusable
order (without an additional conversion at least), we would have had a
bug report by now (just like we had when someone tried to use it for
the thermal calibration).

So maybe the easy way out is just to disable the conversion on the
affected SoCs, and see if anyone complains?

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] 16+ messages in thread

* Re: [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-19 15:03       ` Maxime Ripard
@ 2019-02-19 15:07         ` Chen-Yu Tsai
  0 siblings, 0 replies; 16+ messages in thread
From: Chen-Yu Tsai @ 2019-02-19 15:07 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Yangtao Li, Srinivas Kandagatla, Rob Herring, Mark Rutland,
	devicetree, linux-arm-kernel, linux-kernel

On Tue, Feb 19, 2019 at 11:03 PM Maxime Ripard
<maxime.ripard@bootlin.com> wrote:
>
> Hi,
>
> On Mon, Feb 18, 2019 at 05:19:40PM +0800, Chen-Yu Tsai wrote:
> > On Mon, Feb 18, 2019 at 4:49 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
> > >
> > > On Sun, Feb 17, 2019 at 11:23:13AM -0500, Yangtao Li wrote:
> > > > Add support for H5's SID controller.
> > > >
> > > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > > ---
> > > >  drivers/nvmem/sunxi_sid.c | 6 ++++++
> > > >  1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> > > > index 570a2e354f30..036029e90921 100644
> > > > --- a/drivers/nvmem/sunxi_sid.c
> > > > +++ b/drivers/nvmem/sunxi_sid.c
> > > > @@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
> > > >       .size = 0x100,
> > > >  };
> > > >
> > > > +static const struct sunxi_sid_cfg sun50i_h5_cfg = {
> > > > +     .value_offset = 0x200,
> > > > +     .size = 0x100,
> > > > +};
> > >
> > > IIRC, there was an endianness issue on the newer SoCs, with the driver
> > > converting the data from big endian to little endian, while it's
> > > actually stored little endian in the SID.
> >
> > About that, it seems the internals are either little endian or native (same
> > as the bus). Either way the nvmem the driver currently exposes is wrong.
>
> Do you mean that it can be configured either way, or it's little
> endian and since you are running a little endian system you can't
> tell?

I can't tell. There doesn't seem to be a toggle for endianess though.

> > My idea is to keep the current one with the current name, but have it not
> > associate itself with the DT node. We then register an extra one, called
> > "sunxi-sid-native" which uses the native endian. This one will be associated
> > with the DT node, so the THS driver can consume nvmem cells.
> >
> > What do you think?
>
> I thought about this some more, and I don't think anyone really has
> used the sysfs interface for it. Since the data are in an unusable
> order (without an additional conversion at least), we would have had a
> bug report by now (just like we had when someone tried to use it for
> the thermal calibration).
>
> So maybe the easy way out is just to disable the conversion on the
> affected SoCs, and see if anyone complains?

That works. And please see my other mail about the DT nvmem cell arrangement.

ChenYu

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

* Re: [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller
  2019-02-18  8:49   ` Maxime Ripard
  2019-02-18  9:19     ` Chen-Yu Tsai
@ 2019-02-20 14:05     ` Frank Lee
  1 sibling, 0 replies; 16+ messages in thread
From: Frank Lee @ 2019-02-20 14:05 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Srini Kandagatla, robh+dt, mark.rutland, Chen-Yu Tsai,
	devicetree, Linux ARM, Linux Kernel Mailing List

HI Maxime and ChenYu,

On Mon, Feb 18, 2019 at 4:49 PM Maxime Ripard <maxime.ripard@bootlin.com> wrote:
>
> On Sun, Feb 17, 2019 at 11:23:13AM -0500, Yangtao Li wrote:
> > Add support for H5's SID controller.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > ---
> >  drivers/nvmem/sunxi_sid.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> > index 570a2e354f30..036029e90921 100644
> > --- a/drivers/nvmem/sunxi_sid.c
> > +++ b/drivers/nvmem/sunxi_sid.c
> > @@ -219,11 +219,17 @@ static const struct sunxi_sid_cfg sun50i_a64_cfg = {
> >       .size = 0x100,
> >  };
> >
> > +static const struct sunxi_sid_cfg sun50i_h5_cfg = {
> > +     .value_offset = 0x200,
> > +     .size = 0x100,
> > +};
>
> IIRC, there was an endianness issue on the newer SoCs, with the driver
> converting the data from big endian to little endian, while it's
> actually stored little endian in the SID.
>
> Have you checked the SID content?
It seems that data by hexdump /sys/bus/nvmem/devices/sunxi_sid/nvmem or
by md command in uboot , the data is different in some soc.

Sorry, I replied a bit late.
Any suggestions to solve it?

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

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

* Re: [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc
  2019-02-17 16:23 ` [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
  2019-02-18  8:48   ` Maxime Ripard
@ 2019-02-28 19:03   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2019-02-28 19:03 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens,
	devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

On Sun, 17 Feb 2019 11:23:12 -0500, Yangtao Li wrote:
> qfprom->sunxi-sid
> 
> 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(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's SID controller
  2019-02-17 16:23 ` [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's " Yangtao Li
  2019-02-18  8:50   ` Maxime Ripard
@ 2019-02-28 19:03   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2019-02-28 19:03 UTC (permalink / raw)
  To: Yangtao Li
  Cc: srinivas.kandagatla, robh+dt, mark.rutland, maxime.ripard, wens,
	devicetree, linux-arm-kernel, linux-kernel, Yangtao Li

On Sun, 17 Feb 2019 11:23:14 -0500, Yangtao Li wrote:
> Add a binding for H6's SID controller.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  Documentation/devicetree/bindings/nvmem/allwinner,sunxi-sid.txt | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

end of thread, other threads:[~2019-02-28 19:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-17 16:23 [PATCH 0/5] nvmem: sunxi-sid: add SID controller support for H5 and H6 Yangtao Li
2019-02-17 16:23 ` [PATCH 1/5] nvmem: sunxi-sid: fix wrong description in kernel doc Yangtao Li
2019-02-18  8:48   ` Maxime Ripard
2019-02-28 19:03   ` Rob Herring
2019-02-17 16:23 ` [PATCH 2/5] nvmem: sunxi-sid: add support for H5's SID controller Yangtao Li
2019-02-18  8:49   ` Maxime Ripard
2019-02-18  9:19     ` Chen-Yu Tsai
2019-02-19 15:03       ` Maxime Ripard
2019-02-19 15:07         ` Chen-Yu Tsai
2019-02-20 14:05     ` Frank Lee
2019-02-17 16:23 ` [PATCH 3/5] nvmem: sunxi-sid: add binding for H6's " Yangtao Li
2019-02-18  8:50   ` Maxime Ripard
2019-02-28 19:03   ` Rob Herring
2019-02-17 16:23 ` [PATCH 4/5] nvmem: sunxi-sid: add support " Yangtao Li
2019-02-17 16:23 ` [PATCH 5/5] nvmem: sunxi-sid: convert to SPDX license tags Yangtao Li
2019-02-18  8:50   ` Maxime Ripard

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).