|
14 | 14 | #include <linux/spi/spi.h>
|
15 | 15 | #include <linux/gpio.h>
|
16 | 16 | #include <linux/fec.h>
|
| 17 | +#include <linux/dmaengine.h> |
17 | 18 | #include <asm/traps.h>
|
18 | 19 | #include <asm/coldfire.h>
|
19 | 20 | #include <asm/mcfsim.h>
|
20 | 21 | #include <asm/mcfuart.h>
|
21 | 22 | #include <asm/mcfqspi.h>
|
| 23 | +#include <linux/platform_data/edma.h> |
| 24 | +#include <linux/platform_data/dma-mcf-edma.h> |
22 | 25 |
|
23 | 26 | /*
|
24 | 27 | * All current ColdFire parts contain from 2, 3, 4 or 10 UARTS.
|
@@ -476,6 +479,81 @@ static struct platform_device mcf_i2c5 = {
|
476 | 479 | #endif /* MCFI2C_BASE5 */
|
477 | 480 | #endif /* IS_ENABLED(CONFIG_I2C_IMX) */
|
478 | 481 |
|
| 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 | + |
479 | 557 | static struct platform_device *mcf_devices[] __initdata = {
|
480 | 558 | &mcf_uart,
|
481 | 559 | #if IS_ENABLED(CONFIG_FEC)
|
@@ -505,6 +583,9 @@ static struct platform_device *mcf_devices[] __initdata = {
|
505 | 583 | &mcf_i2c5,
|
506 | 584 | #endif
|
507 | 585 | #endif
|
| 586 | +#if IS_ENABLED(CONFIG_MCF_EDMA) |
| 587 | + &mcf_edma, |
| 588 | +#endif |
508 | 589 | };
|
509 | 590 |
|
510 | 591 | /*
|
|
0 commit comments