public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree
@ 2018-03-05 22:20 Vladimir Zapolskiy
  2018-03-05 22:20 ` [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles Vladimir Zapolskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vladimir Zapolskiy @ 2018-03-05 22:20 UTC (permalink / raw)
  To: Herbert Xu, Matt Mackall, Rob Herring
  Cc: Arnd Bergmann, Greg Kroah-Hartman, devicetree, linux-crypto

The series is a trivial change to extend Freescale i.MX31 RNGA
driver to work on boards with device description taken from device
tree blob. The change was tested on a legacy LogicPD MX31Lite board.

Vladimir Zapolskiy (2):
  dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles
  hwrng: mxc-rnga - add driver support on boards with device tree

Changes from v1 to v2:
* a kernel for iMX boards is always built with multiplatform support,
  thus CONFIG_OF guards were removed, thanks to Kim Phillips for review,
* added i.MX21 RNGA compatible, i.MX31 RNGA is backward compatible to it,
* though the list of documented compatibles is extended, I dare to add
  Rob's Reviewed-by tag casted for v1.

 .../bindings/rng/{imx-rngc.txt => imx-rng.txt}     | 11 +++++------
 drivers/char/hw_random/mxc-rnga.c                  | 23 +++++++++++++---------
 2 files changed, 19 insertions(+), 15 deletions(-)
 rename Documentation/devicetree/bindings/rng/{imx-rngc.txt => imx-rng.txt} (54%)

-- 
2.10.2

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

* [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles
  2018-03-05 22:20 [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
@ 2018-03-05 22:20 ` Vladimir Zapolskiy
  2018-03-05 23:53   ` Fabio Estevam
  2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
  2018-03-16 15:54 ` [PATCH v2 0/2] " Herbert Xu
  2 siblings, 1 reply; 10+ messages in thread
From: Vladimir Zapolskiy @ 2018-03-05 22:20 UTC (permalink / raw)
  To: Herbert Xu, Matt Mackall, Rob Herring
  Cc: Arnd Bergmann, Greg Kroah-Hartman, devicetree, linux-crypto

Freescale i.MX21 and i.MX31 SoCs contain a Random Number Generator
Accelerator module (RNGA), which is replaced by RNGB and RNGC modules
on later i.MX SoC series, the change adds a new compatible property
to describe the controller.

Since all versions of Freescale RNG modules are legacy, apparently
the documentation file has no more potential for further extensions,
nevertheless generalize it by removing explicit RNGC specifics.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Changes from v1 to v2:
* added i.MX21 RNGA compatible, i.MX31 RNGA is backward compatible to it,
* though the list of documented compatibles is extended, I dare to add
  Rob's Reviewed-by tag casted for v1.

 .../devicetree/bindings/rng/{imx-rngc.txt => imx-rng.txt}     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
 rename Documentation/devicetree/bindings/rng/{imx-rngc.txt => imx-rng.txt} (54%)

diff --git a/Documentation/devicetree/bindings/rng/imx-rngc.txt b/Documentation/devicetree/bindings/rng/imx-rng.txt
similarity index 54%
rename from Documentation/devicetree/bindings/rng/imx-rngc.txt
rename to Documentation/devicetree/bindings/rng/imx-rng.txt
index 93c7174..405c2b0 100644
--- a/Documentation/devicetree/bindings/rng/imx-rngc.txt
+++ b/Documentation/devicetree/bindings/rng/imx-rng.txt
@@ -1,15 +1,14 @@
-Freescale RNGC (Random Number Generator Version C)
-
-The driver also supports version B, which is mostly compatible
-to version C.
+Freescale RNGA/RNGB/RNGC (Random Number Generator Versions A, B and C)
 
 Required properties:
 - compatible : should be one of
+               "fsl,imx21-rnga"
+               "fsl,imx31-rnga" (backward compatible with "fsl,imx21-rnga")
                "fsl,imx25-rngb"
                "fsl,imx35-rngc"
 - reg : offset and length of the register set of this block
-- interrupts : the interrupt number for the RNGC block
-- clocks : the RNGC clk source
+- interrupts : the interrupt number for the RNG block
+- clocks : the RNG clk source
 
 Example:
 
-- 
2.10.2

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

