Merge tag 'devicetree-fixes-for-5.0-2' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / crypto / caam / regs.h
index 457815f..3cd0822 100644 (file)
@@ -3,6 +3,7 @@
  * CAAM hardware register-level view
  *
  * Copyright 2008-2011 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
  */
 
 #ifndef REGS_H
@@ -211,6 +212,47 @@ struct jr_outentry {
        u32 jrstatus;   /* Status for completed descriptor */
 } __packed;
 
+/* Version registers (Era 10+) e80-eff */
+struct version_regs {
+       u32 crca;       /* CRCA_VERSION */
+       u32 afha;       /* AFHA_VERSION */
+       u32 kfha;       /* KFHA_VERSION */
+       u32 pkha;       /* PKHA_VERSION */
+       u32 aesa;       /* AESA_VERSION */
+       u32 mdha;       /* MDHA_VERSION */
+       u32 desa;       /* DESA_VERSION */
+       u32 snw8a;      /* SNW8A_VERSION */
+       u32 snw9a;      /* SNW9A_VERSION */
+       u32 zuce;       /* ZUCE_VERSION */
+       u32 zuca;       /* ZUCA_VERSION */
+       u32 ccha;       /* CCHA_VERSION */
+       u32 ptha;       /* PTHA_VERSION */
+       u32 rng;        /* RNG_VERSION */
+       u32 trng;       /* TRNG_VERSION */
+       u32 aaha;       /* AAHA_VERSION */
+       u32 rsvd[10];
+       u32 sr;         /* SR_VERSION */
+       u32 dma;        /* DMA_VERSION */
+       u32 ai;         /* AI_VERSION */
+       u32 qi;         /* QI_VERSION */
+       u32 jr;         /* JR_VERSION */
+       u32 deco;       /* DECO_VERSION */
+};
+
+/* Version registers bitfields */
+
+/* Number of CHAs instantiated */
+#define CHA_VER_NUM_MASK       0xffull
+/* CHA Miscellaneous Information */
+#define CHA_VER_MISC_SHIFT     8
+#define CHA_VER_MISC_MASK      (0xffull << CHA_VER_MISC_SHIFT)
+/* CHA Revision Number */
+#define CHA_VER_REV_SHIFT      16
+#define CHA_VER_REV_MASK       (0xffull << CHA_VER_REV_SHIFT)
+/* CHA Version ID */
+#define CHA_VER_VID_SHIFT      24
+#define CHA_VER_VID_MASK       (0xffull << CHA_VER_VID_SHIFT)
+
 /*
  * caam_perfmon - Performance Monitor/Secure Memory Status/
  *                CAAM Global Status/Component Version IDs
@@ -223,15 +265,13 @@ struct jr_outentry {
 #define CHA_NUM_MS_DECONUM_MASK        (0xfull << CHA_NUM_MS_DECONUM_SHIFT)
 
 /*
- * CHA version IDs / instantiation bitfields
+ * CHA version IDs / instantiation bitfields (< Era 10)
  * Defined for use with the cha_id fields in perfmon, but the same shift/mask
  * selectors can be used to pull out the number of instantiated blocks within
  * cha_num fields in perfmon because the locations are the same.
  */
 #define CHA_ID_LS_AES_SHIFT    0
 #define CHA_ID_LS_AES_MASK     (0xfull << CHA_ID_LS_AES_SHIFT)
-#define CHA_ID_LS_AES_LP       (0x3ull << CHA_ID_LS_AES_SHIFT)
-#define CHA_ID_LS_AES_HP       (0x4ull << CHA_ID_LS_AES_SHIFT)
 
 #define CHA_ID_LS_DES_SHIFT    4
 #define CHA_ID_LS_DES_MASK     (0xfull << CHA_ID_LS_DES_SHIFT)
@@ -241,9 +281,6 @@ struct jr_outentry {
 
 #define CHA_ID_LS_MD_SHIFT     12
 #define CHA_ID_LS_MD_MASK      (0xfull << CHA_ID_LS_MD_SHIFT)
-#define CHA_ID_LS_MD_LP256     (0x0ull << CHA_ID_LS_MD_SHIFT)
-#define CHA_ID_LS_MD_LP512     (0x1ull << CHA_ID_LS_MD_SHIFT)
-#define CHA_ID_LS_MD_HP                (0x2ull << CHA_ID_LS_MD_SHIFT)
 
 #define CHA_ID_LS_RNG_SHIFT    16
 #define CHA_ID_LS_RNG_MASK     (0xfull << CHA_ID_LS_RNG_SHIFT)
@@ -269,6 +306,13 @@ struct jr_outentry {
 #define CHA_ID_MS_JR_SHIFT     28
 #define CHA_ID_MS_JR_MASK      (0xfull << CHA_ID_MS_JR_SHIFT)
 
+/* Specific CHA version IDs */
+#define CHA_VER_VID_AES_LP     0x3ull
+#define CHA_VER_VID_AES_HP     0x4ull
+#define CHA_VER_VID_MD_LP256   0x0ull
+#define CHA_VER_VID_MD_LP512   0x1ull
+#define CHA_VER_VID_MD_HP      0x2ull
+
 struct sec_vid {
        u16 ip_id;
        u8 maj_rev;
@@ -479,8 +523,10 @@ struct caam_ctrl {
                struct rng4tst r4tst[2];
        };
 
-       u32 rsvd9[448];
+       u32 rsvd9[416];
 
+       /* Version registers - introduced with era 10           e80-eff */
+       struct version_regs vreg;
        /* Performance Monitor                                  f00-fff */
        struct caam_perfmon perfmon;
 };
@@ -570,8 +616,10 @@ struct caam_job_ring {
        u32 rsvd11;
        u32 jrcommand;  /* JRCRx - JobR command */
 
-       u32 rsvd12[932];
+       u32 rsvd12[900];
 
+       /* Version registers - introduced with era 10           e80-eff */
+       struct version_regs vreg;
        /* Performance Monitor                                  f00-fff */
        struct caam_perfmon perfmon;
 };
@@ -878,13 +926,19 @@ struct caam_deco {
        u32 rsvd29[48];
        u32 descbuf[64];        /* DxDESB - Descriptor buffer */
        u32 rscvd30[193];
-#define DESC_DBG_DECO_STAT_HOST_ERR    0x00D00000
 #define DESC_DBG_DECO_STAT_VALID       0x80000000
 #define DESC_DBG_DECO_STAT_MASK                0x00F00000
+#define DESC_DBG_DECO_STAT_SHIFT       20
        u32 desc_dbg;           /* DxDDR - DECO Debug Register */
-       u32 rsvd31[126];
+       u32 rsvd31[13];
+#define DESC_DER_DECO_STAT_MASK                0x000F0000
+#define DESC_DER_DECO_STAT_SHIFT       16
+       u32 dbg_exec;           /* DxDER - DECO Debug Exec Register */
+       u32 rsvd32[112];
 };
 
+#define DECO_STAT_HOST_ERR     0xD
+
 #define DECO_JQCR_WHL          0x20000000
 #define DECO_JQCR_FOUR         0x10000000