linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property
@ 2018-04-24 20:25 Fabio Estevam
  2018-05-04  7:19 ` Shawn Guo
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2018-04-24 20:25 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@nxp.com>

Currently the following error is seen from the CAAM driver:

caam 30900000.caam: device ID = 0x0a16030000000000 (Era -524)

Pass the 'fsl,sec-era' property to properly describe the
era information.

This error happens because the 'fsl,sec-era' is not passed via
device tree.

The era information is used in various places inside drivers/crypto/caam,
so pass the correct version via device tree.

Fixes: 0eeabcad7da5 ("ARM: dts: imx7s: add CAAM device node")
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
I have sent a patch for 4.18 that allows retrieving the era information
from the CAAM registers in run-time:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/crypto/caam/ctrl.c?h=next-20180424&id=654f2b937b389295581bcb4aa26011a63db7bc8f

This will only be applied in 4.18 though.

In order to avoid i.MX7 report the incorrect era version in 4.17,
let's pass this property.

 arch/arm/boot/dts/imx7s.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index a6fe324..b416d2b 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -884,6 +884,7 @@
 
 			crypto: caam at 30900000 {
 				compatible = "fsl,sec-v4.0";
+				fsl,sec-era = <8>;
 				#address-cells = <1>;
 				#size-cells = <1>;
 				reg = <0x30900000 0x40000>;
-- 
2.7.4

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

* [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property
  2018-04-24 20:25 [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property Fabio Estevam
@ 2018-05-04  7:19 ` Shawn Guo
  2018-05-04 16:31   ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2018-05-04  7:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 24, 2018 at 05:25:19PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Currently the following error is seen from the CAAM driver:
> 
> caam 30900000.caam: device ID = 0x0a16030000000000 (Era -524)
> 
> Pass the 'fsl,sec-era' property to properly describe the
> era information.
> 
> This error happens because the 'fsl,sec-era' is not passed via
> device tree.
> 
> The era information is used in various places inside drivers/crypto/caam,
> so pass the correct version via device tree.

The property is documented as optional in the bindings.  Missing the
property shouldn't cause any fatal error, I guess.

Shawn

> 
> Fixes: 0eeabcad7da5 ("ARM: dts: imx7s: add CAAM device node")
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> I have sent a patch for 4.18 that allows retrieving the era information
> from the CAAM registers in run-time:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/crypto/caam/ctrl.c?h=next-20180424&id=654f2b937b389295581bcb4aa26011a63db7bc8f
> 
> This will only be applied in 4.18 though.
> 
> In order to avoid i.MX7 report the incorrect era version in 4.17,
> let's pass this property.
> 
>  arch/arm/boot/dts/imx7s.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index a6fe324..b416d2b 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -884,6 +884,7 @@
>  
>  			crypto: caam at 30900000 {
>  				compatible = "fsl,sec-v4.0";
> +				fsl,sec-era = <8>;
>  				#address-cells = <1>;
>  				#size-cells = <1>;
>  				reg = <0x30900000 0x40000>;
> -- 
> 2.7.4
> 

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

* [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property
  2018-05-04  7:19 ` Shawn Guo
@ 2018-05-04 16:31   ` Fabio Estevam
  2018-05-07  1:17     ` Shawn Guo
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2018-05-04 16:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Shawn,

On Fri, May 4, 2018 at 4:19 AM, Shawn Guo <shawnguo@kernel.org> wrote:

> The property is documented as optional in the bindings.  Missing the
> property shouldn't cause any fatal error, I guess.

The CAAM drivers uses the era information in many places:

drivers/crypto/caam/caamalg.c:  if (ctrlpriv->era >= 6) {
drivers/crypto/caam/caamalg.c:  if (ctrlpriv->era < 3)
drivers/crypto/caam/caamalg.c:  if (priv->era >= 6 && uses_dkp)
drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {
drivers/crypto/caam/caamalg_desc.c:     /* Class 2 operation */
drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {
drivers/crypto/caam/caamalg_desc.c:     /* Class 2 operation */
drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {

If the era information is not provided the value of -524 (-ENOTSUPP)
will be used, so all the above logic will not operate correctly.

I have sent a patch that allows the era information to be retrieved
via CAAM registers:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/crypto/caam/ctrl.c?h=next-20180424&id=654f2b937b389295581bcb4aa26011a63db7bc8f

but this will only land in 4.18.

In order to avoid i.MX7 to report the incorrect era information in
4.17 I suggest that this patch should be applied for 4.17-rc.

Also, the other i.mx SoCs pass the fsl,sec-era in their dts.

Thanks

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

* [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property
  2018-05-04 16:31   ` Fabio Estevam
@ 2018-05-07  1:17     ` Shawn Guo
  2018-05-07  1:51       ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2018-05-07  1:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 04, 2018 at 01:31:52PM -0300, Fabio Estevam wrote:
> Hi Shawn,
> 
> On Fri, May 4, 2018 at 4:19 AM, Shawn Guo <shawnguo@kernel.org> wrote:
> 
> > The property is documented as optional in the bindings.  Missing the
> > property shouldn't cause any fatal error, I guess.
> 
> The CAAM drivers uses the era information in many places:
> 
> drivers/crypto/caam/caamalg.c:  if (ctrlpriv->era >= 6) {
> drivers/crypto/caam/caamalg.c:  if (ctrlpriv->era < 3)
> drivers/crypto/caam/caamalg.c:  if (priv->era >= 6 && uses_dkp)
> drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {
> drivers/crypto/caam/caamalg_desc.c:     /* Class 2 operation */
> drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {
> drivers/crypto/caam/caamalg_desc.c:     /* Class 2 operation */
> drivers/crypto/caam/caamalg_desc.c:     if (era < 6) {
> 
> If the era information is not provided the value of -524 (-ENOTSUPP)
> will be used, so all the above logic will not operate correctly.
> 
> I have sent a patch that allows the era information to be retrieved
> via CAAM registers:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/crypto/caam/ctrl.c?h=next-20180424&id=654f2b937b389295581bcb4aa26011a63db7bc8f
> 
> but this will only land in 4.18.
> 
> In order to avoid i.MX7 to report the incorrect era information in
> 4.17 I suggest that this patch should be applied for 4.17-rc.

I applied it for 4.17, but still questioning whether it's reasonable to
have the property documented as optional in bindings, if missing the
property results in a non-functional driver.

Shawn

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

* [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property
  2018-05-07  1:17     ` Shawn Guo
@ 2018-05-07  1:51       ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2018-05-07  1:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, May 6, 2018 at 10:17 PM, Shawn Guo <shawnguo@kernel.org> wrote:

> I applied it for 4.17, but still questioning whether it's reasonable to
> have the property documented as optional in bindings, if missing the
> property results in a non-functional driver.

Thanks Shawn. Yes, after my CAAM patch gets applied it will be a
proper optional property.

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

end of thread, other threads:[~2018-05-07  1:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-24 20:25 [PATCH] ARM: dts: imx7s: Pass the 'fsl,sec-era' property Fabio Estevam
2018-05-04  7:19 ` Shawn Guo
2018-05-04 16:31   ` Fabio Estevam
2018-05-07  1:17     ` Shawn Guo
2018-05-07  1:51       ` Fabio Estevam

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