Skip to content

Commit d7e9d01

Browse files
Angelo DureghelloGreg Ungerer
authored andcommitted
m68k: add ColdFire mcf5441x eDMA platform support
This patch adds support for ColdFire eDMA platform driver. Signed-off-by: Angelo Dureghello <[email protected]> Signed-off-by: Greg Ungerer <[email protected]>
1 parent 5908e6b commit d7e9d01

File tree

3 files changed

+98
-2
lines changed

3 files changed

+98
-2
lines changed

arch/m68k/coldfire/device.c

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
#include <linux/spi/spi.h>
1515
#include <linux/gpio.h>
1616
#include <linux/fec.h>
17+
#include <linux/dmaengine.h>
1718
#include <asm/traps.h>
1819
#include <asm/coldfire.h>
1920
#include <asm/mcfsim.h>
2021
#include <asm/mcfuart.h>
2122
#include <asm/mcfqspi.h>
23+
#include <linux/platform_data/edma.h>
24+
#include <linux/platform_data/dma-mcf-edma.h>
2225

2326
/*
2427
* All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
@@ -476,6 +479,81 @@ static struct platform_device mcf_i2c5 = {
476479
#endif /* MCFI2C_BASE5 */
477480
#endif /* IS_ENABLED(CONFIG_I2C_IMX) */
478481