* [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:20 [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
  2018-03-05 22:20 ` [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles Vladimir Zapolskiy
@ 2018-03-05 22:21 ` Vladimir Zapolskiy
  2018-03-05 22:24   ` Fabio Estevam
                     ` (2 more replies)
  2018-03-16 15:54 ` [PATCH v2 0/2] " Herbert Xu
  2 siblings, 3 replies; 10+ messages in thread
From: Vladimir Zapolskiy @ 2018-03-05 22:21 UTC (permalink / raw)
  To: Herbert Xu, Matt Mackall, Rob Herring
  Cc: Arnd Bergmann, Greg Kroah-Hartman, devicetree, linux-crypto

The driver works well on i.MX31 powered boards with device description
taken from board device tree, the only change to add to the driver is
the missing OF device id, the affected list of included headers and
indentation in platform driver struct are beautified a little.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
Changes from v1 to v2:
* a kernel for iMX boards is always built with multiplatform support,
  thus CONFIG_OF guards were removed, thanks to Kim Phillips for review,
* added "fsl,imx21-rnga" compatible to the list.

 drivers/char/hw_random/mxc-rnga.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
index 4673622..f83bee5 100644
--- a/drivers/char/hw_random/mxc-rnga.c
+++ b/drivers/char/hw_random/mxc-rnga.c
@@ -16,16 +16,13 @@
  * This driver is based on other RNG drivers.
  */
 
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
 #include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/ioport.h>
-#include <linux/platform_device.h>
-#include <linux/hw_random.h>
 #include <linux/delay.h>
+#include <linux/hw_random.h>
 #include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
 
 /* RNGA Registers */
 #define RNGA_CONTROL			0x00
@@ -197,10 +194,18 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id mxc_rnga_of_match[] = {
+	{ .compatible = "fsl,imx21-rnga", },
+	{ .compatible = "fsl,imx31-rnga", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mxc_rnga_of_match);
+
 static struct platform_driver mxc_rnga_driver = {
 	.driver = {
-		   .name = "mxc_rnga",
-		   },
+		.name = "mxc_rnga",
+		.of_match_table = mxc_rnga_of_match,
+	},
 	.remove = __exit_p(mxc_rnga_remove),
 };
 
-- 
2.10.2

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

* Re: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
@ 2018-03-05 22:24   ` Fabio Estevam
  2018-03-05 23:44     ` Vladimir Zapolskiy
  2018-03-05 23:54   ` Fabio Estevam
  2018-03-07 16:13   ` Kim Phillips
  2 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2018-03-05 22:24 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-crypto

Hi Vladimir,

On Mon, Mar 5, 2018 at 7:21 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> The driver works well on i.MX31 powered boards with device description
> taken from board device tree, the only change to add to the driver is
> the missing OF device id, the affected list of included headers and
> indentation in platform driver struct are beautified a little.

Patch looks good.

I have an off-topic question though :-)

Do you have mx31 device tree related patches so that you can test this?

Do we have mx31 pinctrl support?

Please advise.

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

* Re: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:24   ` Fabio Estevam
@ 2018-03-05 23:44     ` Vladimir Zapolskiy
  2018-03-05 23:58       ` Fabio Estevam
  0 siblings, 1 reply; 10+ messages in thread
From: Vladimir Zapolskiy @ 2018-03-05 23:44 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman, devicetree, linux-crypto

Hi Fabio,

On 03/06/2018 12:24 AM, Fabio Estevam wrote:
> Hi Vladimir,
> 
> On Mon, Mar 5, 2018 at 7:21 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
>> The driver works well on i.MX31 powered boards with device description
>> taken from board device tree, the only change to add to the driver is
>> the missing OF device id, the affected list of included headers and
>> indentation in platform driver struct are beautified a little.
> 
> Patch looks good.
> 

you are welcome to ack :)

> I have an off-topic question though :-)
> 
> Do you have mx31 device tree related patches so that you can test this?

Yes, I have a pretty good i.MX31 dtsi change (tested everything but USB
and multimedia, and that notorious watchdog problem still has to be
agreed with Uwe and solved), but I'm trying to save my time a little, and
my plan is to send everything altogether as a single imx31.dtsi update
(without instant pinctrl though). And basically RNGA support is the only
missing part at the moment.

> Do we have mx31 pinctrl support?

Yes, I have a complete and well tested i.MX31 pinctrl driver, it is done
similarly to all known Freescale pin controller drivers.

I sort of dislike it, and my preference is to "upgrade" it to utilize
generic pin multiplexing with groups, functions and pin configuration
as it is described in pinctrl-bindings.txt, then hopefully some ideas
or code can be migrated to support modern Freescale/NXP SoCs. Legacy
i.MX31 could serve as a distant and convenient test site in my opinion.

> Please advise.
> 

--
With best wishes,
Vladimir

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

