static struct platform_device *devices[] __initdata = {
&msm_device_uart3,
+ &msm_device_dmov,
&msm_device_smd,
&msm_device_nand,
&msm_device_hsusb,
#if !defined(CONFIG_MSM_SERIAL_DEBUGGER)
&msm_device_uart1,
#endif
+ &msm_device_dmov,
&msm_device_uart_dm1,
&msm_device_nand,
};
#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
&msm_device_uart2,
#endif
+ &msm_device_dmov,
&msm_device_smd,
&msm_device_otg,
&msm_device_hsusb,
static struct platform_device *devices[] __initdata = {
&msm_device_uart3,
+ &msm_device_dmov,
&msm_device_smd,
&msm_device_otg,
&msm_device_hsusb,
static struct platform_device *devices[] __initdata = {
&msm_device_uart3,
+ &msm_device_dmov,
&msm_device_smd,
&msm_device_nand,
&msm_device_hsusb,
.resource = resources_mdp,
};
+static struct resource resources_dmov[] = {
+ {
+ .start = MSM7X00_DMOV_PHYS,
+ .end = MSM7X00_DMOV_PHYS + MSM7X00_DMOV_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_ADM_AARM,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm_device_dmov = {
+ .name = "msm_dmov",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resources_dmov),
+ .resource = resources_dmov,
+};
+
struct clk_lookup msm_clocks_7x01a[] = {
- CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
+ CLK_PCOM("adm_clk", ADM_CLK, "msm_dmov", 0),
CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0),
CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0),
},
};
+static struct resource resources_dmov[] = {
+ {
+ .start = MSM7X30_DMOV_PHYS,
+ .end = MSM7X30_DMOV_PHYS + MSM7X30_DMOV_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_ADM_AARM,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm_device_dmov = {
+ .name = "msm_dmov",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resources_dmov),
+ .resource = resources_dmov,
+};
+
struct clk_lookup msm_clocks_7x30[] = {
- CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
+ CLK_PCOM("adm_clk", ADM_CLK, "msm_dmov", 0),
CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0),
CLK_PCOM("camif_pad_pclk", CAMIF_PAD_P_CLK, NULL, OFF),
return platform_device_register(pdev);
}
+static struct resource resources_dmov[] = {
+ {
+ .start = QSD8X50_DMOV_PHYS,
+ .end = QSD8X50_DMOV_PHYS + QSD8X50_DMOV_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = INT_ADM_AARM,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+struct platform_device msm_device_dmov = {
+ .name = "msm_dmov",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resources_dmov),
+ .resource = resources_dmov,
+};
+
struct clk_lookup msm_clocks_8x50[] = {
- CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
+ CLK_PCOM("adm_clk", ADM_CLK, "msm_dmov", 0),
CLK_PCOM("ce_clk", CE_CLK, NULL, 0),
CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
CLK_PCOM("ebi2_clk", EBI2_CLK, NULL, 0),
extern struct platform_device msm_device_smd;
+extern struct platform_device msm_device_dmov;
+
extern struct platform_device msm_device_nand;
extern struct platform_device msm_device_mddi0;
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
#include <mach/dma.h>
#define MSM_DMOV_CHANNEL_COUNT 16
+#define MODULE_NAME "msm_dmov"
+
enum {
MSM_DMOV_PRINT_ERRORS = 1,
MSM_DMOV_PRINT_IO = 2,
static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
+static void __iomem *msm_dmov_base;
+static unsigned msm_dmov_irq;
-#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
-#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
-#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
-#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
+#define DMOV_SD0(off, ch) (msm_dmov_base + 0x0000 + (off) + ((ch) << 2))
+#define DMOV_SD1(off, ch) (msm_dmov_base + 0x0400 + (off) + ((ch) << 2))
+#define DMOV_SD2(off, ch) (msm_dmov_base + 0x0800 + (off) + ((ch) << 2))
+#define DMOV_SD3(off, ch) (msm_dmov_base + 0x0C00 + (off) + ((ch) << 2))
#if defined(CONFIG_ARCH_MSM7X30)
#define DMOV_SD_AARM DMOV_SD2
PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
list_add_tail(&cmd->list, &active_commands[id]);
if (!channel_active)
- enable_irq(INT_ADM_AARM);
+ enable_irq(msm_dmov_irq);
channel_active |= 1U << id;
writel(cmd->cmdptr, DMOV_CMD_PTR(id));
} else {
}
if (!channel_active) {
- disable_irq_nosync(INT_ADM_AARM);
+ disable_irq_nosync(msm_dmov_irq);
msm_dmov_clocks_off();
}
clk_put(msm_dmov_pclk);
}
-static int __init msm_dmov_init_clocks(void)
+static int __devinit msm_dmov_init_clocks(struct platform_device *pdev)
{
int ret = 0;
- msm_dmov_clk = clk_get(NULL, "adm_clk");
+ msm_dmov_clk = clk_get(&pdev->dev, "adm_clk");
if (IS_ERR(msm_dmov_clk)) {
PRINT_ERROR("%s: Error getting adm_clk\n", __func__);
ret = PTR_ERR(msm_dmov_clk);
}
- msm_dmov_pclk = clk_get(NULL, "adm_pclk");
+ msm_dmov_pclk = clk_get(&pdev->dev, "adm_pclk");
/* pclk not present on all SoCs, don't return error on failure */
return ret;
}
-static int __init msm_init_datamover(void)
+static int __devinit msm_dmov_probe(struct platform_device *pdev)
{
int i;
int ret;
+ struct resource *res;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENXIO;
+
+ msm_dmov_base = ioremap_nocache(res->start, resource_size(res));
+ if (!msm_dmov_base)
+ return -ENOMEM;
for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
INIT_LIST_HEAD(&ready_commands[i]);
INIT_LIST_HEAD(&active_commands[i]);
- writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
+ writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT |
+ DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
}
- ret = msm_dmov_init_clocks();
+ ret = msm_dmov_init_clocks(pdev);
if (ret)
- return ret;
+ goto out_map;
- ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0,
- "msmdatamover", NULL);
- if (ret) {
- msm_dmov_deinit_clocks();
- return ret;
+ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+ if (!res) {
+ ret = -EINVAL;
+ goto out_clock;
}
- disable_irq(INT_ADM_AARM);
+
+ msm_dmov_irq = res->start;
+ ret = request_irq(msm_dmov_irq, msm_datamover_irq_handler, 0,
+ "msmdatamover", NULL);
+ if (ret)
+ goto out_clock;
+ disable_irq(msm_dmov_irq);
+
return 0;
+out_clock:
+ msm_dmov_deinit_clocks();
+out_map:
+ iounmap(msm_dmov_base);
+ return ret;
}
-arch_initcall(msm_init_datamover);
+static struct platform_driver msm_dmov_driver = {
+ .probe = msm_dmov_probe,
+ .driver = {
+ .name = MODULE_NAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init msm_init_datamover(void)
+{
+ return platform_driver_register(&msm_dmov_driver);
+}
+arch_initcall(msm_init_datamover);
#define MSM7X00_CSR_PHYS 0xC0100000
#define MSM7X00_CSR_SIZE SZ_4K
-#define MSM_DMOV_BASE IOMEM(0xE0002000)
-#define MSM_DMOV_PHYS 0xA9700000
-#define MSM_DMOV_SIZE SZ_4K
+#define MSM7X00_DMOV_PHYS 0xA9700000
+#define MSM7X00_DMOV_SIZE SZ_4K
#define MSM_GPIO1_BASE IOMEM(0xE0003000)
#define MSM_GPIO1_PHYS 0xA9200000
#define MSM7X30_CSR_PHYS 0xC0100000
#define MSM7X30_CSR_SIZE SZ_4K
-#define MSM_DMOV_BASE IOMEM(0xE0002000)
-#define MSM_DMOV_PHYS 0xAC400000
-#define MSM_DMOV_SIZE SZ_4K
+#define MSM7X30_DMOV_PHYS 0xAC400000
+#define MSM7X30_DMOV_SIZE SZ_4K
#define MSM_GPIO1_BASE IOMEM(0xE0003000)
#define MSM_GPIO1_PHYS 0xAC001000
#define QSD8X50_CSR_PHYS 0xAC100000
#define QSD8X50_CSR_SIZE SZ_4K
-#define MSM_DMOV_BASE IOMEM(0xE0002000)
-#define MSM_DMOV_PHYS 0xA9700000
-#define MSM_DMOV_SIZE SZ_4K
+#define QSD8X50_DMOV_PHYS 0xA9700000
+#define QSD8X50_DMOV_SIZE SZ_4K
#define MSM_GPIO1_BASE IOMEM(0xE0003000)
#define MSM_GPIO1_PHYS 0xA9000000
static struct map_desc msm_io_desc[] __initdata = {
MSM_DEVICE(VIC),
MSM_CHIP_DEVICE(CSR, MSM7X00),
- MSM_DEVICE(DMOV),
MSM_DEVICE(GPIO1),
MSM_DEVICE(GPIO2),
MSM_DEVICE(CLK_CTL),
static struct map_desc qsd8x50_io_desc[] __initdata = {
MSM_DEVICE(VIC),
MSM_CHIP_DEVICE(CSR, QSD8X50),
- MSM_DEVICE(DMOV),
MSM_DEVICE(GPIO1),
MSM_DEVICE(GPIO2),
MSM_DEVICE(CLK_CTL),
static struct map_desc msm7x30_io_desc[] __initdata = {
MSM_DEVICE(VIC),
MSM_CHIP_DEVICE(CSR, MSM7X30),
- MSM_DEVICE(DMOV),
MSM_DEVICE(GPIO1),
MSM_DEVICE(GPIO2),
MSM_DEVICE(CLK_CTL),