482+
#if IS_ENABLED(CONFIG_MCF_EDMA)
483+
484+
static const struct dma_slave_map mcf_edma_map[] = {
485+
{ "dreq0", "rx-tx", MCF_EDMA_FILTER_PARAM(0) },
486+
{ "dreq1", "rx-tx", MCF_EDMA_FILTER_PARAM(1) },
487+
{ "uart.0", "rx", MCF_EDMA_FILTER_PARAM(2) },
488+
{ "uart.0", "tx", MCF_EDMA_FILTER_PARAM(3) },
489+
{ "uart.1", "rx", MCF_EDMA_FILTER_PARAM(4) },
490+
{ "uart.1", "tx", MCF_EDMA_FILTER_PARAM(5) },
491+
{ "uart.2", "rx", MCF_EDMA_FILTER_PARAM(6) },
492+
{ "uart.2", "tx", MCF_EDMA_FILTER_PARAM(7) },
493+
{ "timer0", "rx-tx", MCF_EDMA_FILTER_PARAM(8) },
494+
{ "timer1", "rx-tx", MCF_EDMA_FILTER_PARAM(9) },
495+
{ "timer2", "rx-tx", MCF_EDMA_FILTER_PARAM(10) },
496+
{ "timer3", "rx-tx", MCF_EDMA_FILTER_PARAM(11) },
497+
{ "fsl-dspi.0", "rx", MCF_EDMA_FILTER_PARAM(12) },
498+
{ "fsl-dspi.0", "tx", MCF_EDMA_FILTER_PARAM(13) },
499+
{ "fsl-dspi.1", "rx", MCF_EDMA_FILTER_PARAM(14) },
500+
{ "fsl-dspi.1", "tx", MCF_EDMA_FILTER_PARAM(15) },
501+
};
502+
503+
static struct mcf_edma_platform_data mcf_edma_data = {
504+
.dma_channels = 64,
505+
.slave_map = mcf_edma_map,
506+
.slavecnt = ARRAY_SIZE(mcf_edma_map),
507+
};
508+
509+
static struct resource mcf_edma_resources[] = {
510+
{
511+
.start = MCFEDMA_BASE,
512+
.end = MCFEDMA_BASE + MCFEDMA_SIZE - 1,
513+
.flags = IORESOURCE_MEM,
514+
},
515+
{
516+
.start = MCFEDMA_IRQ_INTR0,
517+
.end = MCFEDMA_IRQ_INTR0 + 15,
518+
.flags = IORESOURCE_IRQ,
519+
.name = "edma-tx-00-15",
520+
},
521+
{
522+
.start = MCFEDMA_IRQ_INTR16,
523+
.end = MCFEDMA_IRQ_INTR16 + 39,
524+
.flags = IORESOURCE_IRQ,
525+
.name = "edma-tx-16-55",
526+
},
527+
{
528+
.start = MCFEDMA_IRQ_INTR56,
529+
.end = MCFEDMA_IRQ_INTR56,
530+
.flags = IORESOURCE_IRQ,
531+
.name = "edma-tx-56-63",
532+
},
533+
{
534+
.start = MCFEDMA_IRQ_ERR,
535+
.end = MCFEDMA_IRQ_ERR,
536+
.flags = IORESOURCE_IRQ,
537+
.name = "edma-err",
538+
},
539+
};
540+
541+
static u64 mcf_edma_dmamask = DMA_BIT_MASK(32);
542+
543+
static struct platform_device mcf_edma = {
544+
.name = "mcf-edma",
545+
.id = 0,
546+
.num_resources = ARRAY_SIZE(mcf_edma_resources),
547+
.resource = mcf_edma_resources,
548+
.dev = {
549+
.dma_mask = &mcf_edma_dmamask,
550+
.coherent_dma_mask = DMA_BIT_MASK(32),
551+
.platform_data = &mcf_edma_data,
552+
}
553+
};
554+
555+
#endif /* IS_ENABLED(CONFIG_MCF_EDMA) */
556+
479557
static struct platform_device *mcf_devices[] __initdata = {
480558
&mcf_uart,
481559
#if IS_ENABLED(CONFIG_FEC)
@@ -505,6 +583,9 @@ static struct platform_device *mcf_devices[] __initdata = {
505583
&mcf_i2c5,
506584
#endif
507585
#endif
586+
#if IS_ENABLED(CONFIG_MCF_EDMA)
587+
&mcf_edma,
588+
#endif
508589
};
509590

510591
/*

arch/m68k/coldfire/m5441x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ struct clk *mcf_clks[] = {
137137

138138
static struct clk * const enable_clks[] __initconst = {
139139
/* make sure these clocks are enabled */
140+
&__clk_0_15, /* dspi.1 */
141+
&__clk_0_17, /* eDMA */
140142
&__clk_0_18, /* intc0 */
141143
&__clk_0_19, /* intc0 */
142144
&__clk_0_20, /* intc0 */
@@ -157,8 +159,6 @@ static struct clk * const disable_clks[] __initconst = {
157159
&__clk_0_8, /* can.0 */
158160
&__clk_0_9, /* can.1 */
159161
&__clk_0_14, /* i2c.1 */
160-
&__clk_0_15, /* dspi.1 */
161-
&__clk_0_17, /* eDMA */
162162
&__clk_0_22, /* i2c.0 */
163163
&__clk_0_23, /* dspi.0 */
164164
&__clk_0_28, /* tmr.1 */

arch/m68k/include/asm/m5441xsim.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,21 @@
282282
* DSPI module.
283283
*/
284284
#define MCFDSPI_BASE0 0xfc05c000
285+
#define MCFDSPI_BASE1 0xfC03c000
285286
#define MCF_IRQ_DSPI0 (MCFINT0_VECBASE + MCFINT0_DSPI0)
287+
#define MCF_IRQ_DSPI1 (MCFINT1_VECBASE + MCFINT1_DSPI1)
288+
/*
289+
* eDMA module.
290+
*/
291+
#define MCFEDMA_BASE 0xfc044000
292+
#define MCFEDMA_SIZE 0x4000
293+
#define MCFINT0_EDMA_INTR0 8
294+
#define MCFINT0_EDMA_ERR 24
295+
#define MCFEDMA_EDMA_INTR16 8
296+
#define MCFEDMA_EDMA_INTR56 0
297+
#define MCFEDMA_IRQ_INTR0 (MCFINT0_VECBASE + MCFINT0_EDMA_INTR0)
298+
#define MCFEDMA_IRQ_INTR16 (MCFINT1_VECBASE + MCFEDMA_EDMA_INTR16)
299+
#define MCFEDMA_IRQ_INTR56 (MCFINT2_VECBASE + MCFEDMA_EDMA_INTR56)
300+
#define MCFEDMA_IRQ_ERR (MCFINT0_VECBASE + MCFINT0_EDMA_ERR)
286301

287302
#endif /* m5441xsim_h */

0 commit comments

Comments
 (0)