MLK-15473-8: crypto: caam: Disable CAAM JR1 according to SCFW update
authorAymen Sghaier <aymen.sghaier@nxp.com>
Tue, 21 Nov 2017 17:31:35 +0000 (18:31 +0100)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:55:42 +0000 (15:55 -0500)
  After CAAM JR1 has been moved to SECO,
 imx-sc-firmware commit 36ff24f36b56 ("Move CAAM JR1 to SECO FW."),
 Linux no longer boots and rises a kernel panic at "caam_probe".
  So the CAAM JR1 should be disabled in the device-tree.

Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Silvano Di Ninno <silvano.dininno@nxp.com>
Signed-off-by: Aymen Sghaier <aymen.sghaier@nxp.com>
arch/arm64/boot/dts/freescale/fsl-imx8qm.dtsi
arch/arm64/boot/dts/freescale/fsl-imx8qxp.dtsi
drivers/crypto/caam/ctrl.c

index 9e2e1cd..d1d60ea 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                ranges = <0 0 0x31400000 0x400000>;
-               fsl,first-jr-index = <1>;
+               fsl,first-jr-index = <2>;
 
                sec_jr1: jr1@0x20000 {
                        compatible = "fsl,sec-v4.0-job-ring";
                        reg = <0x20000 0x1000>;
                        interrupts = <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>;
-                       status = "okay";
+                       status = "disabled";
                };
 
                sec_jr2: jr2@30000 {
index 33b9fbf..8fc6d7e 100644 (file)
                #address-cells = <1>;
                #size-cells = <1>;
                ranges = <0 0 0x31400000 0x400000>;
-               fsl,first-jr-index = <1>;
+               fsl,first-jr-index = <2>;
 
                sec_jr1: jr1@0x20000 {
                        compatible = "fsl,sec-v4.0-job-ring";
                        reg = <0x20000 0x1000>;
                        interrupts = <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>;
-                       status = "okay";
+                       status = "disabled";
                };
 
                sec_jr2: jr2@30000 {
index 6c424ab..28511c8 100644 (file)
@@ -410,7 +410,7 @@ static void check_virt(struct caam_drv_private *ctrlpriv, u32 comp_params)
 
 static int enable_jobrings(struct caam_drv_private *ctrlpriv, int block_offset)
 {
-       int ring;
+       int ring, index;
        int rspec = 0;
        struct device_node *nprop, *np;
 
@@ -444,9 +444,21 @@ static int enable_jobrings(struct caam_drv_private *ctrlpriv, int block_offset)
                                        ring);
                                continue;
                        }
-                       ctrlpriv->jr[ring] = (struct caam_job_ring __force *)
+
+                       if (of_property_read_u32_index(np, "reg", 0, &index)) {
+                               pr_warn("%s read reg property error %d.",
+                                       np->full_name, index);
+                               continue;
+                       }
+                       /* Get actual job ring index from its offset
+                        * ex: CAAM JR2 offset 0x30000 index = 2
+                        */
+                       while (index > 16)
+                               index = index >> 4;
+                       index -= 1;
+                       ctrlpriv->jr[index] = (struct caam_job_ring __force *)
                                             ((uint8_t *)ctrlpriv->ctrl +
-                                            (ring + JR_BLOCK_NUMBER) *
+                                            (index + JR_BLOCK_NUMBER) *
                                              block_offset);
                        ctrlpriv->total_jobrs++;
                        ring++;