SSI-35: crypto: caam - Do not rely on common index of jr
authorFranck LENORMAND <franck.lenormand@nxp.com>
Fri, 15 Feb 2019 15:24:35 +0000 (16:24 +0100)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 18 Apr 2019 00:00:38 +0000 (03:00 +0300)
commita938d76b2c43f1e138c6afa5b4132699a481bfba
tree2a8a2ef3ab3d6d7b33c71604adac31a3a395b07b
parent6a5c2d9d358fe4d8ab2ef25d3a678e7ed2534784
SSI-35: crypto: caam - Do not rely on common index of jr

With current code, the index are stored in an array at their common index,
ie jr0 store at index 0, jr1 at 1, ...

It force to use buggy mechanic to compute it and is not scalable.

This patch removes the mechanic of computation of hardware register
addresses and the notion of first_jr_index.

Instead the first JR available is set to index 0 of the table and so on.

Legacy code was retrieving the index of the first jr to access registers.
With this new way, we simply always access the first jr.

This is working because after the configuration of the JR in ctl
(enable_jobrings), the driver checks that there is at least 1 JR.
Without this, we could create segfaults.

Fixes: de9807e6e0de ("MLK-15473-1: crypto: caam: Add CAAM driver support for iMX8 soc family")
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
arch/arm64/boot/dts/freescale/fsl-imx8dx.dtsi
arch/arm64/boot/dts/freescale/fsl-imx8qm-device.dtsi
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamhash.c
drivers/crypto/caam/caampkc.c
drivers/crypto/caam/caamrng.c
drivers/crypto/caam/ctrl.c
drivers/crypto/caam/intern.h
drivers/crypto/caam/sm_store.c