Message ID | 20210505213731.538612-17-bhupesh.sharma@linaro.org |
---|---|
State | New |
Headers | show |
Series | Enable Qualcomm Crypto Engine on sm8250 | expand |
On 5/5/21 5:37 PM, Bhupesh Sharma wrote: > On some Qualcomm parts the qce crypto driver needs the interconnect between > the crypto block and main memory to be initialized first before the crypto > registers can be accessed. So it makes sense to defer the qce crypto driver > probing in case the interconnect driver is not yet probed. > > This fixes the qce probe failure issues when both qce and > interconnect drivers are compiled as static part of the kernel. > > Cc: Thara Gopinath <thara.gopinath@linaro.org> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Andy Gross <agross@kernel.org> > Cc: Herbert Xu <herbert@gondor.apana.org.au> > Cc: David S. Miller <davem@davemloft.net> > Cc: Stephen Boyd <sboyd@kernel.org> > Cc: Michael Turquette <mturquette@baylibre.com> > Cc: Vinod Koul <vkoul@kernel.org> > Cc: dmaengine@vger.kernel.org > Cc: linux-clk@vger.kernel.org > Cc: linux-crypto@vger.kernel.org > Cc: devicetree@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: bhupesh.linux@gmail.com > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > --- > drivers/crypto/qce/core.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > index 3e742e9911fa..9915b184f780 100644 > --- a/drivers/crypto/qce/core.c > +++ b/drivers/crypto/qce/core.c > @@ -222,6 +222,20 @@ static int qce_crypto_probe(struct platform_device *pdev) > return ret; > > qce->mem_path = of_icc_get(qce->dev, "memory"); > + > + /* Check for NULL return path, which indicates > + * interconnect API is disabled or the "interconnects" > + * DT property is missing. > + */ > + if (!qce->mem_path) > + /* On some qcom parts, the qce crypto block needs interconnect > + * paths to be configured before the registers can be accessed. > + * Check here for the same. > + */ > + if (!strcmp(of_id->compatible, "qcom,ipq6018-qce") || > + !strcmp(of_id->compatible, "qcom,sdm845-qce")) > + return -EPROBE_DEFER; > + Hi Bhupesh, You don't need this here. of_icc_get returns -EPROBE_DEFER if the interconnect provider is not initialized yet.
unsubscribe
Hi Thara, On Mon, 10 May 2021 at 18:53, Thara Gopinath <thara.gopinath@linaro.org> wrote: > > > > On 5/5/21 5:37 PM, Bhupesh Sharma wrote: > > On some Qualcomm parts the qce crypto driver needs the interconnect between > > the crypto block and main memory to be initialized first before the crypto > > registers can be accessed. So it makes sense to defer the qce crypto driver > > probing in case the interconnect driver is not yet probed. > > > > This fixes the qce probe failure issues when both qce and > > interconnect drivers are compiled as static part of the kernel. > > > > Cc: Thara Gopinath <thara.gopinath@linaro.org> > > Cc: Bjorn Andersson <bjorn.andersson@linaro.org> > > Cc: Rob Herring <robh+dt@kernel.org> > > Cc: Andy Gross <agross@kernel.org> > > Cc: Herbert Xu <herbert@gondor.apana.org.au> > > Cc: David S. Miller <davem@davemloft.net> > > Cc: Stephen Boyd <sboyd@kernel.org> > > Cc: Michael Turquette <mturquette@baylibre.com> > > Cc: Vinod Koul <vkoul@kernel.org> > > Cc: dmaengine@vger.kernel.org > > Cc: linux-clk@vger.kernel.org > > Cc: linux-crypto@vger.kernel.org > > Cc: devicetree@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > Cc: bhupesh.linux@gmail.com > > Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> > > --- > > drivers/crypto/qce/core.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c > > index 3e742e9911fa..9915b184f780 100644 > > --- a/drivers/crypto/qce/core.c > > +++ b/drivers/crypto/qce/core.c > > @@ -222,6 +222,20 @@ static int qce_crypto_probe(struct platform_device *pdev) > > return ret; > > > > qce->mem_path = of_icc_get(qce->dev, "memory"); > > + > > + /* Check for NULL return path, which indicates > > + * interconnect API is disabled or the "interconnects" > > + * DT property is missing. > > + */ > > + if (!qce->mem_path) > > + /* On some qcom parts, the qce crypto block needs interconnect > > + * paths to be configured before the registers can be accessed. > > + * Check here for the same. > > + */ > > + if (!strcmp(of_id->compatible, "qcom,ipq6018-qce") || > > + !strcmp(of_id->compatible, "qcom,sdm845-qce")) > > + return -EPROBE_DEFER; > > + > > Hi Bhupesh, > > You don't need this here. of_icc_get returns -EPROBE_DEFER if the > interconnect provider is not initialized yet. Thanks for the review. Yes, I finished testing all the possible combinations with qce, bam dma and interconnect drivers compiled as modules v/s as static parts of the kernel and we don't need this extra check for the interconnect here. We should be fine with checking just the qce_dma_request() return value and returning early in the qce probe() flow if no dma channels are yet available from the bam dma driver. I have made the changes in v3 and will post it for review shortly. Regards, Bhupesh
diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index 3e742e9911fa..9915b184f780 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -222,6 +222,20 @@ static int qce_crypto_probe(struct platform_device *pdev) return ret; qce->mem_path = of_icc_get(qce->dev, "memory"); + + /* Check for NULL return path, which indicates + * interconnect API is disabled or the "interconnects" + * DT property is missing. + */ + if (!qce->mem_path) + /* On some qcom parts, the qce crypto block needs interconnect + * paths to be configured before the registers can be accessed. + * Check here for the same. + */ + if (!strcmp(of_id->compatible, "qcom,ipq6018-qce") || + !strcmp(of_id->compatible, "qcom,sdm845-qce")) + return -EPROBE_DEFER; + if (IS_ERR(qce->mem_path)) return PTR_ERR(qce->mem_path);
On some Qualcomm parts the qce crypto driver needs the interconnect between the crypto block and main memory to be initialized first before the crypto registers can be accessed. So it makes sense to defer the qce crypto driver probing in case the interconnect driver is not yet probed. This fixes the qce probe failure issues when both qce and interconnect drivers are compiled as static part of the kernel. Cc: Thara Gopinath <thara.gopinath@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Andy Gross <agross@kernel.org> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: David S. Miller <davem@davemloft.net> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Michael Turquette <mturquette@baylibre.com> Cc: Vinod Koul <vkoul@kernel.org> Cc: dmaengine@vger.kernel.org Cc: linux-clk@vger.kernel.org Cc: linux-crypto@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: bhupesh.linux@gmail.com Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> --- drivers/crypto/qce/core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.30.2