1ifeq ($(CFG_NXP_CAAM),y)
2#
3# CAAM Debug: define 3x32 bits value (same bit used to debug a module)
4# CFG_DBG_CAAM_TRACE  Module print trace
5# CFG_DBG_CAAM_DESC   Module descriptor dump
6# CFG_DBG_CAAM_BUF    Module buffer dump
7#
8# DBG_HAL    BIT32(0)  // HAL trace
9# DBG_CTRL   BIT32(1)  // Controller trace
10# DBG_MEM    BIT32(2)  // Memory utility trace
11# DBG_SGT    BIT32(3)  // Scatter Gather trace
12# DBG_PWR    BIT32(4)  // Power trace
13# DBG_JR     BIT32(5)  // Job Ring trace
14# DBG_RNG    BIT32(6)  // RNG trace
15# DBG_HASH   BIT32(7)  // Hash trace
16# DBG_RSA    BIT32(8)  // RSA trace
17# DBG_CIPHER BIT32(9)  // Cipher trace
18# DBG_BLOB   BIT32(10) // BLOB trace
19# DBG_DMAOBJ BIT32(11) // DMA Object Trace
20# DBG_ECC    BIT32(12) // ECC trace
21# DBG_DH     BIT32(13) // DH Trace
22# DBG_DSA    BIT32(14) // DSA trace
23
24CFG_DBG_CAAM_TRACE ?= 0x2
25CFG_DBG_CAAM_DESC ?= 0x0
26CFG_DBG_CAAM_BUF ?= 0x0
27
28ifneq (,$(filter $(PLATFORM_FLAVOR),ls1012ardb ls1043ardb ls1046ardb))
29$(call force, CFG_CAAM_SIZE_ALIGN,1)
30$(call force, CFG_CAAM_BIG_ENDIAN,y)
31$(call force, CFG_JR_BLOCK_SIZE,0x10000)
32$(call force, CFG_JR_INDEX,2)
33$(call force, CFG_JR_INT,105)
34$(call force, CFG_NXP_CAAM_SGT_V1,y)
35else ifneq (,$(filter $(PLATFORM_FLAVOR),ls1088ardb ls2088ardb ls1028ardb))
36$(call force, CFG_CAAM_SIZE_ALIGN,1)
37$(call force, CFG_CAAM_LITTLE_ENDIAN,y)
38$(call force, CFG_JR_BLOCK_SIZE,0x10000)
39$(call force, CFG_JR_INDEX,2)
40$(call force, CFG_JR_INT,174)
41$(call force, CFG_NXP_CAAM_SGT_V2,y)
42else ifneq (,$(filter $(PLATFORM_FLAVOR),lx2160aqds lx2160ardb))
43$(call force, CFG_CAAM_SIZE_ALIGN,1)
44$(call force, CFG_CAAM_LITTLE_ENDIAN,y)
45$(call force, CFG_JR_BLOCK_SIZE,0x10000)
46$(call force, CFG_JR_INDEX,2)
47$(call force, CFG_JR_INT, 174)
48$(call force, CFG_NB_JOBS_QUEUE, 80)
49$(call force, CFG_NXP_CAAM_SGT_V2,y)
50else ifneq (,$(filter $(PLATFORM_FLAVOR),$(mx8qm-flavorlist) $(mx8qx-flavorlist)))
51$(call force, CFG_CAAM_SIZE_ALIGN,4)
52$(call force, CFG_JR_BLOCK_SIZE,0x10000)
53$(call force, CFG_JR_INDEX,3)
54$(call force, CFG_JR_INT,486)
55$(call force, CFG_NXP_CAAM_SGT_V1,y)
56else ifneq (,$(filter $(PLATFORM_FLAVOR),$(mx8mm-flavorlist) $(mx8mn-flavorlist) $(mx8mp-flavorlist) $(mx8mq-flavorlist)))
57$(call force, CFG_CAAM_SIZE_ALIGN,1)
58$(call force, CFG_JR_BLOCK_SIZE,0x1000)
59$(call force, CFG_JR_INDEX,2)
60$(call force, CFG_JR_INT,146)
61$(call force, CFG_NXP_CAAM_SGT_V1,y)
62else ifneq (,$(filter $(PLATFORM_FLAVOR),$(mx8ulp-flavorlist)))
63$(call force, CFG_CAAM_SIZE_ALIGN,1)
64$(call force, CFG_JR_BLOCK_SIZE,0x1000)
65$(call force, CFG_JR_INDEX,2)
66$(call force, CFG_JR_INT,114)
67$(call force, CFG_NXP_CAAM_SGT_V1,y)
68$(call force, CFG_CAAM_ITR,n)
69else ifneq (,$(filter $(PLATFORM_FLAVOR),$(mx7ulp-flavorlist)))
70$(call force, CFG_CAAM_SIZE_ALIGN,1)
71$(call force, CFG_JR_BLOCK_SIZE,0x1000)
72$(call force, CFG_JR_INDEX,0)
73$(call force, CFG_JR_INT,137)
74$(call force, CFG_NXP_CAAM_SGT_V1,y)
75$(call force, CFG_CAAM_ITR,n)
76else ifneq (,$(filter $(PLATFORM_FLAVOR),$(mx6ul-flavorlist) $(mx6q-flavorlist) \
77        $(mx6qp-flavorlist) $(mx6sx-flavorlist) $(mx6d-flavorlist) $(mx6dl-flavorlist) \
78        $(mx6s-flavorlist) $(mx7d-flavorlist) $(mx7s-flavorlist) $(mx8ulp-flavorlist)))
79$(call force, CFG_CAAM_SIZE_ALIGN,1)
80$(call force, CFG_JR_BLOCK_SIZE,0x1000)
81$(call force, CFG_JR_INDEX,0)
82$(call force, CFG_JR_INT,137)
83$(call force, CFG_NXP_CAAM_SGT_V1,y)
84else
85$(error Unsupported PLATFORM_FLAVOR "$(PLATFORM_FLAVOR)")
86endif
87
88# Enable the BLOB module used for the hardware unique key
89CFG_NXP_CAAM_BLOB_DRV ?= y
90
91ifeq ($(CFG_LS),y)
92CFG_CRYPTO_DRIVER ?= y
93CFG_CAAM_64BIT ?= y
94
95$(call force, CFG_CAAM_SGT_ALIGN,4)
96
97else # !CFG_LS, that is, MX family of platforms
98
99CFG_CAAM_ITR ?= y
100CFG_CAAM_SGT_ALIGN ?= 1
101$(call force,CFG_IMX_CAAM,n)
102
103endif # !CFG_LS
104
105ifeq ($(CFG_CRYPTO_DRIVER), y)
106
107# Crypto Driver Debug
108# DRV_DBG_TRACE BIT32(0) // Driver trace
109# DRV_DBG_BUF   BIT32(1) // Driver dump Buffer
110CFG_CRYPTO_DRIVER_DEBUG ?= 0
111
112$(call force, CFG_NXP_CAAM_RUNTIME_JR, y)
113
114# Force to 'y' the CFG_NXP_CAAM_xxx_DRV to enable the CAAM HW driver
115# and enable the associated CFG_CRYPTO_DRV_xxx Crypto driver
116# API
117#
118# Example: Enable CFG_CRYPTO_DRV_HASH and CFG_NXP_CAAM_HASH_DRV
119#     $(eval $(call cryphw-enable-drv-hw, HASH))
120define cryphw-enable-drv-hw
121_var := $(strip $(1))
122$$(call force, CFG_NXP_CAAM_$$(_var)_DRV, y)
123$$(call force, CFG_CRYPTO_DRV_$$(_var), y)
124endef
125
126# Return 'y' if at least one of the variable
127# CFG_CRYPTO_xxx_HW is 'y'
128cryphw-one-enabled = $(call cfg-one-enabled, \
129                        $(foreach v,$(1), CFG_NXP_CAAM_$(v)_DRV))
130
131$(call force, CFG_NXP_CAAM_RNG_DRV, y)
132CFG_WITH_SOFTWARE_PRNG = n
133$(eval $(call cryphw-enable-drv-hw, HASH))
134$(eval $(call cryphw-enable-drv-hw, CIPHER))
135$(call force, CFG_NXP_CAAM_HMAC_DRV,y)
136$(call force, CFG_NXP_CAAM_CMAC_DRV,y)
137
138ifeq ($(CFG_LS),y)
139
140$(eval $(call cryphw-enable-drv-hw, RSA))
141$(eval $(call cryphw-enable-drv-hw, ECC))
142$(eval $(call cryphw-enable-drv-hw, DH))
143$(eval $(call cryphw-enable-drv-hw, DSA))
144
145# Define the RSA Private Key Format used by the CAAM
146#   Format #1: (n, d)
147#   Format #2: (p, q, d)
148#   Format #3: (p, q, dp, dq, qp)
149CFG_NXP_CAAM_RSA_KEY_FORMAT ?= 3
150
151else # !CFG_LS, that is, MX family of platforms
152
153ifneq ($(filter y, $(CFG_MX6QP) $(CFG_MX6Q) $(CFG_MX6D) $(CFG_MX6DL) \
154        $(CFG_MX6S) $(CFG_MX6SL) $(CFG_MX6SLL) $(CFG_MX6SX) $(CFG_MX7ULP) $(CFG_MX8ULP)), y)
155$(eval $(call cryphw-enable-drv-hw, RSA))
156$(eval $(call cryphw-enable-drv-hw, ECC))
157$(eval $(call cryphw-enable-drv-hw, DH))
158$(eval $(call cryphw-enable-drv-hw, DSA))
159
160# Define the RSA Private Key Format used by the CAAM
161#   Format #1: (n, d)
162#   Format #2: (p, q, d)
163#   Format #3: (p, q, dp, dq, qp)
164CFG_NXP_CAAM_RSA_KEY_FORMAT ?= 3
165endif
166
167endif # !CFG_LS
168
169$(call force, CFG_NXP_CAAM_ACIPHER_DRV, $(call cryphw-one-enabled, RSA ECC DH DSA))
170$(call force, CFG_CRYPTO_DRV_MAC, $(call cryphw-one-enabled, HMAC CMAC))
171CFG_CRYPTO_DRV_ACIPHER ?= $(CFG_NXP_CAAM_ACIPHER_DRV)
172
173endif # CFG_CRYPTO_DRIVER
174endif # CFG_NXP_CAAM