diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 37fe740c31d4e..5859e9ce4592c 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -377,7 +377,7 @@ define Device/bananapi_bpi-r4-common DEVICE_DTS_LOADADDR := 0x45f00000 DEVICE_DTS_OVERLAY:= mt7988a-bananapi-bpi-r4-emmc mt7988a-bananapi-bpi-r4-rtc mt7988a-bananapi-bpi-r4-sd mt7988a-bananapi-bpi-r4-wifi-mt7996a DEVICE_DTC_FLAGS := --pad 4096 - DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-mux-pca954x kmod-eeprom-at24 kmod-mt7996-firmware kmod-mt7996-233-firmware \ + DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-thermal kmod-i2c-mux-pca954x kmod-eeprom-at24 kmod-mt7996-firmware kmod-mt7996-233-firmware \ kmod-rtc-pcf8563 kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7988-wo-firmware IMAGES := sysupgrade.itb KERNEL_LOADADDR := 0x46000000 diff --git a/target/linux/mediatek/patches-6.6/870-crypto-safexcel-add-eip197-inside-secure-support.patch b/target/linux/mediatek/patches-6.6/870-crypto-safexcel-add-eip197-inside-secure-support.patch new file mode 100644 index 0000000000000..b28c9b0419271 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/870-crypto-safexcel-add-eip197-inside-secure-support.patch @@ -0,0 +1,69 @@ +--- a/drivers/crypto/inside-secure/safexcel.c ++++ b/drivers/crypto/inside-secure/safexcel.c +@@ -455,6 +455,9 @@ retry_fw: + + ipuesz = eip197_write_firmware(priv, fw[FW_IPUE]); + ++ for (j = 0; j < i; j++) ++ release_firmware(fw[j]); ++ + if (eip197_start_firmware(priv, ipuesz, ifppsz, minifw)) { + dev_dbg(priv->dev, "Firmware loaded successfully\n"); + return 0; +@@ -605,6 +608,11 @@ static int safexcel_hw_init(struct safex + */ + if (priv->flags & SAFEXCEL_HW_EIP197) { + val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); ++ /* Clear axi_burst_size and rx_burst_size */ ++ val &= 0xffffff00; ++ /* Set axi_burst_size = 3, rx_burst_size = 3 */ ++ val |= EIP197_MST_CTRL_RD_CACHE(3); ++ val |= EIP197_MST_CTRL_WD_CACHE(3); + val |= EIP197_MST_CTRL_TX_MAX_CMD(5); + writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL); + } +@@ -805,6 +813,12 @@ static int safexcel_hw_init(struct safex + return ret; + } + ++ /* Allow clocks to be forced on for EIP197 */ ++ if (priv->flags & SAFEXCEL_HW_EIP197) { ++ writel(0xffffffff, EIP197_HIA_GEN_CFG(priv) + EIP197_FORCE_CLOCK_ON); ++ writel(0xffffffff, EIP197_HIA_GEN_CFG(priv) + EIP197_FORCE_CLOCK_ON2); ++ } ++ + return safexcel_hw_setup_cdesc_rings(priv) ?: + safexcel_hw_setup_rdesc_rings(priv) ?: + 0; +@@ -1746,6 +1760,7 @@ static int safexcel_probe(struct platfor + { + struct device *dev = &pdev->dev; + struct safexcel_crypto_priv *priv; ++ struct resource *res; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); +@@ -1757,7 +1772,11 @@ static int safexcel_probe(struct platfor + + platform_set_drvdata(pdev, priv); + +- priv->base = devm_platform_ioremap_resource(pdev, 0); ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) ++ return -EINVAL; ++ ++ priv->base = devm_ioremap(dev, res->start, resource_size(res)); + if (IS_ERR(priv->base)) { + dev_err(dev, "failed to get resource\n"); + return PTR_ERR(priv->base); +--- a/drivers/crypto/inside-secure/safexcel.h ++++ b/drivers/crypto/inside-secure/safexcel.h +@@ -189,6 +189,8 @@ + #define EIP197_PE_DEBUG(n) (0x1ff4 + (0x2000 * (n))) + #define EIP197_PE_OPTIONS(n) (0x1ff8 + (0x2000 * (n))) + #define EIP197_PE_VERSION(n) (0x1ffc + (0x2000 * (n))) ++#define EIP197_FORCE_CLOCK_ON2 0xffd8 ++#define EIP197_FORCE_CLOCK_ON 0xffe8 + #define EIP197_MST_CTRL 0xfff4 + #define EIP197_OPTIONS 0xfff8 + #define EIP197_VERSION 0xfffc