]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
remoteproc/k3-r5: initialize TCM memories for ECC
authorSuman Anna <s-anna@ti.com>
Fri, 27 Sep 2019 21:28:56 +0000 (16:28 -0500)
committerSuman Anna <s-anna@ti.com>
Tue, 8 Oct 2019 23:30:44 +0000 (18:30 -0500)
The R5F processors on K3 SoCs all have two TCMs (ATCM and BTCM) that
support 32-bit ECC. The TCMs are typically loaded with some boot-up
code to initialize the R5 MPUs to further execute code out of DDR.
The ECC for the TCMs is enabled by default on K3 SoCs due to internal
default tie-off values, but the TCM memories are not initialized on
device power up. Any read access without the corresponding TCM memory
location initialized will generate an ECC error, and any such access
from a A72 or A53 core will trigger a SError.

So, zero initialize both the TCM memories before loading any firmware
onto a R5F in remoteproc mode. Any R5F booted from U-Boot/SPL would
require a similar initialization in the bootloader. Note that both
the TCMs are initialized unconditionally as the TCM enable config bits
only manage the access and visibility from R5. The Core1 TCMs are not
used and accessible in LockStep mode, so they are only initialized
in Split-mode.

Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/remoteproc/ti_k3_r5_remoteproc.c

index 2664ba29f61ecc88a4dcaca7a6131db6bca9eb7c..3d993ec1f5ea3bb8c90ef5b1a71c22dc632b1a82 100644 (file)
@@ -379,6 +379,17 @@ static int k3_r5_rproc_prepare(struct rproc *rproc)
                dev_err(dev, "unable to enable cores for TCM loading, ret = %d\n",
                        ret);
 
+       /*
+        * Zero out both TCMs unconditionally (access from v8 Arm core is not
+        * affected by ATCM & BTCM enable configuration values) so that ECC
+        * can be effective on all TCM addresses.
+        */
+       dev_dbg(dev, "zeroing out ATCM memory\n");
+       memset(core->mem[0].cpu_addr, 0x00, core->mem[0].size);
+
+       dev_dbg(dev, "zeroing out BTCM memory\n");
+       memset(core->mem[1].cpu_addr, 0x00, core->mem[1].size);
+
        return ret;
 }