Commit 594ed3d2 authored by Peter Harliman Liem's avatar Peter Harliman Liem Committed by Herbert Xu

crypto: inside-secure - Add fw_little_endian option

This is to add fw_little_endian option, which can
be used for platform which firmware is using little-endian
(instead of big-endian).
Signed-off-by: default avatarPeter Harliman Liem <pliem@maxlinear.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 22044d9b
...@@ -316,14 +316,20 @@ static void eip197_init_firmware(struct safexcel_crypto_priv *priv) ...@@ -316,14 +316,20 @@ static void eip197_init_firmware(struct safexcel_crypto_priv *priv)
static int eip197_write_firmware(struct safexcel_crypto_priv *priv, static int eip197_write_firmware(struct safexcel_crypto_priv *priv,
const struct firmware *fw) const struct firmware *fw)
{ {
const __be32 *data = (const __be32 *)fw->data; u32 val;
int i; int i;
/* Write the firmware */ /* Write the firmware */
for (i = 0; i < fw->size / sizeof(u32); i++) for (i = 0; i < fw->size / sizeof(u32); i++) {
writel(be32_to_cpu(data[i]), if (priv->data->fw_little_endian)
val = le32_to_cpu(((const __le32 *)fw->data)[i]);
else
val = be32_to_cpu(((const __be32 *)fw->data)[i]);
writel(val,
priv->base + EIP197_CLASSIFICATION_RAMS + priv->base + EIP197_CLASSIFICATION_RAMS +
i * sizeof(__be32)); i * sizeof(val));
}
/* Exclude final 2 NOPs from size */ /* Exclude final 2 NOPs from size */
return i - EIP197_FW_TERMINAL_NOPS; return i - EIP197_FW_TERMINAL_NOPS;
......
...@@ -735,6 +735,7 @@ enum safexcel_eip_version { ...@@ -735,6 +735,7 @@ enum safexcel_eip_version {
struct safexcel_priv_data { struct safexcel_priv_data {
enum safexcel_eip_version version; enum safexcel_eip_version version;
bool fw_little_endian;
}; };
/* Priority we use for advertising our algorithms */ /* Priority we use for advertising our algorithms */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment