msm: audio: qdsp6v2: Modify dspcrashd to use new memory addresses
Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index ae85aff..7b2c778 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -830,6 +830,26 @@
};
#endif
+#define DSP_RAM_BASE_8960 0x8da00000
+#define DSP_RAM_SIZE_8960 0x1800000
+static int dspcrashd_pdata_8960 = 0xDEADDEAD;
+
+static struct resource resources_dspcrashd_8960[] = {
+ {
+ .name = "msm_dspcrashd",
+ .start = DSP_RAM_BASE_8960,
+ .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
+ .flags = IORESOURCE_DMA,
+ },
+};
+
+struct platform_device msm_device_dspcrashd_8960 = {
+ .name = "msm_dspcrashd",
+ .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
+ .resource = resources_dspcrashd_8960,
+ .dev = { .platform_data = &dspcrashd_pdata_8960 },
+};
+
static struct memtype_reserve msm8960_reserve_table[] __initdata = {
[MEMTYPE_SMI] = {
},
@@ -3515,6 +3535,7 @@
&msm_funnel_device,
&msm_ptm_device,
#endif
+ &msm_device_dspcrashd_8960,
};
static struct platform_device *sim_devices[] __initdata = {
diff --git a/arch/arm/mach-msm/qdsp6v2/board-msm8x60-audio.c b/arch/arm/mach-msm/qdsp6v2/board-msm8x60-audio.c
index d1a4fe0..401c759 100644
--- a/arch/arm/mach-msm/qdsp6v2/board-msm8x60-audio.c
+++ b/arch/arm/mach-msm/qdsp6v2/board-msm8x60-audio.c
@@ -54,6 +54,26 @@
#define SNDDEV_GPIO_MIC1_ANCL_SEL 295
#define SNDDEV_GPIO_HS_MIC4_SEL 296
+#define DSP_RAM_BASE_8x60 0x46700000
+#define DSP_RAM_SIZE_8x60 0x2000000
+static int dspcrashd_pdata_8x60 = 0xDEADDEAD;
+
+static struct resource resources_dspcrashd_8x60[] = {
+ {
+ .name = "msm_dspcrashd",
+ .start = DSP_RAM_BASE_8x60,
+ .end = DSP_RAM_BASE_8x60 + DSP_RAM_SIZE_8x60,
+ .flags = IORESOURCE_DMA,
+ },
+};
+
+struct platform_device msm_device_dspcrashd_8x60 = {
+ .name = "msm_dspcrashd",
+ .num_resources = ARRAY_SIZE(resources_dspcrashd_8x60),
+ .resource = resources_dspcrashd_8x60,
+ .dev = { .platform_data = &dspcrashd_pdata_8x60 },
+};
+
static struct resource msm_cdcclk_ctl_resources[] = {
{
.name = "msm_snddev_tx_mclk",
@@ -2571,6 +2591,7 @@
&msm_cdcclk_ctl_device,
&msm_mi2s_device,
&msm_uplink_rx_device,
+ &msm_device_dspcrashd_8x60,
};
#ifdef CONFIG_MSM8X60_FTM_AUDIO_DEVICES
diff --git a/arch/arm/mach-msm/qdsp6v2/dsp_debug.c b/arch/arm/mach-msm/qdsp6v2/dsp_debug.c
index 4382c23..1d8195e 100644
--- a/arch/arm/mach-msm/qdsp6v2/dsp_debug.c
+++ b/arch/arm/mach-msm/qdsp6v2/dsp_debug.c
@@ -22,6 +22,7 @@
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/delay.h>
+#include <linux/platform_device.h>
#include <asm/atomic.h>
#include "../proc_comm.h"
@@ -57,8 +58,6 @@
}
if (cb_ptr)
cb_ptr(DSP_STATE_CRASH_DUMP_DONE);
-
- BUG();
}
static int dsp_open(struct inode *inode, struct file *file)
@@ -125,10 +124,9 @@
return count;
}
-#define DSP_RAM_BASE 0x46700000
-#define DSP_RAM_SIZE 0x2000000
-
static unsigned copy_ok_count;
+static uint32_t dsp_ram_size;
+static uint32_t dsp_ram_base;
static ssize_t dsp_read(struct file *file, char __user *buf,
size_t count, loff_t *pos)
@@ -140,13 +138,20 @@
unsigned int flags = MSM_SUBSYSTEM_MAP_KADDR | MSM_SUBSYSTEM_MAP_CACHED;
struct msm_mapped_buffer *mem_buffer;
- if (*pos >= DSP_RAM_SIZE)
+ if ((dsp_ram_base == 0) || (dsp_ram_size == 0)) {
+ pr_err("[%s:%s] Memory Invalid or not initialized, Base = 0x%x,"
+ " size = 0x%x\n", __MM_FILE__,
+ __func__, dsp_ram_base, dsp_ram_size);
+ return -EINVAL;
+ }
+
+ if (*pos >= dsp_ram_size)
return 0;
if (*pos & (PAGE_SIZE - 1))
return -EINVAL;
- addr = (*pos + DSP_RAM_BASE);
+ addr = (*pos + dsp_ram_base);
/* don't blow up if we're unaligned */
if (addr & (PAGE_SIZE - 1))
@@ -200,6 +205,28 @@
return 0;
}
+static int dspcrashd_probe(struct platform_device *pdev)
+{
+ int rc = 0;
+ struct resource *res;
+ int *pdata;
+
+ pdata = pdev->dev.platform_data;
+ res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
+ "msm_dspcrashd");
+ if (!res) {
+ pr_err("%s: failed to get resources for dspcrashd\n", __func__);
+ return -ENODEV;
+ }
+
+ dsp_ram_base = res->start;
+ dsp_ram_size = res->end - res->start;
+ pr_info("%s: Platform driver values: Base = 0x%x, Size = 0x%x,"
+ "pdata = 0x%x\n", __func__,
+ dsp_ram_base, dsp_ram_size, *pdata);
+ return rc;
+}
+
static const struct file_operations dsp_fops = {
.owner = THIS_MODULE,
.open = dsp_open,
@@ -214,11 +241,27 @@
.fops = &dsp_fops,
};
+static struct platform_driver dspcrashd_driver = {
+ .probe = dspcrashd_probe,
+ .driver = { .name = "msm_dspcrashd"}
+};
static int __init dsp_init(void)
{
+ int rc = 0;
init_waitqueue_head(&dsp_wait);
+ rc = platform_driver_register(&dspcrashd_driver);
+ if (IS_ERR_VALUE(rc)) {
+ pr_err("%s: platform_driver_register for dspcrashd failed\n",
+ __func__);
+ }
return misc_register(&dsp_misc);
}
+static int __exit dsp_exit(void)
+{
+ platform_driver_unregister(&dspcrashd_driver);
+ return 0;
+}
+
device_initcall(dsp_init);