Skip to content

Commit

Permalink
arm/imx/dma-v1: protect #ifdef'd blocks additionally by cpu_is_...
Browse files Browse the repository at this point in the history
This is necessary for a multi-SoC kernel.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information
Uwe Kleine-König committed Feb 24, 2010
1 parent e9f49d4 commit 8735fde
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions arch/arm/plat-mxc/dma-mx1-mx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ void imx_dma_enable(int channel)
CCR_ACRPT, DMA_CCR(channel));

#ifdef CONFIG_ARCH_MX2
if (imxdma->sg && imx_dma_hw_chain(imxdma)) {
if ((cpu_is_mx21() || cpu_is_mx27()) &&
imxdma->sg && imx_dma_hw_chain(imxdma)) {
imxdma->sg = sg_next(imxdma->sg);
if (imxdma->sg) {
u32 tmp;
Expand Down Expand Up @@ -654,7 +655,8 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
int i, disr;

#ifdef CONFIG_ARCH_MX2
dma_err_handler(irq, dev_id);
if (cpu_is_mx21() || cpu_is_mx27())
dma_err_handler(irq, dev_id);
#endif

disr = imx_dmav1_readl(DMA_DISR);
Expand Down Expand Up @@ -702,17 +704,19 @@ int imx_dma_request(int channel, const char *name)
local_irq_restore(flags); /* request_irq() can block */

#ifdef CONFIG_ARCH_MX2
ret = request_irq(MX2x_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA",
NULL);
if (ret) {
imxdma->name = NULL;
printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n",
MX2x_INT_DMACH0 + channel, channel);
return ret;
if (cpu_is_mx21() || cpu_is_mx27()) {
ret = request_irq(MX2x_INT_DMACH0 + channel,
dma_irq_handler, 0, "DMA", NULL);
if (ret) {
imxdma->name = NULL;
pr_crit("Can't register IRQ %d for DMA channel %d\n",
MX2x_INT_DMACH0 + channel, channel);
return ret;
}
init_timer(&imxdma->watchdog);
imxdma->watchdog.function = &imx_dma_watchdog;
imxdma->watchdog.data = channel;
}
init_timer(&imxdma->watchdog);
imxdma->watchdog.function = &imx_dma_watchdog;
imxdma->watchdog.data = channel;
#endif

return ret;
Expand Down Expand Up @@ -741,7 +745,8 @@ void imx_dma_free(int channel)
imxdma->name = NULL;

#ifdef CONFIG_ARCH_MX2
free_irq(MX2x_INT_DMACH0 + channel, NULL);
if (cpu_is_mx21() || cpu_is_mx27())
free_irq(MX2x_INT_DMACH0 + channel, NULL);
#endif

local_irq_restore(flags);
Expand Down Expand Up @@ -823,17 +828,19 @@ static int __init imx_dma_init(void)
imx_dmav1_writel(DCR_DRST, DMA_DCR);

#ifdef CONFIG_ARCH_MX1
ret = request_irq(DMA_INT, dma_irq_handler, 0, "DMA", NULL);
if (ret) {
printk(KERN_CRIT "Wow! Can't register IRQ for DMA\n");
return ret;
}
if (cpu_is_mx1()) {
ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", NULL);
if (ret) {
pr_crit("Wow! Can't register IRQ for DMA\n");
return ret;
}

ret = request_irq(DMA_ERR, dma_err_handler, 0, "DMA", NULL);
if (ret) {
printk(KERN_CRIT "Wow! Can't register ERRIRQ for DMA\n");
free_irq(DMA_INT, NULL);
return ret;
ret = request_irq(MX1_DMA_ERR, dma_err_handler, 0, "DMA", NULL);
if (ret) {
pr_crit("Wow! Can't register ERRIRQ for DMA\n");
free_irq(MX1_DMA_INT, NULL);
return ret;
}
}
#endif
/* enable DMA module */
Expand Down

0 comments on commit 8735fde

Please sign in to comment.