* Re: [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles
  2018-03-05 22:20 ` [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles Vladimir Zapolskiy
@ 2018-03-05 23:53   ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-03-05 23:53 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-crypto

On Mon, Mar 5, 2018 at 7:20 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> Freescale i.MX21 and i.MX31 SoCs contain a Random Number Generator
> Accelerator module (RNGA), which is replaced by RNGB and RNGC modules
> on later i.MX SoC series, the change adds a new compatible property
> to describe the controller.
>
> Since all versions of Freescale RNG modules are legacy, apparently
> the documentation file has no more potential for further extensions,
> nevertheless generalize it by removing explicit RNGC specifics.
>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Reviewed-by: Rob Herring <robh@kernel.org>

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

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

* Re: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
  2018-03-05 22:24   ` Fabio Estevam
@ 2018-03-05 23:54   ` Fabio Estevam
  2018-03-07 16:13   ` Kim Phillips
  2 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-03-05 23:54 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-crypto

On Mon, Mar 5, 2018 at 7:21 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> The driver works well on i.MX31 powered boards with device description
> taken from board device tree, the only change to add to the driver is
> the missing OF device id, the affected list of included headers and
> indentation in platform driver struct are beautified a little.
>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

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

* Re: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 23:44     ` Vladimir Zapolskiy
@ 2018-03-05 23:58       ` Fabio Estevam
  0 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2018-03-05 23:58 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-crypto

Hi Vladimir,

On Mon, Mar 5, 2018 at 8:44 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:

> Yes, I have a pretty good i.MX31 dtsi change (tested everything but USB
> and multimedia, and that notorious watchdog problem still has to be
> agreed with Uwe and solved), but I'm trying to save my time a little, and
> my plan is to send everything altogether as a single imx31.dtsi update
> (without instant pinctrl though). And basically RNGA support is the only
> missing part at the moment.

Ok, that's good news.

> Yes, I have a complete and well tested i.MX31 pinctrl driver, it is done
> similarly to all known Freescale pin controller drivers.

It would be nice if you could post it even in the current form.

> I sort of dislike it, and my preference is to "upgrade" it to utilize
> generic pin multiplexing with groups, functions and pin configuration
> as it is described in pinctrl-bindings.txt, then hopefully some ideas

On i.MX8M there was a recent discussion about using the new generic
pinctl versus the old method where we encode the pinmux value in dts.

i.MX maintainers are in favor of the old method, so that we can have
this same scheme for all i.MX variants.

Well, that is a topic for another mailing list :-)

Thanks

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

* Re: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
  2018-03-05 22:24   ` Fabio Estevam
  2018-03-05 23:54   ` Fabio Estevam
@ 2018-03-07 16:13   ` Kim Phillips
  2 siblings, 0 replies; 10+ messages in thread
From: Kim Phillips @ 2018-03-07 16:13 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Herbert Xu, Matt Mackall, Rob Herring, Arnd Bergmann,
	Greg Kroah-Hartman, devicetree, linux-crypto

On Tue, 6 Mar 2018 00:21:00 +0200
Vladimir Zapolskiy <vz@mleia.com> wrote:

> The driver works well on i.MX31 powered boards with device description
> taken from board device tree, the only change to add to the driver is
> the missing OF device id, the affected list of included headers and
> indentation in platform driver struct are beautified a little.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
> Changes from v1 to v2:
> * a kernel for iMX boards is always built with multiplatform support,
>   thus CONFIG_OF guards were removed, thanks to Kim Phillips for review,

That's not necessarily the reason, e.g., of_match_table is available to
be assigned even if CONFIG_OF is not set.  Recall, I tested building
without CONFIG_OF by removing the SOC_IMX31 dependency in Kconfig, and
building with netwinder_defconfig as a base.

Nevertheless, this v2 is much easier to review without the ifdef
CONFIG_OF, so:

Reviewed-by: Kim Phillips <kim.phillips@arm.com>

Thanks,

Kim

p.s. my responses typically have lower latencies when I'm added to cc.

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

* Re: [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree
  2018-03-05 22:20 [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
  2018-03-05 22:20 ` [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles Vladimir Zapolskiy
  2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
@ 2018-03-16 15:54 ` Herbert Xu
  2 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2018-03-16 15:54 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Matt Mackall, Rob Herring, Arnd Bergmann, Greg Kroah-Hartman,
	devicetree, linux-crypto

On Tue, Mar 06, 2018 at 12:20:58AM +0200, Vladimir Zapolskiy wrote:
> The series is a trivial change to extend Freescale i.MX31 RNGA
> driver to work on boards with device description taken from device
> tree blob. The change was tested on a legacy LogicPD MX31Lite board.
> 
> Vladimir Zapolskiy (2):
>   dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles
>   hwrng: mxc-rnga - add driver support on boards with device tree
> 
> Changes from v1 to v2:
> * a kernel for iMX boards is always built with multiplatform support,
>   thus CONFIG_OF guards were removed, thanks to Kim Phillips for review,
> * added i.MX21 RNGA compatible, i.MX31 RNGA is backward compatible to it,
> * though the list of documented compatibles is extended, I dare to add
>   Rob's Reviewed-by tag casted for v1.
> 
>  .../bindings/rng/{imx-rngc.txt => imx-rng.txt}     | 11 +++++------
>  drivers/char/hw_random/mxc-rnga.c                  | 23 +++++++++++++---------
>  2 files changed, 19 insertions(+), 15 deletions(-)
>  rename Documentation/devicetree/bindings/rng/{imx-rngc.txt => imx-rng.txt} (54%)

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2018-03-16 15:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-05 22:20 [PATCH v2 0/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
2018-03-05 22:20 ` [PATCH v2 1/2] dt-bindings: rng: Document Freescale i.MX21 and i.MX31 RNGA compatibles Vladimir Zapolskiy
2018-03-05 23:53   ` Fabio Estevam
2018-03-05 22:21 ` [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Vladimir Zapolskiy
2018-03-05 22:24   ` Fabio Estevam
2018-03-05 23:44     ` Vladimir Zapolskiy
2018-03-05 23:58       ` Fabio Estevam
2018-03-05 23:54   ` Fabio Estevam
2018-03-07 16:13   ` Kim Phillips
2018-03-16 15:54 ` [PATCH v2 0/2] " Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox