summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/fsl/fsl_dsp.c')
-rw-r--r--sound/soc/fsl/fsl_dsp.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/sound/soc/fsl/fsl_dsp.c b/sound/soc/fsl/fsl_dsp.c
index ea95c87507c4..593fb80ba48b 100644
--- a/sound/soc/fsl/fsl_dsp.c
+++ b/sound/soc/fsl/fsl_dsp.c
@@ -739,6 +739,8 @@ static const struct file_operations dsp_fops = {
static int fsl_dsp_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ struct device_node *reserved_node;
+ struct resource reserved_res;
struct fsl_dsp *dsp_priv;
const char *fw_name;
struct resource *res;
@@ -820,14 +822,32 @@ static int fsl_dsp_probe(struct platform_device *pdev)
return ret;
}
- dsp_priv->sdram_phys_addr = SDRAM_BASE_ADDR;
+ reserved_node = of_parse_phandle(np, "reserved-region", 0);
+ if (!reserved_node) {
+ dev_err(&pdev->dev, "failed to get reserved region node\n");
+ return -ENODEV;
+ }
+
+ if (of_address_to_resource(reserved_node, 0, &reserved_res)) {
+ dev_err(&pdev->dev, "failed to get reserved region address\n");
+ return -EINVAL;
+ }
+
+ dsp_priv->sdram_phys_addr = reserved_res.start;
+ dsp_priv->sdram_reserved_size = (reserved_res.end - reserved_res.start)
+ + 1;
+ if (dsp_priv->sdram_reserved_size <= 0) {
+ dev_err(&pdev->dev, "invalid value of reserved region size\n");
+ return -EINVAL;
+ }
+
dsp_priv->sdram_vir_addr = ioremap_wc(dsp_priv->sdram_phys_addr,
- SDRAM_BASE_SIZE);
+ dsp_priv->sdram_reserved_size);
if (!dsp_priv->sdram_vir_addr) {
dev_err(&pdev->dev, "failed to remap sdram space for dsp firmware\n");
return -ENXIO;
}
- memset_io(dsp_priv->sdram_vir_addr, 0, SDRAM_BASE_SIZE);
+ memset_io(dsp_priv->sdram_vir_addr, 0, dsp_priv->sdram_reserved_size);
size = MSG_BUF_SIZE + DSP_CONFIG_SIZE;
@@ -848,12 +868,16 @@ static int fsl_dsp_probe(struct platform_device *pdev)
dsp_priv->dsp_config_phys = buf_phys + offset;
dsp_priv->dsp_config_size = DSP_CONFIG_SIZE;
- /* scratch memory for dsp framework */
+ /* scratch memory for dsp framework. The sdram reserved memory
+ * is split into two equal parts currently. The front part is
+ * used to keep the dsp firmware, the other part is considered
+ * as scratch memory for dsp framework.
+ */
dsp_priv->scratch_buf_virt = dsp_priv->sdram_vir_addr +
- SDRAM_CODEC_LIB_OFFSET;
+ dsp_priv->sdram_reserved_size / 2;
dsp_priv->scratch_buf_phys = dsp_priv->sdram_phys_addr +
- SDRAM_CODEC_LIB_OFFSET;
- dsp_priv->scratch_buf_size = SDRAM_BASE_SIZE - SDRAM_CODEC_LIB_OFFSET;
+ dsp_priv->sdram_reserved_size / 2;
+ dsp_priv->scratch_buf_size = dsp_priv->sdram_reserved_size / 2;
/* initialize the reference counter for dsp_priv
* structure