]> git.sur5r.net Git - u-boot/blobdiff - drivers/crypto/fsl/jr.c
crypto/fsl: fix BLOB encapsulation and decapsulation
[u-boot] / drivers / crypto / fsl / jr.c
index 4a8cc3295a4a4eb116a2fbddc5c9ba5543aea115..986eabfb088ce2de383380dcfc885cb86b9debe6 100644 (file)
@@ -21,7 +21,7 @@
 
 uint32_t sec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
        0,
-#if defined(CONFIG_PPC_C29X)
+#if defined(CONFIG_ARCH_C29X)
        CONFIG_SYS_FSL_SEC_IDX_OFFSET,
        2 * CONFIG_SYS_FSL_SEC_IDX_OFFSET
 #endif
@@ -47,8 +47,7 @@ static inline void start_jr0(uint8_t sec_idx)
                 * VIRT_EN_INCL = 1 & VIRT_EN_POR = 0 & SEC_SCFGR_VIRT_EN = 1
                 */
                if ((ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) ||
-                   (!(ctpr_ms & SEC_CTPR_MS_VIRT_EN_POR) &&
-                                       (scfgr & SEC_SCFGR_VIRT_EN)))
+                   (scfgr & SEC_SCFGR_VIRT_EN))
                        sec_out32(&sec->jrstartr, CONFIG_JRSTARTR_JR0);
        } else {
                /* VIRT_EN_INCL = 0 && VIRT_EN_POR_VALUE = 1 */
@@ -342,7 +341,9 @@ static void desc_done(uint32_t status, void *arg)
 {
        struct result *x = arg;
        x->status = status;
+#ifndef CONFIG_SPL_BUILD
        caam_jr_strstatus(status);
+#endif
        x->done = 1;
 }
 
@@ -436,7 +437,11 @@ static inline int sec_reset_idx(uint8_t sec_idx)
 
        return 0;
 }
-
+int sec_reset(void)
+{
+       return sec_reset_idx(0);
+}
+#ifndef CONFIG_SPL_BUILD
 static int instantiate_rng(uint8_t sec_idx)
 {
        struct result op;
@@ -472,11 +477,6 @@ static int instantiate_rng(uint8_t sec_idx)
        return ret;
 }
 
-int sec_reset(void)
-{
-       return sec_reset_idx(0);
-}
-
 static u8 get_rng_vid(uint8_t sec_idx)
 {
        ccsr_sec_t *sec = (void *)SEC_ADDR(sec_idx);
@@ -561,7 +561,7 @@ static int rng_init(uint8_t sec_idx)
 
        return ret;
 }
-
+#endif
 int sec_init_idx(uint8_t sec_idx)
 {
        ccsr_sec_t *sec = (void *)SEC_ADDR(sec_idx);
@@ -586,7 +586,7 @@ int sec_init_idx(uint8_t sec_idx)
         * For AXI Read - Cacheable, Read allocate
         * Only For LS2080a, to solve CAAM coherency issues
         */
-#ifdef CONFIG_LS2080A
+#ifdef CONFIG_ARCH_LS2080A
        mcr = (mcr & ~MCFGR_AWCACHE_MASK) | (0xb << MCFGR_AWCACHE_SHIFT);
        mcr = (mcr & ~MCFGR_ARCACHE_MASK) | (0x6 << MCFGR_ARCACHE_SHIFT);
 #else
@@ -634,7 +634,7 @@ int sec_init_idx(uint8_t sec_idx)
 
        pamu_enable();
 #endif
-
+#ifndef CONFIG_SPL_BUILD
        if (get_rng_vid(sec_idx) >= 4) {
                if (rng_init(sec_idx) < 0) {
                        printf("SEC%u: RNG instantiation failed\n", sec_idx);
@@ -642,7 +642,7 @@ int sec_init_idx(uint8_t sec_idx)
                }
                printf("SEC%u: RNG instantiated\n", sec_idx);
        }
-
+#endif
        return ret;
 }