enable_layerscape_ns_access();
 #endif
 
+#ifdef CONFIG_SECURE_BOOT
+       /* In case of Secure Boot, the IBR configures the SMMU
+        * to allow only Secure transactions.
+        * SMMU must be reset in bypass mode.
+        * Set the ClientPD bit and Clear the USFCFG Bit
+        */
+       u32 val;
+       val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
+       out_le32(SMMU_SCR0, val);
+       val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
+       out_le32(SMMU_NSCR0, val);
+#endif
+
+#ifdef CONFIG_FSL_CAAM
+       sec_init();
+#endif
+
 #ifdef CONFIG_FSL_LS_PPA
        ppa_init();
 #endif
 int misc_init_r(void)
 {
        config_board_mux();
-#ifdef CONFIG_SECURE_BOOT
-       /* In case of Secure Boot, the IBR configures the SMMU
-        * to allow only Secure transactions.
-        * SMMU must be reset in bypass mode.
-        * Set the ClientPD bit and Clear the USFCFG Bit
-        */
-       u32 val;
-       val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
-       out_le32(SMMU_SCR0, val);
-       val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
-       out_le32(SMMU_NSCR0, val);
-#endif
-#ifdef CONFIG_FSL_CAAM
-       return sec_init();
-#endif
        return 0;
 }
 #endif