aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal van Leeuwen <pascalvanl@gmail.com>2019-09-06 10:31:48 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-09-13 07:17:57 -0400
commit118db42deeeff1cac3fe5f23f5c3ac25d6a77b7d (patch)
tree29bb3f7ecbad84c0e93f4cdbaad5765fd1977c4a
parentc51636a3065491af521187724d14a822548bcfd7 (diff)
crypto: inside-secure - Add EIP97/EIP197 and endianness detection
This patch adds automatic EIP97/EIP197 detection, so it does not need to rely on any static value from the device table anymore. In particular, the static value from the table won't work for PCI devboards that cannot be further identified save from this direct hardware probing. The patch also adds automatic host xs endianness detection & correction. Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/inside-secure/safexcel.c154
-rw-r--r--drivers/crypto/inside-secure/safexcel.h26
2 files changed, 130 insertions, 50 deletions
diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index 5d648ee5f0b0..98a42f9c2fe9 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -393,29 +393,21 @@ static int safexcel_hw_setup_rdesc_rings(struct safexcel_crypto_priv *priv)
393 393
394static int safexcel_hw_init(struct safexcel_crypto_priv *priv) 394static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
395{ 395{
396 u32 version, val; 396 u32 val;
397 int i, ret, pe; 397 int i, ret, pe;
398 398
399 dev_dbg(priv->dev, "HW init: using %d pipe(s) and %d ring(s)\n", 399 dev_dbg(priv->dev, "HW init: using %d pipe(s) and %d ring(s)\n",
400 priv->config.pes, priv->config.rings); 400 priv->config.pes, priv->config.rings);
401 401
402 /* Determine endianess and configure byte swap */
403 version = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_VERSION);
404 val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
405
406 if ((version & 0xffff) == EIP197_HIA_VERSION_BE)
407 val |= EIP197_MST_CTRL_BYTE_SWAP;
408 else if (((version >> 16) & 0xffff) == EIP197_HIA_VERSION_LE)
409 val |= (EIP197_MST_CTRL_NO_BYTE_SWAP >> 24);
410
411 /* 402 /*
412 * For EIP197's only set maximum number of TX commands to 2^5 = 32 403 * For EIP197's only set maximum number of TX commands to 2^5 = 32
413 * Skip for the EIP97 as it does not have this field. 404 * Skip for the EIP97 as it does not have this field.
414 */ 405 */
415 if (priv->version != EIP97IES_MRVL) 406 if (priv->flags & SAFEXCEL_HW_EIP197) {
407 val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
416 val |= EIP197_MST_CTRL_TX_MAX_CMD(5); 408 val |= EIP197_MST_CTRL_TX_MAX_CMD(5);
417 409 writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
418 writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); 410 }
419 411
420 /* Configure wr/rd cache values */ 412 /* Configure wr/rd cache values */
421 writel(EIP197_MST_CTRL_RD_CACHE(RD_CACHE_4BITS) | 413 writel(EIP197_MST_CTRL_RD_CACHE(RD_CACHE_4BITS) |
@@ -438,7 +430,7 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
438 writel(EIP197_DxE_THR_CTRL_RESET_PE, 430 writel(EIP197_DxE_THR_CTRL_RESET_PE,
439 EIP197_HIA_DFE_THR(priv) + EIP197_HIA_DFE_THR_CTRL(pe)); 431 EIP197_HIA_DFE_THR(priv) + EIP197_HIA_DFE_THR_CTRL(pe));
440 432
441 if (priv->version != EIP97IES_MRVL) 433 if (priv->flags & SAFEXCEL_HW_EIP197)
442 /* Reset HIA input interface arbiter (EIP197 only) */ 434 /* Reset HIA input interface arbiter (EIP197 only) */
443 writel(EIP197_HIA_RA_PE_CTRL_RESET, 435 writel(EIP197_HIA_RA_PE_CTRL_RESET,
444 EIP197_HIA_AIC(priv) + EIP197_HIA_RA_PE_CTRL(pe)); 436 EIP197_HIA_AIC(priv) + EIP197_HIA_RA_PE_CTRL(pe));
@@ -464,7 +456,7 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
464 EIP197_PE_IN_xBUF_THRES_MAX(7), 456 EIP197_PE_IN_xBUF_THRES_MAX(7),
465 EIP197_PE(priv) + EIP197_PE_IN_TBUF_THRES(pe)); 457 EIP197_PE(priv) + EIP197_PE_IN_TBUF_THRES(pe));
466 458
467 if (priv->version != EIP97IES_MRVL) 459 if (priv->flags & SAFEXCEL_HW_EIP197)
468 /* enable HIA input interface arbiter and rings */ 460 /* enable HIA input interface arbiter and rings */
469 writel(EIP197_HIA_RA_PE_CTRL_EN | 461 writel(EIP197_HIA_RA_PE_CTRL_EN |
470 GENMASK(priv->config.rings - 1, 0), 462 GENMASK(priv->config.rings - 1, 0),
@@ -490,7 +482,7 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
490 /* FIXME: instability issues can occur for EIP97 but disabling 482 /* FIXME: instability issues can occur for EIP97 but disabling
491 * it impacts performance. 483 * it impacts performance.
492 */ 484 */
493 if (priv->version != EIP97IES_MRVL) 485 if (priv->flags & SAFEXCEL_HW_EIP197)
494 val |= EIP197_HIA_DSE_CFG_EN_SINGLE_WR; 486 val |= EIP197_HIA_DSE_CFG_EN_SINGLE_WR;
495 writel(val, EIP197_HIA_DSE(priv) + EIP197_HIA_DSE_CFG(pe)); 487 writel(val, EIP197_HIA_DSE(priv) + EIP197_HIA_DSE_CFG(pe));
496 488
@@ -577,8 +569,9 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
577 /* Clear any HIA interrupt */ 569 /* Clear any HIA interrupt */
578 writel(GENMASK(30, 20), EIP197_HIA_AIC_G(priv) + EIP197_HIA_AIC_G_ACK); 570 writel(GENMASK(30, 20), EIP197_HIA_AIC_G(priv) + EIP197_HIA_AIC_G_ACK);
579 571
580 if (priv->version != EIP97IES_MRVL) { 572 if (priv->flags & SAFEXCEL_HW_EIP197) {
581 eip197_trc_cache_init(priv); 573 eip197_trc_cache_init(priv);
574 priv->flags |= EIP197_TRC_CACHE;
582 575
583 ret = eip197_load_firmwares(priv); 576 ret = eip197_load_firmwares(priv);
584 if (ret) 577 if (ret)
@@ -1083,12 +1076,12 @@ static void safexcel_configure(struct safexcel_crypto_priv *priv)
1083 val = readl(EIP197_HIA_AIC_G(priv) + EIP197_HIA_OPTIONS); 1076 val = readl(EIP197_HIA_AIC_G(priv) + EIP197_HIA_OPTIONS);
1084 1077
1085 /* Read number of PEs from the engine */ 1078 /* Read number of PEs from the engine */
1086 if (priv->version == EIP97IES_MRVL) 1079 if (priv->flags & SAFEXCEL_HW_EIP197)
1087 /* Narrow field width for EIP97 type engine */
1088 mask = EIP97_N_PES_MASK;
1089 else
1090 /* Wider field width for all EIP197 type engines */ 1080 /* Wider field width for all EIP197 type engines */
1091 mask = EIP197_N_PES_MASK; 1081 mask = EIP197_N_PES_MASK;
1082 else
1083 /* Narrow field width for EIP97 type engine */
1084 mask = EIP97_N_PES_MASK;
1092 1085
1093 priv->config.pes = (val >> EIP197_N_PES_OFFSET) & mask; 1086 priv->config.pes = (val >> EIP197_N_PES_OFFSET) & mask;
1094 1087
@@ -1108,18 +1101,7 @@ static void safexcel_init_register_offsets(struct safexcel_crypto_priv *priv)
1108{ 1101{
1109 struct safexcel_register_offsets *offsets = &priv->offsets; 1102 struct safexcel_register_offsets *offsets = &priv->offsets;
1110 1103
1111 if (priv->version == EIP97IES_MRVL) { 1104 if (priv->flags & SAFEXCEL_HW_EIP197) {
1112 offsets->hia_aic = EIP97_HIA_AIC_BASE;
1113 offsets->hia_aic_g = EIP97_HIA_AIC_G_BASE;
1114 offsets->hia_aic_r = EIP97_HIA_AIC_R_BASE;
1115 offsets->hia_aic_xdr = EIP97_HIA_AIC_xDR_BASE;
1116 offsets->hia_dfe = EIP97_HIA_DFE_BASE;
1117 offsets->hia_dfe_thr = EIP97_HIA_DFE_THR_BASE;
1118 offsets->hia_dse = EIP97_HIA_DSE_BASE;
1119 offsets->hia_dse_thr = EIP97_HIA_DSE_THR_BASE;
1120 offsets->hia_gen_cfg = EIP97_HIA_GEN_CFG_BASE;
1121 offsets->pe = EIP97_PE_BASE;
1122 } else {
1123 offsets->hia_aic = EIP197_HIA_AIC_BASE; 1105 offsets->hia_aic = EIP197_HIA_AIC_BASE;
1124 offsets->hia_aic_g = EIP197_HIA_AIC_G_BASE; 1106 offsets->hia_aic_g = EIP197_HIA_AIC_G_BASE;
1125 offsets->hia_aic_r = EIP197_HIA_AIC_R_BASE; 1107 offsets->hia_aic_r = EIP197_HIA_AIC_R_BASE;
@@ -1130,6 +1112,19 @@ static void safexcel_init_register_offsets(struct safexcel_crypto_priv *priv)
1130 offsets->hia_dse_thr = EIP197_HIA_DSE_THR_BASE; 1112 offsets->hia_dse_thr = EIP197_HIA_DSE_THR_BASE;
1131 offsets->hia_gen_cfg = EIP197_HIA_GEN_CFG_BASE; 1113 offsets->hia_gen_cfg = EIP197_HIA_GEN_CFG_BASE;
1132 offsets->pe = EIP197_PE_BASE; 1114 offsets->pe = EIP197_PE_BASE;
1115 offsets->global = EIP197_GLOBAL_BASE;
1116 } else {
1117 offsets->hia_aic = EIP97_HIA_AIC_BASE;
1118 offsets->hia_aic_g = EIP97_HIA_AIC_G_BASE;
1119 offsets->hia_aic_r = EIP97_HIA_AIC_R_BASE;
1120 offsets->hia_aic_xdr = EIP97_HIA_AIC_xDR_BASE;
1121 offsets->hia_dfe = EIP97_HIA_DFE_BASE;
1122 offsets->hia_dfe_thr = EIP97_HIA_DFE_THR_BASE;
1123 offsets->hia_dse = EIP97_HIA_DSE_BASE;
1124 offsets->hia_dse_thr = EIP97_HIA_DSE_THR_BASE;
1125 offsets->hia_gen_cfg = EIP97_HIA_GEN_CFG_BASE;
1126 offsets->pe = EIP97_PE_BASE;
1127 offsets->global = EIP97_GLOBAL_BASE;
1133 } 1128 }
1134} 1129}
1135 1130
@@ -1145,8 +1140,8 @@ static int safexcel_probe_generic(void *pdev,
1145 int is_pci_dev) 1140 int is_pci_dev)
1146{ 1141{
1147 struct device *dev = priv->dev; 1142 struct device *dev = priv->dev;
1148 u32 peid; 1143 u32 peid, version, mask, val;
1149 int i, ret; 1144 int i, ret, hwctg;
1150 1145
1151 priv->context_pool = dmam_pool_create("safexcel-context", dev, 1146 priv->context_pool = dmam_pool_create("safexcel-context", dev,
1152 sizeof(struct safexcel_context_record), 1147 sizeof(struct safexcel_context_record),
@@ -1154,23 +1149,89 @@ static int safexcel_probe_generic(void *pdev,
1154 if (!priv->context_pool) 1149 if (!priv->context_pool)
1155 return -ENOMEM; 1150 return -ENOMEM;
1156 1151
1152 /*
1153 * First try the EIP97 HIA version regs
1154 * For the EIP197, this is guaranteed to NOT return any of the test
1155 * values
1156 */
1157 version = readl(priv->base + EIP97_HIA_AIC_BASE + EIP197_HIA_VERSION);
1158
1159 mask = 0; /* do not swap */
1160 if (EIP197_REG_LO16(version) == EIP197_HIA_VERSION_LE) {
1161 priv->hwconfig.hiaver = EIP197_VERSION_MASK(version);
1162 } else if (EIP197_REG_HI16(version) == EIP197_HIA_VERSION_BE) {
1163 /* read back byte-swapped, so complement byte swap bits */
1164 mask = EIP197_MST_CTRL_BYTE_SWAP_BITS;
1165 priv->hwconfig.hiaver = EIP197_VERSION_SWAP(version);
1166 } else {
1167 /* So it wasn't an EIP97 ... maybe it's an EIP197? */
1168 version = readl(priv->base + EIP197_HIA_AIC_BASE +
1169 EIP197_HIA_VERSION);
1170 if (EIP197_REG_LO16(version) == EIP197_HIA_VERSION_LE) {
1171 priv->hwconfig.hiaver = EIP197_VERSION_MASK(version);
1172 priv->flags |= SAFEXCEL_HW_EIP197;
1173 } else if (EIP197_REG_HI16(version) ==
1174 EIP197_HIA_VERSION_BE) {
1175 /* read back byte-swapped, so complement swap bits */
1176 mask = EIP197_MST_CTRL_BYTE_SWAP_BITS;
1177 priv->hwconfig.hiaver = EIP197_VERSION_SWAP(version);
1178 priv->flags |= SAFEXCEL_HW_EIP197;
1179 } else {
1180 return -ENODEV;
1181 }
1182 }
1183
1184 /* Now initialize the reg offsets based on the probing info so far */
1157 safexcel_init_register_offsets(priv); 1185 safexcel_init_register_offsets(priv);
1158 1186
1187 /*
1188 * If the version was read byte-swapped, we need to flip the device
1189 * swapping Keep in mind here, though, that what we write will also be
1190 * byte-swapped ...
1191 */
1192 if (mask) {
1193 val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
1194 val = val ^ (mask >> 24); /* toggle byte swap bits */
1195 writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
1196 }
1197
1198 /*
1199 * We're not done probing yet! We may fall through to here if no HIA
1200 * was found at all. So, with the endianness presumably correct now and
1201 * the offsets setup, *really* probe for the EIP97/EIP197.
1202 */
1203 version = readl(EIP197_GLOBAL(priv) + EIP197_VERSION);
1204 if (((priv->flags & SAFEXCEL_HW_EIP197) &&
1205 (EIP197_REG_LO16(version) != EIP197_VERSION_LE)) ||
1206 ((!(priv->flags & SAFEXCEL_HW_EIP197) &&
1207 (EIP197_REG_LO16(version) != EIP97_VERSION_LE)))) {
1208 /*
1209 * We did not find the device that matched our initial probing
1210 * (or our initial probing failed) Report appropriate error.
1211 */
1212 return -ENODEV;
1213 }
1214
1215 priv->hwconfig.hwver = EIP197_VERSION_MASK(version);
1216 hwctg = version >> 28;
1217 peid = version & 255;
1218
1219 /* Detect EIP96 packet engine and version */
1220 version = readl(EIP197_PE(priv) + EIP197_PE_EIP96_VERSION(0));
1221 if (EIP197_REG_LO16(version) != EIP96_VERSION_LE) {
1222 dev_err(dev, "EIP%d: EIP96 not detected.\n", peid);
1223 return -ENODEV;
1224 }
1225 priv->hwconfig.pever = EIP197_VERSION_MASK(version);
1226
1159 /* Get supported algorithms from EIP96 transform engine */ 1227 /* Get supported algorithms from EIP96 transform engine */
1160 priv->hwconfig.algo_flags = readl(EIP197_PE(priv) + 1228 priv->hwconfig.algo_flags = readl(EIP197_PE(priv) +
1161 EIP197_PE_EIP96_OPTIONS(0)); 1229 EIP197_PE_EIP96_OPTIONS(0));
1162 1230
1163 if (priv->version == EIP97IES_MRVL) { 1231 /* Print single info line describing what we just detected */
1164 peid = 97; 1232 dev_info(priv->dev, "EIP%d:%x(%d)-HIA:%x,PE:%x,alg:%08x\n", peid,
1165 } else { 1233 priv->hwconfig.hwver, hwctg, priv->hwconfig.hiaver,
1166 priv->flags |= EIP197_TRC_CACHE; 1234 priv->hwconfig.pever, priv->hwconfig.algo_flags);
1167 peid = 197;
1168 }
1169
1170 /* Dump some debug information important during development */
1171 dev_dbg(priv->dev, "Inside Secure EIP%d packetengine\n", peid);
1172 dev_dbg(priv->dev, "Supported algorithms: %08x\n",
1173 priv->hwconfig.algo_flags);
1174 1235
1175 safexcel_configure(priv); 1236 safexcel_configure(priv);
1176 1237
@@ -1522,7 +1583,6 @@ static const struct pci_device_id safexcel_pci_ids[] = {
1522 { 1583 {
1523 PCI_DEVICE_SUB(PCI_VENDOR_ID_XILINX, 0x9038, 1584 PCI_DEVICE_SUB(PCI_VENDOR_ID_XILINX, 0x9038,
1524 0x16ae, 0xc522), 1585 0x16ae, 0xc522),
1525 /* assume EIP197B for now */
1526 .driver_data = EIP197_DEVBRD, 1586 .driver_data = EIP197_DEVBRD,
1527 }, 1587 },
1528 {}, 1588 {},
diff --git a/drivers/crypto/inside-secure/safexcel.h b/drivers/crypto/inside-secure/safexcel.h
index 1407804b66b7..feb0a9c32b75 100644
--- a/drivers/crypto/inside-secure/safexcel.h
+++ b/drivers/crypto/inside-secure/safexcel.h
@@ -14,8 +14,17 @@
14#include <crypto/sha.h> 14#include <crypto/sha.h>
15#include <crypto/skcipher.h> 15#include <crypto/skcipher.h>
16 16
17#define EIP197_HIA_VERSION_LE 0xca35 17#define EIP197_HIA_VERSION_BE 0xca35
18#define EIP197_HIA_VERSION_BE 0x35ca 18#define EIP197_HIA_VERSION_LE 0x35ca
19#define EIP97_VERSION_LE 0x9e61
20#define EIP197_VERSION_LE 0x3ac5
21#define EIP96_VERSION_LE 0x9f60
22#define EIP197_REG_LO16(reg) (reg & 0xffff)
23#define EIP197_REG_HI16(reg) ((reg >> 16) & 0xffff)
24#define EIP197_VERSION_MASK(reg) ((reg >> 16) & 0xfff)
25#define EIP197_VERSION_SWAP(reg) (((reg & 0xf0) << 4) | \
26 ((reg >> 4) & 0xf0) | \
27 ((reg >> 12) & 0xf))
19 28
20/* Static configuration */ 29/* Static configuration */
21#define EIP197_DEFAULT_RING_SIZE 400 30#define EIP197_DEFAULT_RING_SIZE 400
@@ -70,6 +79,7 @@
70#define EIP197_HIA_DSE_THR(priv) ((priv)->base + (priv)->offsets.hia_dse_thr) 79#define EIP197_HIA_DSE_THR(priv) ((priv)->base + (priv)->offsets.hia_dse_thr)
71#define EIP197_HIA_GEN_CFG(priv) ((priv)->base + (priv)->offsets.hia_gen_cfg) 80#define EIP197_HIA_GEN_CFG(priv) ((priv)->base + (priv)->offsets.hia_gen_cfg)
72#define EIP197_PE(priv) ((priv)->base + (priv)->offsets.pe) 81#define EIP197_PE(priv) ((priv)->base + (priv)->offsets.pe)
82#define EIP197_GLOBAL(priv) ((priv)->base + (priv)->offsets.global)
73 83
74/* EIP197 base offsets */ 84/* EIP197 base offsets */
75#define EIP197_HIA_AIC_BASE 0x90000 85#define EIP197_HIA_AIC_BASE 0x90000
@@ -82,6 +92,7 @@
82#define EIP197_HIA_DSE_THR_BASE 0x8d040 92#define EIP197_HIA_DSE_THR_BASE 0x8d040
83#define EIP197_HIA_GEN_CFG_BASE 0xf0000 93#define EIP197_HIA_GEN_CFG_BASE 0xf0000
84#define EIP197_PE_BASE 0xa0000 94#define EIP197_PE_BASE 0xa0000
95#define EIP197_GLOBAL_BASE 0xf0000
85 96
86/* EIP97 base offsets */ 97/* EIP97 base offsets */
87#define EIP97_HIA_AIC_BASE 0x0 98#define EIP97_HIA_AIC_BASE 0x0
@@ -94,6 +105,7 @@
94#define EIP97_HIA_DSE_THR_BASE 0xf600 105#define EIP97_HIA_DSE_THR_BASE 0xf600
95#define EIP97_HIA_GEN_CFG_BASE 0x10000 106#define EIP97_HIA_GEN_CFG_BASE 0x10000
96#define EIP97_PE_BASE 0x10000 107#define EIP97_PE_BASE 0x10000
108#define EIP97_GLOBAL_BASE 0x10000
97 109
98/* CDR/RDR register offsets */ 110/* CDR/RDR register offsets */
99#define EIP197_HIA_xDR_OFF(priv, r) (EIP197_HIA_AIC_xDR(priv) + (r) * 0x1000) 111#define EIP197_HIA_xDR_OFF(priv, r) (EIP197_HIA_AIC_xDR(priv) + (r) * 0x1000)
@@ -146,9 +158,11 @@
146#define EIP197_PE_EIP96_CONTEXT_CTRL(n) (0x1008 + (0x2000 * (n))) 158#define EIP197_PE_EIP96_CONTEXT_CTRL(n) (0x1008 + (0x2000 * (n)))
147#define EIP197_PE_EIP96_CONTEXT_STAT(n) (0x100c + (0x2000 * (n))) 159#define EIP197_PE_EIP96_CONTEXT_STAT(n) (0x100c + (0x2000 * (n)))
148#define EIP197_PE_EIP96_OPTIONS(n) (0x13f8 + (0x2000 * (n))) 160#define EIP197_PE_EIP96_OPTIONS(n) (0x13f8 + (0x2000 * (n)))
161#define EIP197_PE_EIP96_VERSION(n) (0x13fc + (0x2000 * (n)))
149#define EIP197_PE_OUT_DBUF_THRES(n) (0x1c00 + (0x2000 * (n))) 162#define EIP197_PE_OUT_DBUF_THRES(n) (0x1c00 + (0x2000 * (n)))
150#define EIP197_PE_OUT_TBUF_THRES(n) (0x1d00 + (0x2000 * (n))) 163#define EIP197_PE_OUT_TBUF_THRES(n) (0x1d00 + (0x2000 * (n)))
151#define EIP197_MST_CTRL 0xfff4 164#define EIP197_MST_CTRL 0xfff4
165#define EIP197_VERSION 0xfffc
152 166
153/* EIP197-specific registers, no indirection */ 167/* EIP197-specific registers, no indirection */
154#define EIP197_CLASSIFICATION_RAMS 0xe0000 168#define EIP197_CLASSIFICATION_RAMS 0xe0000
@@ -252,6 +266,7 @@
252#define EIP197_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 20) 266#define EIP197_MST_CTRL_TX_MAX_CMD(n) (((n) & 0xf) << 20)
253#define EIP197_MST_CTRL_BYTE_SWAP BIT(24) 267#define EIP197_MST_CTRL_BYTE_SWAP BIT(24)
254#define EIP197_MST_CTRL_NO_BYTE_SWAP BIT(25) 268#define EIP197_MST_CTRL_NO_BYTE_SWAP BIT(25)
269#define EIP197_MST_CTRL_BYTE_SWAP_BITS GENMASK(25, 24)
255 270
256/* EIP197_PE_IN_DBUF/TBUF_THRES */ 271/* EIP197_PE_IN_DBUF/TBUF_THRES */
257#define EIP197_PE_IN_xBUF_THRES_MIN(n) ((n) << 8) 272#define EIP197_PE_IN_xBUF_THRES_MIN(n) ((n) << 8)
@@ -651,14 +666,19 @@ struct safexcel_register_offsets {
651 u32 hia_dse_thr; 666 u32 hia_dse_thr;
652 u32 hia_gen_cfg; 667 u32 hia_gen_cfg;
653 u32 pe; 668 u32 pe;
669 u32 global;
654}; 670};
655 671
656enum safexcel_flags { 672enum safexcel_flags {
657 EIP197_TRC_CACHE = BIT(0), 673 EIP197_TRC_CACHE = BIT(0),
674 SAFEXCEL_HW_EIP197 = BIT(1),
658}; 675};
659 676
660struct safexcel_hwconfig { 677struct safexcel_hwconfig {
661 enum safexcel_eip_algorithms algo_flags; 678 enum safexcel_eip_algorithms algo_flags;
679 int hwver;
680 int hiaver;
681 int pever;
662}; 682};
663 683
664struct safexcel_crypto_priv { 684struct safexcel_crypto_priv {