crypto: caam - Modify Freescale CAAM driver Scatter Gather entry definition
authorVictoria Milhoan <vicki.milhoan@freescale.com>
Wed, 5 Aug 2015 18:28:38 +0000 (11:28 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 10 Aug 2015 15:18:57 +0000 (23:18 +0800)
Modify the Scatter-Gather entry definitions for the Freescale
CAAM driver to include support for both 64- and 32-bit DMA pointers.

Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
Tested-by: Horia Geantă <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/desc.h
drivers/crypto/caam/sg_sw_sec4.h

index d397ff9d56fd7ae5a603b76e1b282286c1889398..405acbf13dac495efd5971c65764e67bc8721410 100644 (file)
@@ -8,12 +8,29 @@
 #ifndef DESC_H
 #define DESC_H
 
+/*
+ * 16-byte hardware scatter/gather table
+ * An 8-byte table exists in the hardware spec, but has never been
+ * implemented to date. The 8/16 option is selected at RTL-compile-time.
+ * and this selection is visible in the Compile Time Parameters Register
+ */
+
+#define SEC4_SG_LEN_EXT                0x80000000      /* Entry points to table */
+#define SEC4_SG_LEN_FIN                0x40000000      /* Last ent in table */
+#define SEC4_SG_BPID_MASK      0x000000ff
+#define SEC4_SG_BPID_SHIFT     16
+#define SEC4_SG_LEN_MASK       0x3fffffff      /* Excludes EXT and FINAL */
+#define SEC4_SG_OFFS_MASK      0x00001fff
+
 struct sec4_sg_entry {
-       u64 ptr;
-#define SEC4_SG_LEN_FIN 0x40000000
-#define SEC4_SG_LEN_EXT 0x80000000
+#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
+       dma_addr_t ptr;
+#else
+       u32 rsvd1;
+       dma_addr_t ptr;
+#endif
        u32 len;
-       u8 reserved;
+       u8 rsvd2;
        u8 buf_pool_id;
        u16 offset;
 };
index b68b74cc7b778dcd89eb75d8528fb88bc121b4f3..711bb39497796bef3189be6929331cce43451edf 100644 (file)
@@ -15,7 +15,6 @@ static inline void dma_to_sec4_sg_one(struct sec4_sg_entry *sec4_sg_ptr,
 {
        sec4_sg_ptr->ptr = dma;
        sec4_sg_ptr->len = len;
-       sec4_sg_ptr->reserved = 0;
        sec4_sg_ptr->buf_pool_id = 0;
        sec4_sg_ptr->offset = offset;
 #ifdef DEBUG