aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-06-25 06:39:20 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-06-30 09:13:49 -0400
commit832290b25e20e0c3a6da056f7d0999de51311f2c (patch)
treeb0c0f5d58697a58bf9b34992ff1b7e1ac1995fee /arch/arm
parent12a7cfef5625ef03c6fdc9bf8a9857dd30d8a11d (diff)
ARM: shmobile: sh73a0: add DMAEngine support for MPDMAC
Current shdmac can support MPDMAC (= sound DMA) on sh73a0. This support reduce CPU load when sound was playback. On v2.0 manual, MPDMAC MID/RID number were wrong. This patch is using the number which seems correct. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h7
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c111
3 files changed, 121 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 06ffa4a31c47..37ba0140b427 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -475,7 +475,7 @@ static struct clk *late_main_clks[] = {
475 475
476enum { MSTP001, 476enum { MSTP001,
477 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, 477 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
478 MSTP219, MSTP218, 478 MSTP219, MSTP218, MSTP217,
479 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 479 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
480 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322, 480 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
481 MSTP314, MSTP313, MSTP312, MSTP311, 481 MSTP314, MSTP313, MSTP312, MSTP311,
@@ -498,6 +498,7 @@ static struct clk mstp_clks[MSTP_NR] = {
498 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 498 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
499 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ 499 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
500 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */ 500 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
501 [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* MP-DMAC */
501 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ 502 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
502 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ 503 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
503 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */ 504 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
@@ -555,6 +556,7 @@ static struct clk_lookup lookups[] = {
555 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ 556 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
556 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ 557 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
557 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */ 558 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
559 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* MP-DMAC */
558 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 560 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
559 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ 561 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
560 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */ 562 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 398e2c10913b..fe950f25d793 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -516,6 +516,13 @@ enum {
516 SHDMA_SLAVE_SDHI2_RX, 516 SHDMA_SLAVE_SDHI2_RX,
517 SHDMA_SLAVE_MMCIF_TX, 517 SHDMA_SLAVE_MMCIF_TX,
518 SHDMA_SLAVE_MMCIF_RX, 518 SHDMA_SLAVE_MMCIF_RX,
519 SHDMA_SLAVE_FSI2A_TX,
520 SHDMA_SLAVE_FSI2A_RX,
521 SHDMA_SLAVE_FSI2B_TX,
522 SHDMA_SLAVE_FSI2B_RX,
523 SHDMA_SLAVE_FSI2C_TX,
524 SHDMA_SLAVE_FSI2C_RX,
525 SHDMA_SLAVE_FSI2D_RX,
519}; 526};
520 527
521/* 528/*
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 04a0dfe75493..2c7bb03a5699 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -651,6 +651,116 @@ static struct platform_device dma0_device = {
651 }, 651 },
652}; 652};
653 653
654/* MPDMAC */
655static const struct sh_dmae_slave_config sh73a0_mpdma_slaves[] = {
656 {
657 .slave_id = SHDMA_SLAVE_FSI2A_RX,
658 .addr = 0xec230020,
659 .chcr = CHCR_RX(XMIT_SZ_32BIT),
660 .mid_rid = 0xd6, /* CHECK ME */
661 }, {
662 .slave_id = SHDMA_SLAVE_FSI2A_TX,
663 .addr = 0xec230024,
664 .chcr = CHCR_TX(XMIT_SZ_32BIT),
665 .mid_rid = 0xd5, /* CHECK ME */
666 }, {
667 .slave_id = SHDMA_SLAVE_FSI2C_RX,
668 .addr = 0xec230060,
669 .chcr = CHCR_RX(XMIT_SZ_32BIT),
670 .mid_rid = 0xda, /* CHECK ME */
671 }, {
672 .slave_id = SHDMA_SLAVE_FSI2C_TX,
673 .addr = 0xec230064,
674 .chcr = CHCR_TX(XMIT_SZ_32BIT),
675 .mid_rid = 0xd9, /* CHECK ME */
676 }, {
677 .slave_id = SHDMA_SLAVE_FSI2B_RX,
678 .addr = 0xec240020,
679 .chcr = CHCR_RX(XMIT_SZ_32BIT),
680 .mid_rid = 0x8e, /* CHECK ME */
681 }, {
682 .slave_id = SHDMA_SLAVE_FSI2B_TX,
683 .addr = 0xec240024,
684 .chcr = CHCR_RX(XMIT_SZ_32BIT),
685 .mid_rid = 0x8d, /* CHECK ME */
686 }, {
687 .slave_id = SHDMA_SLAVE_FSI2D_RX,
688 .addr = 0xec240060,
689 .chcr = CHCR_RX(XMIT_SZ_32BIT),
690 .mid_rid = 0x9a, /* CHECK ME */
691 },
692};
693
694#define MPDMA_CHANNEL(a, b, c) \
695{ \
696 .offset = a, \
697 .dmars = b, \
698 .dmars_bit = c, \
699 .chclr_offset = (0x220 - 0x20) + a \
700}
701
702static const struct sh_dmae_channel sh73a0_mpdma_channels[] = {
703 MPDMA_CHANNEL(0x00, 0, 0),
704 MPDMA_CHANNEL(0x10, 0, 8),
705 MPDMA_CHANNEL(0x20, 4, 0),
706 MPDMA_CHANNEL(0x30, 4, 8),
707 MPDMA_CHANNEL(0x50, 8, 0),
708 MPDMA_CHANNEL(0x70, 8, 8),
709};
710
711static struct sh_dmae_pdata sh73a0_mpdma_platform_data = {
712 .slave = sh73a0_mpdma_slaves,
713 .slave_num = ARRAY_SIZE(sh73a0_mpdma_slaves),
714 .channel = sh73a0_mpdma_channels,
715 .channel_num = ARRAY_SIZE(sh73a0_mpdma_channels),
716 .ts_low_shift = 3,
717 .ts_low_mask = 0x18,
718 .ts_high_shift = (20 - 2), /* 2 bits for shifted low TS */
719 .ts_high_mask = 0x00300000,
720 .ts_shift = ts_shift,
721 .ts_shift_num = ARRAY_SIZE(ts_shift),
722 .dmaor_init = DMAOR_DME,
723 .chclr_present = 1,
724};
725
726/* Resource order important! */
727static struct resource sh73a0_mpdma_resources[] = {
728 {
729 /* Channel registers and DMAOR */
730 .start = 0xec618020,
731 .end = 0xec61828f,
732 .flags = IORESOURCE_MEM,
733 },
734 {
735 /* DMARSx */
736 .start = 0xec619000,
737 .end = 0xec61900b,
738 .flags = IORESOURCE_MEM,
739 },
740 {
741 .name = "error_irq",
742 .start = gic_spi(181),
743 .end = gic_spi(181),
744 .flags = IORESOURCE_IRQ,
745 },
746 {
747 /* IRQ for channels 0-5 */
748 .start = gic_spi(175),
749 .end = gic_spi(180),
750 .flags = IORESOURCE_IRQ,
751 },
752};
753
754static struct platform_device mpdma0_device = {
755 .name = "sh-dma-engine",
756 .id = 1,
757 .resource = sh73a0_mpdma_resources,
758 .num_resources = ARRAY_SIZE(sh73a0_mpdma_resources),
759 .dev = {
760 .platform_data = &sh73a0_mpdma_platform_data,
761 },
762};
763
654static struct platform_device *sh73a0_early_devices[] __initdata = { 764static struct platform_device *sh73a0_early_devices[] __initdata = {
655 &scif0_device, 765 &scif0_device,
656 &scif1_device, 766 &scif1_device,
@@ -673,6 +783,7 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
673 &i2c3_device, 783 &i2c3_device,
674 &i2c4_device, 784 &i2c4_device,
675 &dma0_device, 785 &dma0_device,
786 &mpdma0_device,
676}; 787};
677 788
678#define SRCR2 0xe61580b0 789#define SRCR2 0xe61580b0