* [PATCH v1 0/2] rng: npcm: add Arbel NPCM8XX support @ 2022-09-22 14:22 Tomer Maimon 2022-09-22 14:22 ` [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string Tomer Maimon 2022-09-22 14:22 ` [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support Tomer Maimon 0 siblings, 2 replies; 7+ messages in thread From: Tomer Maimon @ 2022-09-22 14:22 UTC (permalink / raw) To: avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree, Tomer Maimon This patch set adds Arbel NPCM8XX Random Number Generator(RNG) support to RNG NPCM driver. The NPCM8XX RNG uses different prescalar clock value. The NPCM RNG driver was tested on the NPCM845 evaluation board. Tomer Maimon (2): dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string hwrng: npcm: Add NPCM8XX support .../bindings/rng/nuvoton,npcm-rng.yaml | 4 +++- drivers/char/hw_random/npcm-rng.c | 21 ++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string 2022-09-22 14:22 [PATCH v1 0/2] rng: npcm: add Arbel NPCM8XX support Tomer Maimon @ 2022-09-22 14:22 ` Tomer Maimon 2022-09-22 15:08 ` Krzysztof Kozlowski 2022-09-22 17:29 ` Krzysztof Kozlowski 2022-09-22 14:22 ` [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support Tomer Maimon 1 sibling, 2 replies; 7+ messages in thread From: Tomer Maimon @ 2022-09-22 14:22 UTC (permalink / raw) To: avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree, Tomer Maimon Add a compatible string for Nuvoton BMC NPCM845 RNG. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> --- Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml b/Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml index abd134c9d400..e0071faa00f0 100644 --- a/Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml +++ b/Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml @@ -16,7 +16,9 @@ maintainers: properties: compatible: - const: nuvoton,npcm750-rng + enum: + - nuvoton,npcm750-rng + - nuvoton,npcm845-rng reg: maxItems: 1 -- 2.33.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string 2022-09-22 14:22 ` [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string Tomer Maimon @ 2022-09-22 15:08 ` Krzysztof Kozlowski 2022-09-22 17:30 ` Krzysztof Kozlowski 2022-09-22 17:29 ` Krzysztof Kozlowski 1 sibling, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-09-22 15:08 UTC (permalink / raw) To: Tomer Maimon, avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree On 22/09/2022 16:22, Tomer Maimon wrote: > Add a compatible string for Nuvoton BMC NPCM845 RNG. > > Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> > --- > Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml | 4 +++- Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string 2022-09-22 15:08 ` Krzysztof Kozlowski @ 2022-09-22 17:30 ` Krzysztof Kozlowski 0 siblings, 0 replies; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-09-22 17:30 UTC (permalink / raw) To: Tomer Maimon, avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree On 22/09/2022 17:08, Krzysztof Kozlowski wrote: > On 22/09/2022 16:22, Tomer Maimon wrote: >> Add a compatible string for Nuvoton BMC NPCM845 RNG. >> >> Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> >> --- >> Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml | 4 +++- > > > Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> And un-acked. Test your patches. Please run `make dt_binding_check` (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string 2022-09-22 14:22 ` [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string Tomer Maimon 2022-09-22 15:08 ` Krzysztof Kozlowski @ 2022-09-22 17:29 ` Krzysztof Kozlowski 1 sibling, 0 replies; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-09-22 17:29 UTC (permalink / raw) To: Tomer Maimon Cc: linux-kernel, joel, yuenn, tali.perry1, benjaminfair, krzysztof.kozlowski+dt, avifishman70, devicetree, venture, linux-crypto, olivia, openbmc, robh+dt, herbert On Thu, 22 Sep 2022 17:22:15 +0300, Tomer Maimon wrote: > Add a compatible string for Nuvoton BMC NPCM845 RNG. > > Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> > --- > Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: ./Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.yaml:20:9: [warning] wrong indentation: expected 6 but found 8 (indentation) dtschema/dtc warnings/errors: doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/patch/1681163 This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support 2022-09-22 14:22 [PATCH v1 0/2] rng: npcm: add Arbel NPCM8XX support Tomer Maimon 2022-09-22 14:22 ` [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string Tomer Maimon @ 2022-09-22 14:22 ` Tomer Maimon 2022-09-22 15:08 ` Krzysztof Kozlowski 1 sibling, 1 reply; 7+ messages in thread From: Tomer Maimon @ 2022-09-22 14:22 UTC (permalink / raw) To: avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree, Tomer Maimon Adding RNG NPCM8XX support to NPCM RNG driver. RNG NPCM8XX uses a different clock prescaler. As part of adding NPCM8XX support: - Add NPCM8XX specific compatible string. - Add NPCM8XX specific clock prescaler. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> --- drivers/char/hw_random/npcm-rng.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/char/hw_random/npcm-rng.c b/drivers/char/hw_random/npcm-rng.c index 1ec5f267a656..705be9ccae31 100644 --- a/drivers/char/hw_random/npcm-rng.c +++ b/drivers/char/hw_random/npcm-rng.c @@ -18,10 +18,11 @@ #define NPCM_RNGD_REG 0x04 /* Data register */ #define NPCM_RNGMODE_REG 0x08 /* Mode register */ -#define NPCM_RNG_CLK_SET_25MHZ GENMASK(4, 3) /* 20-25 MHz */ -#define NPCM_RNG_DATA_VALID BIT(1) -#define NPCM_RNG_ENABLE BIT(0) -#define NPCM_RNG_M1ROSEL BIT(1) +#define NPCM_RNG_CLK_SET_25MHZ GENMASK(4, 3) /* 20-25 MHz */ +#define NPCM_RNG_CLK_SET_62_5MHZ BIT(2) /* 60-80 MHz */ +#define NPCM_RNG_DATA_VALID BIT(1) +#define NPCM_RNG_ENABLE BIT(0) +#define NPCM_RNG_M1ROSEL BIT(1) #define NPCM_RNG_TIMEOUT_USEC 20000 #define NPCM_RNG_POLL_USEC 1000 @@ -31,14 +32,14 @@ struct npcm_rng { void __iomem *base; struct hwrng rng; + u32 clkp; }; static int npcm_rng_init(struct hwrng *rng) { struct npcm_rng *priv = to_npcm_rng(rng); - writel(NPCM_RNG_CLK_SET_25MHZ | NPCM_RNG_ENABLE, - priv->base + NPCM_RNGCS_REG); + writel(priv->clkp | NPCM_RNG_ENABLE, priv->base + NPCM_RNGCS_REG); return 0; } @@ -47,7 +48,7 @@ static void npcm_rng_cleanup(struct hwrng *rng) { struct npcm_rng *priv = to_npcm_rng(rng); - writel(NPCM_RNG_CLK_SET_25MHZ, priv->base + NPCM_RNGCS_REG); + writel(priv->clkp, priv->base + NPCM_RNGCS_REG); } static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) @@ -102,6 +103,11 @@ static int npcm_rng_probe(struct platform_device *pdev) pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_enable(&pdev->dev); + if (of_device_is_compatible(pdev->dev.of_node, "nuvoton,npcm750-rng")) + priv->clkp = NPCM_RNG_CLK_SET_25MHZ; + if (of_device_is_compatible(pdev->dev.of_node, "nuvoton,npcm845-rng")) + priv->clkp = NPCM_RNG_CLK_SET_62_5MHZ; + #ifndef CONFIG_PM priv->rng.init = npcm_rng_init; priv->rng.cleanup = npcm_rng_cleanup; @@ -163,6 +169,7 @@ static const struct dev_pm_ops npcm_rng_pm_ops = { static const struct of_device_id rng_dt_id[] __maybe_unused = { { .compatible = "nuvoton,npcm750-rng", }, + { .compatible = "nuvoton,npcm845-rng", }, {}, }; MODULE_DEVICE_TABLE(of, rng_dt_id); -- 2.33.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support 2022-09-22 14:22 ` [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support Tomer Maimon @ 2022-09-22 15:08 ` Krzysztof Kozlowski 0 siblings, 0 replies; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-09-22 15:08 UTC (permalink / raw) To: Tomer Maimon, avifishman70, tali.perry1, joel, venture, yuenn, benjaminfair, olivia, herbert, robh+dt, krzysztof.kozlowski+dt Cc: openbmc, linux-crypto, linux-kernel, devicetree On 22/09/2022 16:22, Tomer Maimon wrote: > static int npcm_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) > @@ -102,6 +103,11 @@ static int npcm_rng_probe(struct platform_device *pdev) > pm_runtime_use_autosuspend(&pdev->dev); > pm_runtime_enable(&pdev->dev); > > + if (of_device_is_compatible(pdev->dev.of_node, "nuvoton,npcm750-rng")) > + priv->clkp = NPCM_RNG_CLK_SET_25MHZ; > + if (of_device_is_compatible(pdev->dev.of_node, "nuvoton,npcm845-rng")) > + priv->clkp = NPCM_RNG_CLK_SET_62_5MHZ; No, don't sprinkle compatibles here and there. Driver data is for this. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-22 17:30 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-22 14:22 [PATCH v1 0/2] rng: npcm: add Arbel NPCM8XX support Tomer Maimon 2022-09-22 14:22 ` [PATCH v1 1/2] dt-bindings: rng: nuvoton,npcm-rng: Add npcm845 compatible string Tomer Maimon 2022-09-22 15:08 ` Krzysztof Kozlowski 2022-09-22 17:30 ` Krzysztof Kozlowski 2022-09-22 17:29 ` Krzysztof Kozlowski 2022-09-22 14:22 ` [PATCH v1 2/2] hwrng: npcm: Add NPCM8XX support Tomer Maimon 2022-09-22 15:08 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox