crypto/fsl: Add support for CAAM Job ring driver model

added device tree support for job ring driver.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/crypto/fsl/jr.h b/drivers/crypto/fsl/jr.h
index 1047aa7..3eb7be7 100644
--- a/drivers/crypto/fsl/jr.h
+++ b/drivers/crypto/fsl/jr.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2008-2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  *
  */
 
@@ -8,7 +9,9 @@
 #define __JR_H
 
 #include <linux/compiler.h>
+#include "fsl_sec.h"
 #include "type.h"
+#include <misc.h>
 
 #define JR_SIZE 4
 /* Timeout currently defined as 10 sec */
@@ -35,12 +38,21 @@
 #define JRSLIODN_SHIFT		0
 #define JRSLIODN_MASK		0x00000fff
 
-#define JQ_DEQ_ERR		-1
-#define JQ_DEQ_TO_ERR		-2
-#define JQ_ENQ_ERR		-3
+#define JRDID_MS_PRIM_DID	BIT(0)
+#define JRDID_MS_PRIM_TZ	BIT(4)
+#define JRDID_MS_TZ_OWN		BIT(15)
+
+#define JQ_DEQ_ERR		(-1)
+#define JQ_DEQ_TO_ERR		(-2)
+#define JQ_ENQ_ERR		(-3)
 
 #define RNG4_MAX_HANDLES	2
 
+enum {
+	/* Run caam jobring descriptor(in buf) */
+	CAAM_JR_RUN_DESC,
+};
+
 struct op_ring {
 	caam_dma_addr_t desc;
 	uint32_t status;
@@ -102,6 +114,19 @@
 	uint32_t status;
 };
 
+/*
+ * struct caam_regs - CAAM initialization register interface
+ *
+ * Interface to caam memory map, jobring register, jobring storage.
+ */
+struct caam_regs {
+	ccsr_sec_t *sec;	/*caam initialization registers*/
+	struct jr_regs *regs;	/*jobring configuration registers*/
+	u8 jrid;		/*id to identify a jobring*/
+	/*Private sub-storage for a single JobR*/
+	struct jobring jr[CONFIG_SYS_FSL_MAX_NUM_OF_SEC];
+};
+
 void caam_jr_strstatus(u32 status);
 int run_descriptor_jr(uint32_t *desc);