.. | .. |
---|
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> |
---|
| 25 | +#include <linux/platform_data/mmc-esdhc-mcf.h> |
---|
22 | 26 | |
---|
23 | 27 | /* |
---|
24 | 28 | * All current ColdFire parts contain from 2, 3, 4 or 10 UARTS. |
---|
.. | .. |
---|
476 | 480 | #endif /* MCFI2C_BASE5 */ |
---|
477 | 481 | #endif /* IS_ENABLED(CONFIG_I2C_IMX) */ |
---|
478 | 482 | |
---|
| 483 | +#ifdef MCFEDMA_BASE |
---|
| 484 | + |
---|
| 485 | +static const struct dma_slave_map mcf_edma_map[] = { |
---|
| 486 | + { "dreq0", "rx-tx", MCF_EDMA_FILTER_PARAM(0) }, |
---|
| 487 | + { "dreq1", "rx-tx", MCF_EDMA_FILTER_PARAM(1) }, |
---|
| 488 | + { "uart.0", "rx", MCF_EDMA_FILTER_PARAM(2) }, |
---|
| 489 | + { "uart.0", "tx", MCF_EDMA_FILTER_PARAM(3) }, |
---|
| 490 | + { "uart.1", "rx", MCF_EDMA_FILTER_PARAM(4) }, |
---|
| 491 | + { "uart.1", "tx", MCF_EDMA_FILTER_PARAM(5) }, |
---|
| 492 | + { "uart.2", "rx", MCF_EDMA_FILTER_PARAM(6) }, |
---|
| 493 | + { "uart.2", "tx", MCF_EDMA_FILTER_PARAM(7) }, |
---|
| 494 | + { "timer0", "rx-tx", MCF_EDMA_FILTER_PARAM(8) }, |
---|
| 495 | + { "timer1", "rx-tx", MCF_EDMA_FILTER_PARAM(9) }, |
---|
| 496 | + { "timer2", "rx-tx", MCF_EDMA_FILTER_PARAM(10) }, |
---|
| 497 | + { "timer3", "rx-tx", MCF_EDMA_FILTER_PARAM(11) }, |
---|
| 498 | + { "fsl-dspi.0", "rx", MCF_EDMA_FILTER_PARAM(12) }, |
---|
| 499 | + { "fsl-dspi.0", "tx", MCF_EDMA_FILTER_PARAM(13) }, |
---|
| 500 | + { "fsl-dspi.1", "rx", MCF_EDMA_FILTER_PARAM(14) }, |
---|
| 501 | + { "fsl-dspi.1", "tx", MCF_EDMA_FILTER_PARAM(15) }, |
---|
| 502 | +}; |
---|
| 503 | + |
---|
| 504 | +static struct mcf_edma_platform_data mcf_edma_data = { |
---|
| 505 | + .dma_channels = 64, |
---|
| 506 | + .slave_map = mcf_edma_map, |
---|
| 507 | + .slavecnt = ARRAY_SIZE(mcf_edma_map), |
---|
| 508 | +}; |
---|
| 509 | + |
---|
| 510 | +static struct resource mcf_edma_resources[] = { |
---|
| 511 | + { |
---|
| 512 | + .start = MCFEDMA_BASE, |
---|
| 513 | + .end = MCFEDMA_BASE + MCFEDMA_SIZE - 1, |
---|
| 514 | + .flags = IORESOURCE_MEM, |
---|
| 515 | + }, |
---|
| 516 | + { |
---|
| 517 | + .start = MCFEDMA_IRQ_INTR0, |
---|
| 518 | + .end = MCFEDMA_IRQ_INTR0 + 15, |
---|
| 519 | + .flags = IORESOURCE_IRQ, |
---|
| 520 | + .name = "edma-tx-00-15", |
---|
| 521 | + }, |
---|
| 522 | + { |
---|
| 523 | + .start = MCFEDMA_IRQ_INTR16, |
---|
| 524 | + .end = MCFEDMA_IRQ_INTR16 + 39, |
---|
| 525 | + .flags = IORESOURCE_IRQ, |
---|
| 526 | + .name = "edma-tx-16-55", |
---|
| 527 | + }, |
---|
| 528 | + { |
---|
| 529 | + .start = MCFEDMA_IRQ_INTR56, |
---|
| 530 | + .end = MCFEDMA_IRQ_INTR56, |
---|
| 531 | + .flags = IORESOURCE_IRQ, |
---|
| 532 | + .name = "edma-tx-56-63", |
---|
| 533 | + }, |
---|
| 534 | + { |
---|
| 535 | + .start = MCFEDMA_IRQ_ERR, |
---|
| 536 | + .end = MCFEDMA_IRQ_ERR, |
---|
| 537 | + .flags = IORESOURCE_IRQ, |
---|
| 538 | + .name = "edma-err", |
---|
| 539 | + }, |
---|
| 540 | +}; |
---|
| 541 | + |
---|
| 542 | +static u64 mcf_edma_dmamask = DMA_BIT_MASK(32); |
---|
| 543 | + |
---|
| 544 | +static struct platform_device mcf_edma = { |
---|
| 545 | + .name = "mcf-edma", |
---|
| 546 | + .id = 0, |
---|
| 547 | + .num_resources = ARRAY_SIZE(mcf_edma_resources), |
---|
| 548 | + .resource = mcf_edma_resources, |
---|
| 549 | + .dev = { |
---|
| 550 | + .dma_mask = &mcf_edma_dmamask, |
---|
| 551 | + .coherent_dma_mask = DMA_BIT_MASK(32), |
---|
| 552 | + .platform_data = &mcf_edma_data, |
---|
| 553 | + } |
---|
| 554 | +}; |
---|
| 555 | +#endif /* MCFEDMA_BASE */ |
---|
| 556 | + |
---|
| 557 | +#ifdef MCFSDHC_BASE |
---|
| 558 | +static struct mcf_esdhc_platform_data mcf_esdhc_data = { |
---|
| 559 | + .max_bus_width = 4, |
---|
| 560 | + .cd_type = ESDHC_CD_NONE, |
---|
| 561 | +}; |
---|
| 562 | + |
---|
| 563 | +static struct resource mcf_esdhc_resources[] = { |
---|
| 564 | + { |
---|
| 565 | + .start = MCFSDHC_BASE, |
---|
| 566 | + .end = MCFSDHC_BASE + MCFSDHC_SIZE - 1, |
---|
| 567 | + .flags = IORESOURCE_MEM, |
---|
| 568 | + }, { |
---|
| 569 | + .start = MCF_IRQ_SDHC, |
---|
| 570 | + .end = MCF_IRQ_SDHC, |
---|
| 571 | + .flags = IORESOURCE_IRQ, |
---|
| 572 | + }, |
---|
| 573 | +}; |
---|
| 574 | + |
---|
| 575 | +static struct platform_device mcf_esdhc = { |
---|
| 576 | + .name = "sdhci-esdhc-mcf", |
---|
| 577 | + .id = 0, |
---|
| 578 | + .num_resources = ARRAY_SIZE(mcf_esdhc_resources), |
---|
| 579 | + .resource = mcf_esdhc_resources, |
---|
| 580 | + .dev.platform_data = &mcf_esdhc_data, |
---|
| 581 | +}; |
---|
| 582 | +#endif /* MCFSDHC_BASE */ |
---|
| 583 | + |
---|
479 | 584 | static struct platform_device *mcf_devices[] __initdata = { |
---|
480 | 585 | &mcf_uart, |
---|
481 | 586 | #if IS_ENABLED(CONFIG_FEC) |
---|
.. | .. |
---|
505 | 610 | &mcf_i2c5, |
---|
506 | 611 | #endif |
---|
507 | 612 | #endif |
---|
| 613 | +#ifdef MCFEDMA_BASE |
---|
| 614 | + &mcf_edma, |
---|
| 615 | +#endif |
---|
| 616 | +#ifdef MCFSDHC_BASE |
---|
| 617 | + &mcf_esdhc, |
---|
| 618 | +#endif |
---|
508 | 619 | }; |
---|
509 | 620 | |
---|
510 | 621 | /* |
---|
.. | .. |
---|
533 | 644 | } |
---|
534 | 645 | |
---|
535 | 646 | arch_initcall(mcf_init_devices); |
---|
536 | | - |
---|