mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Ray Jui <rjui@broadcom.com>, Eric Anholt <eric@anholt.net>,
	Rob Herring <robh+dt@kernel.org>,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Harald Freudenberger <freude@linux.vnet.ibm.com>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	"moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>,
	Scott Branden <sbranden@broadcom.com>,
	"open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
	<linux-crypto@vger.kernel.org>, Martin Kaiser <martin@kaiser.cx>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>,
	"maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." 
	<bcm-kernel-feedback-list@broadcom.com>,
	Mark Rutland <mark.rutland@arm.com>,
	"moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" 
	<linux-rpi-kernel@lists.infradead.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>, Sean Wang <sean.wang@mediatek.com>
Subject: Re: [PATCH 11/12] hwrng: bcm2835-rng: Enable BCM2835 RNG to work on BCM63xx platforms
Date: Tue, 7 Nov 2017 07:45:44 +0100 (CET)	[thread overview]
Message-ID: <345702666.5362.1510037144469@email.1und1.de> (raw)
In-Reply-To: <2538f1bb-e0f8-c336-d82a-0cb2f19b0ead@gmail.com>

> Florian Fainelli <f.fainelli@gmail.com> hat am 6. November 2017 um 21:16 geschrieben:
> 
> 
> On 11/04/2017 11:27 AM, Stefan Wahren wrote:
> > Hi Florian
> > 
> >> Florian Fainelli <f.fainelli@gmail.com> hat am 2. November 2017 um 02:04 geschrieben:
> >>
> >>
> >> We have now incorporated all necessary functionality for the BCM63xx
> >> platforms to successfully migrate over bcm2835-rng, so add the final
> >> bits: Kconfig selection and proper platform_device device type matching
> >> to keep the same platform device name for registration to work.
> >>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >> ---
> >>  drivers/char/hw_random/Kconfig       |  7 ++++---
> >>  drivers/char/hw_random/bcm2835-rng.c | 11 ++++++++++-
> >>  2 files changed, 14 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
> >> index 95a031e9eced..d0689cc8c7fc 100644
> >> --- a/drivers/char/hw_random/Kconfig
> >> +++ b/drivers/char/hw_random/Kconfig
> >> @@ -87,12 +87,13 @@ config HW_RANDOM_BCM63XX
> >>  	  If unusure, say Y.
> >>  
> >>  config HW_RANDOM_BCM2835
> >> -	tristate "Broadcom BCM2835 Random Number Generator support"
> >> -	depends on ARCH_BCM2835 || ARCH_BCM_NSP || ARCH_BCM_5301X
> >> +	tristate "Broadcom BCM2835/BCM63xx Random Number Generator support"
> >> +	depends on ARCH_BCM2835 || ARCH_BCM_NSP || ARCH_BCM_5301X || \
> >> +		   ARCH_BCM_63XX || BCM63XX || BMIPS_GENERIC
> >>  	default HW_RANDOM
> >>  	---help---
> >>  	  This driver provides kernel-side support for the Random Number
> >> -	  Generator hardware found on the Broadcom BCM2835 SoCs.
> >> +	  Generator hardware found on the Broadcom BCM2835 and BCM63xx SoCs.
> >>  
> >>  	  To compile this driver as a module, choose M here: the
> >>  	  module will be called bcm2835-rng
> >> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> >> index 650e0033c273..d9ffe14f312b 100644
> >> --- a/drivers/char/hw_random/bcm2835-rng.c
> >> +++ b/drivers/char/hw_random/bcm2835-rng.c
> >> @@ -131,6 +131,7 @@ static const struct of_device_id bcm2835_rng_of_match[] = {
> >>  	{ .compatible = "brcm,bcm2835-rng"},
> >>  	{ .compatible = "brcm,bcm-nsp-rng", .data = &nsp_rng_of_data },
> >>  	{ .compatible = "brcm,bcm5301x-rng", .data = &nsp_rng_of_data },
> >> +	{ .compatible = "brcm,bcm6368-rng"},
> >>  	{},
> >>  };
> >>  
> >> @@ -164,7 +165,7 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
> >>  	if (IS_ERR(priv->clk))
> >>  		priv->clk = NULL;
> >>  
> >> -	priv->rng.name = "bcm2835-rng";
> >> +	priv->rng.name = pdev->id_entry->name;
> > 
> > this change breaks registration on bcm2835, because the name is NULL.
> 
> OH right, I will fix that in v2, I am assuming that if you did something
> like this, things still work correctly for you on 2835:
> 
> if (!priv->id_entry->name)
> 	priv->rng.name = "bcm2835-rng";
> else
> 	priv->rng.name = priv->id_entry->name;
> 
> ?

I think that should work, but i'm not really happy about it. I prefer a more general solution. Looking at the other rng drivers shows the following pattern:

