]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
remoteproc: imx: Support ECC initialization
authorPeng Fan <peng.fan@nxp.com>
Mon, 2 Feb 2026 02:57:44 +0000 (10:57 +0800)
committerFabio Estevam <festevam@gmail.com>
Fri, 6 Feb 2026 23:31:32 +0000 (20:31 -0300)
Add a new flag ATT_ECC which indicates the memory region needs ECC
initialization. If the flag is set, clearing the whole memory region to
initialize ECC. If ECC is not initialized, remote core will crash if
directly access the area.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/remoteproc/imx_rproc.c

index 9bb5532799803d05de0e125475b3dc41a452e906..9eecbe70f0b7fc69a9b92cc9d9a01863db0b42b1 100644 (file)
@@ -46,6 +46,7 @@ struct imx_rproc {
 /* M4 own area. Can be mapped at probe */
 #define ATT_OWN         BIT(31)
 #define ATT_IOMEM       BIT(30)
+#define ATT_ECC         BIT(29)
 
 static int imx_rproc_arm_smc_start(struct udevice *dev)
 {
@@ -202,6 +203,26 @@ static void *imx_rproc_device_to_virt(struct udevice *dev, ulong da, ulong size,
 
 static int imx_rproc_load(struct udevice *dev, ulong addr, ulong size)
 {
+       struct imx_rproc *priv = dev_get_priv(dev);
+       const struct imx_rproc_dcfg *dcfg = priv->dcfg;
+       int i;
+
+       /*
+        * Before loading elf, need do ECC initialization by clearing the memory
+        * region, if ATT_ECC is set.
+        */
+       for (i = 0; i < dcfg->att_size; i++) {
+               const struct imx_rproc_att *att = &dcfg->att[i];
+
+               if (!(att->flags & ATT_ECC))
+                       continue;
+
+               if (att->flags & ATT_IOMEM)
+                       memset_io((void __iomem *)(long)att->sa, 0, att->size);
+               else
+                       memset((void *)(long)att->sa, 0, att->size);
+       }
+
        return rproc_elf_load_image(dev, addr, size);
 }