From: "Heiko Stübner" <heiko@sntech.de>
To: Robin Murphy <robin.murphy@arm.com>,
LABBE Corentin <clabbe@baylibre.com>
Cc: herbert@gondor.apana.org.au, krzk+dt@kernel.org,
mturquette@baylibre.com, robh+dt@kernel.org, sboyd@kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v3 18/26] arm64: dts: rockchip: rk3399: add crypto node
Date: Wed, 23 Mar 2022 17:28:24 +0100 [thread overview]
Message-ID: <1898921.yKVeVyVuyW@diego> (raw)
In-Reply-To: <YjsfIbLQRvoxkana@Red>
Am Mittwoch, 23. März 2022, 14:22:41 CET schrieb LABBE Corentin:
> Le Tue, Mar 22, 2022 at 12:00:06PM +0000, Robin Murphy a écrit :
> > On 2022-03-21 20:07, Corentin Labbe wrote:
> > > The rk3399 has a crypto IP handled by the rk3288 crypto driver so adds a
> > > node for it.
> > >
> > > Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> > > ---
> > > arch/arm64/boot/dts/rockchip/rk3399.dtsi | 12 ++++++++++++
> > > 1 file changed, 12 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > index 88f26d89eea1..ca2c658371a5 100644
> > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > @@ -573,6 +573,18 @@ saradc: saradc@ff100000 {
> > > status = "disabled";
> > > };
> > >
> > > + crypto0: crypto@ff8b0000 {
> > > + compatible = "rockchip,rk3399-crypto";
> > > + reg = <0x0 0xff8b0000 0x0 0x4000>,
> > > + <0x0 0xff8b8000 0x0 0x4000>;
> > > + interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH 0>,
> > > + <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH 0>;
> > > + clocks = <&cru SCLK_CRYPTO0>, <&cru HCLK_M_CRYPTO0>, <&cru HCLK_S_CRYPTO0>,
> > > + <&cru SCLK_CRYPTO1>, <&cru HCLK_M_CRYPTO1>, <&cru HCLK_S_CRYPTO1>;
> > > + resets = <&cru SRST_CRYPTO0>, <&cru SRST_CRYPTO0_S>, <&cru SRST_CRYPTO0_M>,
> > > + <&cru SRST_CRYPTO1>, <&cru SRST_CRYPTO1_S>, <&cru SRST_CRYPTO1_M>;
> > > + };
> >
> > What's going on here? If these are simply two instances of the same IP
> > block as the evidence suggests, why are they crammed into a single DT
> > node rather than simply being described as two separate instances? I was
> > rather wondering what all the confusing mess in patch #16 was about,
> > until I got here.
> >
> > If there's something in the crypto API that means the driver can't
> > simply naively register itself multiple times, there should be any
> > number of ways for the probe routine to keep track of whether it's
> > already registered something and associate any subsequent devices with
> > the first one internally if need be. Linux implementation details should
> > not leak out as non-standard DT weirdness.
> >
> > I know the Rockchip IOMMU driver does this, but in that case the two
> > IOMMU instances are closely coupled and sharing work such that they
> > effectively need to be programmed identically at all times, so it was a
> > bit more justifiable. I don't know the full story here, but it certainly
> > looks like rk_get_engine_number() is just a means to schedule work on
> > any available unit independently, so looks like it wouldn't take much to
> > select between distinct devices at that point, and actually end up a lot
> > simpler and cleaner overall.
>
> Yes rk3399 has 2 instances of the same IP (Exception: crypto1 does not have RSA).
>
> The problem is that only one drivername (like rk-md5) could exists.
> If crypto0 and crypto1 register with different drivername (rk-md5-0/rk-md5-1), only one will be used anyway.
> So I merged them into only one instance.
> I think this way will be easier, but you are right, this is not pretty.
>
> I found another way with 2 nodes:
> You could preview it at https://github.com/montjoie/linux/tree/cryptorockchipv4
> Basicly the crypto0 is a normal instance, and crypto1 "registers" itself against crypto0.
> So if crypto0 know another instance exists it will load balance requests.
The DT-nodes in that branch are
@@ -573,6 +573,22 @@
status = "disabled";
};
+ crypto0: crypto@ff8b0000 {
+ compatible = "rockchip,rk3399-crypto0";
+ reg = <0x0 0xff8b0000 0x0 0x4000>;
+ interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&cru SCLK_CRYPTO0>, <&cru HCLK_M_CRYPTO0>, <&cru HCLK_S_CRYPTO0>;
+ resets = <&cru SRST_CRYPTO0>, <&cru SRST_CRYPTO0_S>, <&cru SRST_CRYPTO0_M>;
+ };
+
+ crypto1: crypto@ff8b8000 {
+ compatible = "rockchip,rk3399-crypto1";
+ reg = <0x0 0xff8b8000 0x0 0x4000>;
+ interrupts = <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&cru SCLK_CRYPTO1>, <&cru HCLK_M_CRYPTO1>, <&cru HCLK_S_CRYPTO1>;
+ resets = <&cru SRST_CRYPTO1>, <&cru SRST_CRYPTO1_S>, <&cru SRST_CRYPTO1_M>;
+ };
+
i2c1: i2c@ff110000 {
compatible = "rockchip,rk3399-i2c";
reg = <0x0 0xff110000 0x0 0x1000>;
which looks at lot better :-) .
I'm not sure about the different compatibles yet, but as the blocks
are really _not_ the same implementation that actually does make sense
[i.e. one not having RSA]
Though I think you'll need to update the binding for them.
Heiko
next prev parent reply other threads:[~2022-03-23 16:28 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 20:07 [PATCH v3 00/26] crypto: rockchip: permit to pass self-tests Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 01/26] crypto: rockchip: use dev_err for error message about interrupt Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 02/26] crypto: rockchip: do not use uninit variable Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 03/26] crypto: rockchip: do not do custom power management Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 04/26] crypto: rockchip: fix privete/private typo Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 05/26] crypto: rockchip: do not store mode globally Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 06/26] crypto: rockchip: add fallback for cipher Corentin Labbe
2022-03-22 11:25 ` Robin Murphy
2022-03-23 13:07 ` LABBE Corentin
2022-03-21 20:07 ` [PATCH v3 07/26] crypto: rockchip: add fallback for ahash Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 08/26] crypto: rockchip: better handle cipher key Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 09/26] crypto: rockchip: remove non-aligned handling Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 10/26] crypto: rockchip: rework by using crypto_engine Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 11/26] crypto: rockchip: rewrite type Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 12/26] crypto: rockchip: add debugfs Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 13/26] crypto: rockchip: introduce PM Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 14/26] crypto: rockchip: handle reset also in PM Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 15/26] crypto: rockchip: use clk_bulk to simplify clock management Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 16/26] crypto: rockchip: add support for r3399 Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 17/26] clk: rk3399: use proper crypto0 name Corentin Labbe
2022-03-25 0:41 ` Stephen Boyd
2022-03-25 7:40 ` LABBE Corentin
2022-03-25 16:52 ` Stephen Boyd
2022-03-21 20:07 ` [PATCH v3 18/26] arm64: dts: rockchip: rk3399: add crypto node Corentin Labbe
2022-03-22 12:00 ` Robin Murphy
2022-03-23 13:22 ` LABBE Corentin
2022-03-23 16:28 ` Heiko Stübner [this message]
2022-03-21 20:07 ` [PATCH v3 19/26] arm64: dts: rockchip: add rk3328 " Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 20/26] ARM: dts: rk3288: crypto does not need reset-names anymore Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 21/26] dt-bindings: crypto: convert rockchip-crypto to yaml Corentin Labbe
2022-03-22 1:50 ` Rob Herring
2022-03-22 9:12 ` LABBE Corentin
2022-03-22 18:05 ` Krzysztof Kozlowski
2022-03-22 18:04 ` Krzysztof Kozlowski
2022-03-24 16:20 ` LABBE Corentin
2022-03-24 18:19 ` Krzysztof Kozlowski
2022-03-21 20:07 ` [PATCH v3 22/26] crypto: rockchip: add support for rk3328 Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 23/26] crypto: rockchip: Check for maximum frequency of clocks Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 24/26] crypto: rockchip: add myself as maintainer Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 25/26] crypto: rockchip: fix style issue Corentin Labbe
2022-03-21 20:07 ` [PATCH v3 26/26] crypto: rockchip: use read_poll_timeout Corentin Labbe
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=1898921.yKVeVyVuyW@diego \
--to=heiko@sntech.de \
--cc=clabbe@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=sboyd@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).