linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs
       [not found] <cover.1496255334.git.sean.wang@mediatek.com>
@ 2017-05-31 18:44 ` sean.wang
  2017-06-06 11:07   ` Matthias Brugger
  2017-05-31 18:44 ` [PATCH 2/4] hwrng: mtk - add support for MT7622 SoC sean.wang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: sean.wang @ 2017-05-31 18:44 UTC (permalink / raw)
  To: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson
  Cc: weiyongjun1, devicetree, linux-crypto, linux-mediatek,
	linux-arm-kernel, linux-kernel, keyhaede, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

Add the generic binding for allowing the support of RNG on MediaTek SoCs
such as MT7622.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 Documentation/devicetree/bindings/rng/mtk-rng.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.txt b/Documentation/devicetree/bindings/rng/mtk-rng.txt
index a6d62a2..0772913 100644
--- a/Documentation/devicetree/bindings/rng/mtk-rng.txt
+++ b/Documentation/devicetree/bindings/rng/mtk-rng.txt
@@ -2,7 +2,8 @@ Device-Tree bindings for Mediatek random number generator
 found in Mediatek SoC family
 
 Required properties:
-- compatible	    : Should be "mediatek,mt7623-rng"
+- compatible	    : Should be "mediatek,generic-rng" or
+				"mediatek,mt7623-rng".
 - clocks	    : list of clock specifiers, corresponding to
 		      entries in clock-names property;
 - clock-names	    : Should contain "rng" entries;
-- 
1.9.1

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

* [PATCH 2/4] hwrng: mtk - add support for MT7622 SoC
       [not found] <cover.1496255334.git.sean.wang@mediatek.com>
  2017-05-31 18:44 ` [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs sean.wang
@ 2017-05-31 18:44 ` sean.wang
  2017-05-31 18:44 ` [PATCH 3/4] hwrng: mtk - add runtime PM support sean.wang
  2017-05-31 18:44 ` [PATCH 4/4] MAINTAINERS: add entry for MediaTek Random Number Generator sean.wang
  3 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2017-05-31 18:44 UTC (permalink / raw)
  To: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson
  Cc: weiyongjun1, devicetree, linux-crypto, linux-mediatek,
	linux-arm-kernel, linux-kernel, keyhaede, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

Add "mediatek,generic-rng" allowing most of RNG on MediaTek SoCs to be
compatible with the driver including MT7622 SoC.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/char/hw_random/mtk-rng.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
index df8eb54..3a1e1f1 100644
--- a/drivers/char/hw_random/mtk-rng.c
+++ b/drivers/char/hw_random/mtk-rng.c
@@ -148,6 +148,7 @@ static int mtk_rng_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id mtk_rng_match[] = {
+	{ .compatible = "mediatek,generic-rng" },
 	{ .compatible = "mediatek,mt7623-rng" },
 	{},
 };
-- 
1.9.1

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

* [PATCH 3/4] hwrng: mtk - add runtime PM support
       [not found] <cover.1496255334.git.sean.wang@mediatek.com>
  2017-05-31 18:44 ` [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs sean.wang
  2017-05-31 18:44 ` [PATCH 2/4] hwrng: mtk - add support for MT7622 SoC sean.wang
@ 2017-05-31 18:44 ` sean.wang
  2017-05-31 18:44 ` [PATCH 4/4] MAINTAINERS: add entry for MediaTek Random Number Generator sean.wang
  3 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2017-05-31 18:44 UTC (permalink / raw)
  To: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson
  Cc: weiyongjun1, devicetree, linux-crypto, linux-mediatek,
	linux-arm-kernel, linux-kernel, keyhaede, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

Add runtime PM support.  There will be the benefit on SoCs where the
clock to the RNG used can be shutdown.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/char/hw_random/mtk-rng.c | 42 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
index 3a1e1f1..59ded4e 100644
--- a/drivers/char/hw_random/mtk-rng.c
+++ b/drivers/char/hw_random/mtk-rng.c
@@ -25,6 +25,10 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+/* Runtime PM autosuspend timeout: */
+#define RNG_AUTOSUSPEND_TIMEOUT		100
 
 #define USEC_POLL			2
 #define TIMEOUT_POLL			20
@@ -90,6 +94,8 @@ static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
 	struct mtk_rng *priv = to_mtk_rng(rng);
 	int retval = 0;
 
+	pm_runtime_get_sync((struct device *)priv->rng.priv);
+
 	while (max >= sizeof(u32)) {
 		if (!mtk_rng_wait_ready(rng, wait))
 			break;
@@ -100,6 +106,9 @@ static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
 		max -= sizeof(u32);
 	}
 
+	pm_runtime_mark_last_busy((struct device *)priv->rng.priv);
+	pm_runtime_put_sync_autosuspend((struct device *)priv->rng.priv);
+
 	return retval || !wait ? retval : -EIO;
 }
 
@@ -120,9 +129,12 @@ static int mtk_rng_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	priv->rng.name = pdev->name;
+#ifndef CONFIG_PM
 	priv->rng.init = mtk_rng_init;
 	priv->rng.cleanup = mtk_rng_cleanup;
+#endif
 	priv->rng.read = mtk_rng_read;
+	priv->rng.priv = (unsigned long)&pdev->dev;
 
 	priv->clk = devm_clk_get(&pdev->dev, "rng");
 	if (IS_ERR(priv->clk)) {
@@ -142,11 +154,40 @@ static int mtk_rng_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	dev_set_drvdata(&pdev->dev, priv);
+	pm_runtime_set_autosuspend_delay(&pdev->dev, RNG_AUTOSUSPEND_TIMEOUT);
+	pm_runtime_use_autosuspend(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	dev_info(&pdev->dev, "registered RNG driver\n");
 
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int mtk_rng_runtime_suspend(struct device *dev)
+{
+	struct mtk_rng *priv = dev_get_drvdata(dev);
+
+	mtk_rng_cleanup(&priv->rng);
+
+	return 0;
+}
+
+static int mtk_rng_runtime_resume(struct device *dev)
+{
+	struct mtk_rng *priv = dev_get_drvdata(dev);
+
+	return mtk_rng_init(&priv->rng);
+}
+
+static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend,
+			    mtk_rng_runtime_resume, NULL);
+#define MTK_RNG_PM_OPS (&mtk_rng_pm_ops)
+#else	/* CONFIG_PM */
+#define MTK_RNG_PM_OPS NULL
+#endif	/* CONFIG_PM */
+
 static const struct of_device_id mtk_rng_match[] = {
 	{ .compatible = "mediatek,generic-rng" },
 	{ .compatible = "mediatek,mt7623-rng" },
@@ -158,6 +199,7 @@ static int mtk_rng_probe(struct platform_device *pdev)
 	.probe          = mtk_rng_probe,
 	.driver = {
 		.name = MTK_RNG_DEV,
+		.pm = MTK_RNG_PM_OPS,
 		.of_match_table = mtk_rng_match,
 	},
 };
-- 
1.9.1

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

* [PATCH 4/4] MAINTAINERS: add entry for MediaTek Random Number Generator
       [not found] <cover.1496255334.git.sean.wang@mediatek.com>
                   ` (2 preceding siblings ...)
  2017-05-31 18:44 ` [PATCH 3/4] hwrng: mtk - add runtime PM support sean.wang
@ 2017-05-31 18:44 ` sean.wang
  3 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2017-05-31 18:44 UTC (permalink / raw)
  To: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson
  Cc: weiyongjun1, devicetree, linux-crypto, linux-mediatek,
	linux-arm-kernel, linux-kernel, keyhaede, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

I work for MediaTek on maintaining the MediaTek RNG driver
for the existing SoCs and adding support for the following
SoCs.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 MAINTAINERS | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index cf86519..da473d0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8262,6 +8262,11 @@ L:	linux-wireless@vger.kernel.org
 S:	Maintained
 F:	drivers/net/wireless/mediatek/mt7601u/
 
+MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
+M:      Sean Wang <sean.wang@mediatek.com>
+S:      Maintained
+F:      drivers/char/hw_random/mtk-rng.c
+
 MEGACHIPS STDPXXXX-GE-B850V3-FW LVDS/DP++ BRIDGES
 M:	Peter Senna Tschudin <peter.senna@collabora.com>
 M:	Martin Donnelly <martin.donnelly@ge.com>
-- 
1.9.1

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

* Re: [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs
  2017-05-31 18:44 ` [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs sean.wang
@ 2017-06-06 11:07   ` Matthias Brugger
  2017-06-07 13:20     ` Sean Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Brugger @ 2017-06-06 11:07 UTC (permalink / raw)
  To: sean.wang, herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson
  Cc: devicetree, keyhaede, linux-kernel, linux-mediatek, linux-crypto,
	weiyongjun1, linux-arm-kernel



On 31/05/17 20:44, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Add the generic binding for allowing the support of RNG on MediaTek SoCs
> such as MT7622.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>   Documentation/devicetree/bindings/rng/mtk-rng.txt | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.txt b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> index a6d62a2..0772913 100644
> --- a/Documentation/devicetree/bindings/rng/mtk-rng.txt
> +++ b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> @@ -2,7 +2,8 @@ Device-Tree bindings for Mediatek random number generator
>   found in Mediatek SoC family
>   
>   Required properties:
> -- compatible	    : Should be "mediatek,mt7623-rng"
> +- compatible	    : Should be "mediatek,generic-rng" or
> +				"mediatek,mt7623-rng".

What does generic-rng mean. Is it for all mt7xxx, or also for mt6xxx and 
mt8xxx based SoCs? I think we should stick with SoC specific bindings, 
as we don't know if Mediatek won't publish a new IP block next year 
which is differnet.

Just in case we should add a binding for the actual SoC + a fallback. 
For example.
- compatible " Should be
	"mediatek,mt7622-rng", 	"mediatek,mt7623-rng" for SoC mt7622
	"mediatek,mt7623-rng" for SoC mt7623

This will also eliminate the need of adding mt6722-rng to the driver, as 
it will use mt7623-rng as fallback. If in the future we realize that 
mt7622-rng has a extra feature/bug, we can still work around it, without 
breaking the bindings.

Makes sense?

Regards,
Matthias

>   - clocks	    : list of clock specifiers, corresponding to
>   		      entries in clock-names property;
>   - clock-names	    : Should contain "rng" entries;
> 

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

* Re: [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs
  2017-06-06 11:07   ` Matthias Brugger
@ 2017-06-07 13:20     ` Sean Wang
  2017-06-07 13:25       ` Matthias Brugger
  0 siblings, 1 reply; 8+ messages in thread
From: Sean Wang @ 2017-06-07 13:20 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson, devicetree,
	keyhaede, linux-kernel, linux-mediatek, linux-crypto,
	weiyongjun1, linux-arm-kernel

On Tue, 2017-06-06 at 13:07 +0200, Matthias Brugger wrote:
> 
> On 31/05/17 20:44, sean.wang@mediatek.com wrote:
> > From: Sean Wang <sean.wang@mediatek.com>
> > 
> > Add the generic binding for allowing the support of RNG on MediaTek SoCs
> > such as MT7622.
> > 
> > Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> > ---
> >   Documentation/devicetree/bindings/rng/mtk-rng.txt | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.txt b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> > index a6d62a2..0772913 100644
> > --- a/Documentation/devicetree/bindings/rng/mtk-rng.txt
> > +++ b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> > @@ -2,7 +2,8 @@ Device-Tree bindings for Mediatek random number generator
> >   found in Mediatek SoC family
> >   
> >   Required properties:
> > -- compatible	    : Should be "mediatek,mt7623-rng"
> > +- compatible	    : Should be "mediatek,generic-rng" or
> > +				"mediatek,mt7623-rng".
> 
> What does generic-rng mean. Is it for all mt7xxx, or also for mt6xxx and 
> mt8xxx based SoCs? I think we should stick with SoC specific bindings, 
> as we don't know if Mediatek won't publish a new IP block next year 
> which is differnet.
> 

Yes, what I mean is generic-rng can be applied to all
platform MediaTek provides. 


> Just in case we should add a binding for the actual SoC + a fallback. 
> For example.
> - compatible " Should be
> 	"mediatek,mt7622-rng", 	"mediatek,mt7623-rng" for SoC mt7622
> 	"mediatek,mt7623-rng" for SoC mt7623
> 
> This will also eliminate the need of adding mt6722-rng to the driver, as 
> it will use mt7623-rng as fallback. If in the future we realize that 
> mt7622-rng has a extra feature/bug, we can still work around it, without 
> breaking the bindings.
> 

I knew the fallback rules you said here because I saw them being used in
many drivers such as sysirq and uart driver, such kind of basic drivers.

These drivers are basic enough, various following chipsets almost fall
back into the oldest one. So the clues let me think the hardware
interface shouldn't have too much differences among them.

If there is string used like generic-uart or generic-sysirq, it can
stop we blindly add new string into the binding document when a new
platform is introduced. 

And they easily allows users unfamiliar MediaTek platform (they didn't
know what the oldest MediaTek chipset is) pick up the right compatible
string to start bring up the new platform. 

The specific one can be added after new feature required is added or
critical hardware bug is found. Otherwise the generic one can fit 
all generic needs for those.

Those are only opinions, if you don't like it, I still can accept the
original way as you suggest :)


> Makes sense?
> 
> Regards,
> Matthias
> 
> >   - clocks	    : list of clock specifiers, corresponding to
> >   		      entries in clock-names property;
> >   - clock-names	    : Should contain "rng" entries;
> > 

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

* Re: [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs
  2017-06-07 13:20     ` Sean Wang
@ 2017-06-07 13:25       ` Matthias Brugger
  2017-06-07 14:48         ` Sean Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Brugger @ 2017-06-07 13:25 UTC (permalink / raw)
  To: Sean Wang
  Cc: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson, devicetree,
	keyhaede, linux-kernel, linux-mediatek, linux-crypto,
	weiyongjun1, linux-arm-kernel



On 07/06/17 15:20, Sean Wang wrote:
> On Tue, 2017-06-06 at 13:07 +0200, Matthias Brugger wrote:
>>
>> On 31/05/17 20:44, sean.wang@mediatek.com wrote:
>>> From: Sean Wang <sean.wang@mediatek.com>
>>>
>>> Add the generic binding for allowing the support of RNG on MediaTek SoCs
>>> such as MT7622.
>>>
>>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>>> ---
>>>    Documentation/devicetree/bindings/rng/mtk-rng.txt | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.txt b/Documentation/devicetree/bindings/rng/mtk-rng.txt
>>> index a6d62a2..0772913 100644
>>> --- a/Documentation/devicetree/bindings/rng/mtk-rng.txt
>>> +++ b/Documentation/devicetree/bindings/rng/mtk-rng.txt
>>> @@ -2,7 +2,8 @@ Device-Tree bindings for Mediatek random number generator
>>>    found in Mediatek SoC family
>>>    
>>>    Required properties:
>>> -- compatible	    : Should be "mediatek,mt7623-rng"
>>> +- compatible	    : Should be "mediatek,generic-rng" or
>>> +				"mediatek,mt7623-rng".
>>
>> What does generic-rng mean. Is it for all mt7xxx, or also for mt6xxx and
>> mt8xxx based SoCs? I think we should stick with SoC specific bindings,
>> as we don't know if Mediatek won't publish a new IP block next year
>> which is differnet.
>>
> 
> Yes, what I mean is generic-rng can be applied to all
> platform MediaTek provides.
> 
> 
>> Just in case we should add a binding for the actual SoC + a fallback.
>> For example.
>> - compatible " Should be
>> 	"mediatek,mt7622-rng", 	"mediatek,mt7623-rng" for SoC mt7622
>> 	"mediatek,mt7623-rng" for SoC mt7623
>>
>> This will also eliminate the need of adding mt6722-rng to the driver, as
>> it will use mt7623-rng as fallback. If in the future we realize that
>> mt7622-rng has a extra feature/bug, we can still work around it, without
>> breaking the bindings.
>>
> 
> I knew the fallback rules you said here because I saw them being used in
> many drivers such as sysirq and uart driver, such kind of basic drivers.
> 
> These drivers are basic enough, various following chipsets almost fall
> back into the oldest one. So the clues let me think the hardware
> interface shouldn't have too much differences among them.
> 
> If there is string used like generic-uart or generic-sysirq, it can
> stop we blindly add new string into the binding document when a new
> platform is introduced.
> 
> And they easily allows users unfamiliar MediaTek platform (they didn't
> know what the oldest MediaTek chipset is) pick up the right compatible
> string to start bring up the new platform.
> 
> The specific one can be added after new feature required is added or
> critical hardware bug is found. Otherwise the generic one can fit
> all generic needs for those.
> 
> Those are only opinions, if you don't like it, I still can accept the
> original way as you suggest :)
> 

I can see your reasoning, but the device tree maintainers prefer to have 
the bindings updated for a new SoC. As I mentioned before, just imagine 
next year Mediatek changes the IP block and from now on, it uses the new 
device in all SoCs. In 5 years we would have a binding which states 
'generic' although it is not compatible with any SoC of the last So

So please keep with the bindings as done up to now.

Best regards,
Matthias

> 
>> Makes sense?
>>
>> Regards,
>> Matthias
>>
>>>    - clocks	    : list of clock specifiers, corresponding to
>>>    		      entries in clock-names property;
>>>    - clock-names	    : Should contain "rng" entries;
>>>
> 
> 

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

* Re: [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs
  2017-06-07 13:25       ` Matthias Brugger
@ 2017-06-07 14:48         ` Sean Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Sean Wang @ 2017-06-07 14:48 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: herbert, mpm, robh+dt, mark.rutland, clabbe.montjoie,
	prasannatsmkumar, romain.perier, shannon.nelson, devicetree,
	keyhaede, linux-kernel, linux-mediatek, linux-crypto,
	weiyongjun1, linux-arm-kernel

On Wed, 2017-06-07 at 15:25 +0200, Matthias Brugger wrote:
> 
> On 07/06/17 15:20, Sean Wang wrote:
> > On Tue, 2017-06-06 at 13:07 +0200, Matthias Brugger wrote:
> >>
> >> On 31/05/17 20:44, sean.wang@mediatek.com wrote:
> >>> From: Sean Wang <sean.wang@mediatek.com>
> >>>
> >>> Add the generic binding for allowing the support of RNG on MediaTek SoCs
> >>> such as MT7622.
> >>>
> >>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> >>> ---
> >>>    Documentation/devicetree/bindings/rng/mtk-rng.txt | 3 ++-
> >>>    1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.txt b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> >>> index a6d62a2..0772913 100644
> >>> --- a/Documentation/devicetree/bindings/rng/mtk-rng.txt
> >>> +++ b/Documentation/devicetree/bindings/rng/mtk-rng.txt
> >>> @@ -2,7 +2,8 @@ Device-Tree bindings for Mediatek random number generator
> >>>    found in Mediatek SoC family
> >>>    
> >>>    Required properties:
> >>> -- compatible	    : Should be "mediatek,mt7623-rng"
> >>> +- compatible	    : Should be "mediatek,generic-rng" or
> >>> +				"mediatek,mt7623-rng".
> >>
> >> What does generic-rng mean. Is it for all mt7xxx, or also for mt6xxx and
> >> mt8xxx based SoCs? I think we should stick with SoC specific bindings,
> >> as we don't know if Mediatek won't publish a new IP block next year
> >> which is differnet.
> >>
> > 
> > Yes, what I mean is generic-rng can be applied to all
> > platform MediaTek provides.
> > 
> > 
> >> Just in case we should add a binding for the actual SoC + a fallback.
> >> For example.
> >> - compatible " Should be
> >> 	"mediatek,mt7622-rng", 	"mediatek,mt7623-rng" for SoC mt7622
> >> 	"mediatek,mt7623-rng" for SoC mt7623
> >>
> >> This will also eliminate the need of adding mt6722-rng to the driver, as
> >> it will use mt7623-rng as fallback. If in the future we realize that
> >> mt7622-rng has a extra feature/bug, we can still work around it, without
> >> breaking the bindings.
> >>
> > 
> > I knew the fallback rules you said here because I saw them being used in
> > many drivers such as sysirq and uart driver, such kind of basic drivers.
> > 
> > These drivers are basic enough, various following chipsets almost fall
> > back into the oldest one. So the clues let me think the hardware
> > interface shouldn't have too much differences among them.
> > 
> > If there is string used like generic-uart or generic-sysirq, it can
> > stop we blindly add new string into the binding document when a new
> > platform is introduced.
> > 
> > And they easily allows users unfamiliar MediaTek platform (they didn't
> > know what the oldest MediaTek chipset is) pick up the right compatible
> > string to start bring up the new platform.
> > 
> > The specific one can be added after new feature required is added or
> > critical hardware bug is found. Otherwise the generic one can fit
> > all generic needs for those.
> > 
> > Those are only opinions, if you don't like it, I still can accept the
> > original way as you suggest :)
> > 
> 
> I can see your reasoning, but the device tree maintainers prefer to have 
> the bindings updated for a new SoC. As I mentioned before, just imagine 
> next year Mediatek changes the IP block and from now on, it uses the new 
> device in all SoCs. In 5 years we would have a binding which states 
> 'generic' although it is not compatible with any SoC of the last So
> 
> So please keep with the bindings as done up to now.

Understood, I'll follow up. 

And that also reminds me that all missing bindings need to be added for
each driver on the MT7623 which can fall back to other existing SoCs.

Thank you a lot

	Sean

> 
> Best regards,
> Matthias
> 
> > 
> >> Makes sense?
> >>
> >> Regards,
> >> Matthias
> >>
> >>>    - clocks	    : list of clock specifiers, corresponding to
> >>>    		      entries in clock-names property;
> >>>    - clock-names	    : Should contain "rng" entries;
> >>>
> > 
> > 

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

end of thread, other threads:[~2017-06-07 14:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1496255334.git.sean.wang@mediatek.com>
2017-05-31 18:44 ` [PATCH 1/4] dt-bindings: rng: add generic bindings for MediaTek SoCs sean.wang
2017-06-06 11:07   ` Matthias Brugger
2017-06-07 13:20     ` Sean Wang
2017-06-07 13:25       ` Matthias Brugger
2017-06-07 14:48         ` Sean Wang
2017-05-31 18:44 ` [PATCH 2/4] hwrng: mtk - add support for MT7622 SoC sean.wang
2017-05-31 18:44 ` [PATCH 3/4] hwrng: mtk - add runtime PM support sean.wang
2017-05-31 18:44 ` [PATCH 4/4] MAINTAINERS: add entry for MediaTek Random Number Generator sean.wang

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