priv->rng.name = pdev->name;

I need to verify this on bcm2835.

> 
> > 
> > Regards
> > Stefan
> > 
> >>  	priv->rng.init = bcm2835_rng_init;
> >>  	priv->rng.read = bcm2835_rng_read;
> >>  	priv->rng.cleanup = bcm2835_rng_cleanup;
> >> @@ -190,12 +191,20 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
> >>  
> >>  MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match);
> >>  
> >> +static struct platform_device_id bcm2835_rng_devtype[] = {
> >> +	{ .name = "bcm2835-rng" },
> >> +	{ .name = "bcm63xx-rng" },
> >> +	{ /* sentinel */ }
> >> +};
> >> +MODULE_DEVICE_TABLE(platform, bcm2835_rng_devtype);
> >> +
> >>  static struct platform_driver bcm2835_rng_driver = {
> >>  	.driver = {
> >>  		.name = "bcm2835-rng",
> >>  		.of_match_table = bcm2835_rng_of_match,
> >>  	},
> >>  	.probe		= bcm2835_rng_probe,
> >> +	.id_table	= bcm2835_rng_devtype,
> >>  };
> >>  module_platform_driver(bcm2835_rng_driver);
> >>  
> >> -- 
> >> 2.9.3
> >>
> >>
> >> _______________________________________________
> >> linux-arm-kernel mailing list
> >> linux-arm-kernel@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> 
> -- 
> Florian
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2017-11-07  6:46 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02  1:03 [PATCH 00/12] bcm63xx-rng conversion to bcm2835-rng Florian Fainelli
2017-11-02  1:03 ` [PATCH 01/12] hwrng: bcm2835-rng: Obtain base register via resource Florian Fainelli
2017-11-02  1:03 ` [PATCH 02/12] hwrng: bcm2835-rng: Define a driver private context Florian Fainelli
2017-11-02  1:03 ` [PATCH 03/12] hwrng: bcm2835-rng: Move enabling to hwrng::init Florian Fainelli
2017-11-02  1:04 ` [PATCH 04/12] hwrng: bcm2835-rng: Implementation cleanup callback Florian Fainelli
2017-11-02  1:04 ` [PATCH 05/12] hwrng: bcm2835-rng: Use device managed helpers Florian Fainelli
2017-11-02  1:04 ` [PATCH 06/12] hwrng: bcm2835-rng: Rework interrupt masking Florian Fainelli
2017-11-02  1:04 ` [PATCH 07/12] hwrng: bcm2835-rng: Manage an optional clock Florian Fainelli
2017-11-04 13:50   ` Stefan Wahren
2017-11-04 17:59     ` Florian Fainelli
2017-11-04 18:22       ` Stefan Wahren
2017-11-04 19:37         ` Andrew Lunn
2017-11-04 20:08           ` Russell King - ARM Linux
2017-11-04 20:17             ` Andrew Lunn
2017-11-02  1:04 ` [PATCH 08/12] hwrng: bcm2835-rng: Abstract I/O accessors Florian Fainelli
2017-11-03 20:19   ` Eric Anholt
2017-11-03 22:04     ` Florian Fainelli
2017-11-02  1:04 ` [PATCH 09/12] hwrng: bcm2835-rng: Add Broadcom MIPS " Florian Fainelli
2017-11-02  1:04 ` [PATCH 10/12] dt-bindings: rng: Incorporate brcm,bcm6368.txt binding Florian Fainelli
2017-11-06 21:38   ` Rob Herring
2017-11-02  1:04 ` [PATCH 11/12] hwrng: bcm2835-rng: Enable BCM2835 RNG to work on BCM63xx platforms Florian Fainelli
2017-11-04 18:27   ` Stefan Wahren
2017-11-06 20:16     ` Florian Fainelli
2017-11-07  6:45       ` Stefan Wahren [this message]
2017-11-07 23:27         ` Stefan Wahren
2017-11-02  1:04 ` [PATCH 12/12] hwrng: bcm63xx-rng: Remove since bcm2835-rng takes over Florian Fainelli
2017-11-03 20:18   ` Eric Anholt
2017-11-03 21:58     ` Florian Fainelli
2017-11-02 19:00 ` [PATCH 00/12] bcm63xx-rng conversion to bcm2835-rng Stefan Wahren
2017-11-02 19:01 ` Stefan Wahren
2017-11-02 19:06   ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=345702666.5362.1510037144469@email.1und1.de \
    --to=stefan.wahren@i2se.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eric@anholt.net \
    --cc=f.fainelli@gmail.com \
    --cc=freude@linux.vnet.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=martin@kaiser.cx \
    --cc=mpm@selenic.com \
    --cc=prasannatsmkumar@gmail.com \
    --cc=rjui@broadcom.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=s.trumtrar@pengutronix.de \
    --cc=sbranden@broadcom.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®