MLK-17481-3: ASoC: fsl: Fix DSP memory mappings
authorDaniel Baluta <daniel.baluta@nxp.com>
Wed, 23 May 2018 06:40:55 +0000 (09:40 +0300)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 18 Apr 2019 00:00:38 +0000 (03:00 +0300)
We load DSP firmware from the ARM side at 0x556e8000 but because the
compiler generated memory layout starts at 0x596e8000 we need to do
some fixups.

Thus, each address (in DSP local memory) generated by the compiler
needs to be substracted an offset = 0x596e8000 - 0x556e8000 = 0x4000000.

Because this only happens on QM we will use dts to specify the offset.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 8d4518d2a5d956549e829470af15003d7adff841)
(cherry picked from commit 513befc82cd9b622ec145b3886f49f8551301c08)

sound/soc/fsl/fsl_dsp.c
sound/soc/fsl/fsl_dsp.h

index 73a4e53..b251a18 100644 (file)
@@ -698,6 +698,12 @@ static void dsp_load_firmware(const struct firmware *fw, void *context)
                                        shdr->sh_size);
                                }
                        } else {
+                               /* sh_addr is from DSP view, we need to
+                                * fixup addr because we load the firmware from
+                                * the ARM core side
+                                */
+                               sh_addr -= dsp_priv->fixup_offset;
+
                                memcpy_dsp((void *)(dsp_priv->regs +
                                                (sh_addr - dsp_priv->paddr)),
                                                (const void *)image,
@@ -855,6 +861,8 @@ static int fsl_dsp_probe(struct platform_device *pdev)
        ret = of_property_read_string(np, "fsl,dsp-firmware", &fw_name);
        dsp_priv->fw_name = fw_name;
 
+       ret = of_property_read_u32(np, "fixup-offset", &dsp_priv->fixup_offset);
+
        platform_set_drvdata(pdev, dsp_priv);
        pm_runtime_enable(&pdev->dev);
 
index 041f5df..57457b3 100644 (file)
@@ -86,6 +86,8 @@ struct fsl_dsp {
        dma_addr_t                       dsp_config_phys;
        int                              dsp_config_size;
 
+       unsigned int                    fixup_offset;
+
        /* ...proxy data structures */
        struct xf_proxy proxy;