aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2015-04-20 14:51:14 -0400
committerVinod Koul <vinod.koul@intel.com>2015-04-20 14:51:14 -0400
commitb53c7582805b10d6a32e88e22d16dc469e66a37a (patch)
tree3775742e873f18d005fd8c2187411ead06c0049d
parent7d3beab16dd9eee86bb1a4dd05b51159fc7772f0 (diff)
parent3cd44dcd35a6618df88c51561290dc02fb35b8e2 (diff)
Merge branch 'topic/sh' into for-linus
-rw-r--r--Documentation/devicetree/bindings/dma/rcar-audmapp.txt29
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c12
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c20
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c14
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c20
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c30
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c10
-rw-r--r--arch/sh/boards/board-sh7757lcr.c9
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c9
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c20
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c10
-rw-r--r--arch/sh/boards/mach-migor/setup.c9
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c17
-rw-r--r--drivers/dma/sh/Kconfig6
-rw-r--r--drivers/dma/sh/Makefile1
-rw-r--r--drivers/dma/sh/rcar-audmapp.c376
-rw-r--r--drivers/dma/sh/shdma-base.c73
-rw-r--r--drivers/mmc/host/sh_mmcif.c13
-rw-r--r--drivers/mmc/host/sh_mobile_sdhi.c26
-rw-r--r--drivers/mmc/host/tmio_mmc.h4
-rw-r--r--drivers/mmc/host/tmio_mmc_dma.c10
-rw-r--r--drivers/mtd/nand/sh_flctl.c2
-rw-r--r--drivers/spi/spi-rspi.c1
-rw-r--r--drivers/spi/spi-sh-msiof.c1
-rw-r--r--include/linux/mfd/tmio.h2
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h10
-rw-r--r--include/linux/shdma-base.h1
-rw-r--r--sound/soc/sh/fsi.c18
28 files changed, 174 insertions, 579 deletions
diff --git a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt b/Documentation/devicetree/bindings/dma/rcar-audmapp.txt
deleted file mode 100644
index 61bca509d7b9..000000000000
--- a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt
+++ /dev/null
@@ -1,29 +0,0 @@
1* R-Car Audio DMAC peri peri Device Tree bindings
2
3Required properties:
4- compatible: should be "renesas,rcar-audmapp"
5- #dma-cells: should be <1>, see "dmas" property below
6
7Example:
8 audmapp: audio-dma-pp@0xec740000 {
9 compatible = "renesas,rcar-audmapp";
10 #dma-cells = <1>;
11
12 reg = <0 0xec740000 0 0x200>;
13 };
14
15
16* DMA client
17
18Required properties:
19- dmas: a list of <[DMA multiplexer phandle] [SRS << 8 | DRS]> pairs.
20 where SRS/DRS are specified in the SoC manual.
21 It will be written into PDMACHCR as high 16-bit parts.
22- dma-names: a list of DMA channel names, one per "dmas" entry
23
24Example:
25
26 dmas = <&audmapp 0x2d00
27 &audmapp 0x3700>;
28 dma-names = "src0_ssiu0",
29 "dvc0_ssiu0";
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 444f22d370f0..52c9605ad611 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -173,9 +173,9 @@ static const struct resource mmcif0_resources[] __initconst = {
173}; 173};
174 174
175/* SDHI0 */ 175/* SDHI0 */
176static const struct sh_mobile_sdhi_info sdhi0_pdata __initconst = { 176static const struct tmio_mmc_data sdhi0_pdata __initconst = {
177 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, 177 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
178 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 178 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
179}; 179};
180 180
181static const struct resource sdhi0_resources[] __initconst = { 181static const struct resource sdhi0_resources[] __initconst = {
@@ -184,9 +184,9 @@ static const struct resource sdhi0_resources[] __initconst = {
184}; 184};
185 185
186/* SDHI1 */ 186/* SDHI1 */
187static const struct sh_mobile_sdhi_info sdhi1_pdata __initconst = { 187static const struct tmio_mmc_data sdhi1_pdata __initconst = {
188 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, 188 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
189 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 189 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
190 MMC_CAP_NEEDS_POLL, 190 MMC_CAP_NEEDS_POLL,
191}; 191};
192 192
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 6d949f1c850b..7eac84687cb4 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -754,12 +754,12 @@ static struct platform_device vcc_sdhi1 = {
754}; 754};
755 755
756/* SDHI0 */ 756/* SDHI0 */
757static struct sh_mobile_sdhi_info sdhi0_info = { 757static struct tmio_mmc_data sdhi0_info = {
758 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 758 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
759 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 759 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
760 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 760 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
761 MMC_CAP_POWER_OFF_CARD, 761 MMC_CAP_POWER_OFF_CARD,
762 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 762 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
763 .cd_gpio = 167, 763 .cd_gpio = 167,
764}; 764};
765 765
@@ -796,12 +796,12 @@ static struct platform_device sdhi0_device = {
796}; 796};
797 797
798/* SDHI1 */ 798/* SDHI1 */
799static struct sh_mobile_sdhi_info sdhi1_info = { 799static struct tmio_mmc_data sdhi1_info = {
800 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 800 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
801 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 801 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
802 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 802 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
803 MMC_CAP_POWER_OFF_CARD, 803 MMC_CAP_POWER_OFF_CARD,
804 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 804 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
805 /* Port72 cannot generate IRQs, will be used in polling mode. */ 805 /* Port72 cannot generate IRQs, will be used in polling mode. */
806 .cd_gpio = 72, 806 .cd_gpio = 72,
807}; 807};
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index f27b5a833bf0..25558d1f417f 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -201,12 +201,12 @@ static struct rcar_phy_platform_data usb_phy_platform_data __initdata =
201 201
202 202
203/* SDHI */ 203/* SDHI */
204static struct sh_mobile_sdhi_info sdhi0_info __initdata = { 204static struct tmio_mmc_data sdhi0_info __initdata = {
205 .dma_slave_tx = HPBDMA_SLAVE_SDHI0_TX, 205 .chan_priv_tx = (void *)HPBDMA_SLAVE_SDHI0_TX,
206 .dma_slave_rx = HPBDMA_SLAVE_SDHI0_RX, 206 .chan_priv_rx = (void *)HPBDMA_SLAVE_SDHI0_RX,
207 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 207 .capabilities = MMC_CAP_SD_HIGHSPEED,
208 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 208 .ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
209 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 209 .flags = TMIO_MMC_HAS_IDLE_WAIT,
210}; 210};
211 211
212static struct resource sdhi0_resources[] __initdata = { 212static struct resource sdhi0_resources[] __initdata = {
@@ -683,7 +683,7 @@ static void __init bockw_init(void)
683 platform_device_register_resndata( 683 platform_device_register_resndata(
684 NULL, "sh_mobile_sdhi", 0, 684 NULL, "sh_mobile_sdhi", 0,
685 sdhi0_resources, ARRAY_SIZE(sdhi0_resources), 685 sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
686 &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); 686 &sdhi0_info, sizeof(struct tmio_mmc_data));
687 } 687 }
688 688
689 /* for Audio */ 689 /* for Audio */
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 7c9b63bdde9f..260d8319fd82 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -442,11 +442,11 @@ static struct platform_device vcc_sdhi2 = {
442}; 442};
443 443
444/* SDHI */ 444/* SDHI */
445static struct sh_mobile_sdhi_info sdhi0_info = { 445static struct tmio_mmc_data sdhi0_info = {
446 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 446 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
447 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 447 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
448 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 448 .flags = TMIO_MMC_HAS_IDLE_WAIT,
449 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 449 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
450 MMC_CAP_POWER_OFF_CARD, 450 MMC_CAP_POWER_OFF_CARD,
451}; 451};
452 452
@@ -484,13 +484,13 @@ static struct platform_device sdhi0_device = {
484}; 484};
485 485
486/* Micro SD */ 486/* Micro SD */
487static struct sh_mobile_sdhi_info sdhi2_info = { 487static struct tmio_mmc_data sdhi2_info = {
488 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, 488 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI2_TX,
489 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, 489 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI2_RX,
490 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | 490 .flags = TMIO_MMC_HAS_IDLE_WAIT |
491 TMIO_MMC_USE_GPIO_CD | 491 TMIO_MMC_USE_GPIO_CD |
492 TMIO_MMC_WRPROTECT_DISABLE, 492 TMIO_MMC_WRPROTECT_DISABLE,
493 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD, 493 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
494 .cd_gpio = 13, 494 .cd_gpio = 13,
495}; 495};
496 496
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index a1c1dfb6a67a..88e4f457193b 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -972,11 +972,11 @@ static struct platform_device nand_flash_device = {
972}; 972};
973 973
974/* SDHI0 */ 974/* SDHI0 */
975static struct sh_mobile_sdhi_info sdhi0_info = { 975static struct tmio_mmc_data sdhi0_info = {
976 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 976 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
977 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 977 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
978 .tmio_flags = TMIO_MMC_USE_GPIO_CD, 978 .flags = TMIO_MMC_USE_GPIO_CD,
979 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 979 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
980 .cd_gpio = 172, 980 .cd_gpio = 172,
981}; 981};
982 982
@@ -1011,11 +1011,11 @@ static struct platform_device sdhi0_device = {
1011/* SDHI1 */ 1011/* SDHI1 */
1012 1012
1013/* GPIO 41 can trigger IRQ8, but it is used by USBHS1, we have to poll */ 1013/* GPIO 41 can trigger IRQ8, but it is used by USBHS1, we have to poll */
1014static struct sh_mobile_sdhi_info sdhi1_info = { 1014static struct tmio_mmc_data sdhi1_info = {
1015 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 1015 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
1016 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 1016 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
1017 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, 1017 .flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD,
1018 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 1018 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
1019 MMC_CAP_NEEDS_POLL, 1019 MMC_CAP_NEEDS_POLL,
1020 .cd_gpio = 41, 1020 .cd_gpio = 41,
1021}; 1021};
@@ -1054,11 +1054,11 @@ static struct platform_device sdhi1_device = {
1054 * The card detect pin of the top SD/MMC slot (CN23) is active low and is 1054 * The card detect pin of the top SD/MMC slot (CN23) is active low and is
1055 * connected to GPIO SCIFB_SCK of SH7372 (GPIO 162). 1055 * connected to GPIO SCIFB_SCK of SH7372 (GPIO 162).
1056 */ 1056 */
1057static struct sh_mobile_sdhi_info sdhi2_info = { 1057static struct tmio_mmc_data sdhi2_info = {
1058 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, 1058 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI2_TX,
1059 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, 1059 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI2_RX,
1060 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, 1060 .flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD,
1061 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 1061 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
1062 MMC_CAP_NEEDS_POLL, 1062 MMC_CAP_NEEDS_POLL,
1063 .cd_gpio = 162, 1063 .cd_gpio = 162,
1064}; 1064};
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index 598f704f76ae..51db288f192a 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -122,11 +122,11 @@ static struct resource sdhi0_resources[] = {
122 }, 122 },
123}; 123};
124 124
125static struct sh_mobile_sdhi_info sdhi0_platform_data = { 125static struct tmio_mmc_data sdhi0_platform_data = {
126 .dma_slave_tx = HPBDMA_SLAVE_SDHI0_TX, 126 .chan_priv_tx = (void *)HPBDMA_SLAVE_SDHI0_TX,
127 .dma_slave_rx = HPBDMA_SLAVE_SDHI0_RX, 127 .chan_priv_rx = (void *)HPBDMA_SLAVE_SDHI0_RX,
128 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, 128 .flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
129 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 129 .capabilities = MMC_CAP_SD_HIGHSPEED,
130}; 130};
131 131
132static struct platform_device sdhi0_device = { 132static struct platform_device sdhi0_device = {
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index 669df51a82e3..324599bfad14 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -17,6 +17,7 @@
17#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
18#include <linux/spi/flash.h> 18#include <linux/spi/flash.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/mfd/tmio.h>
20#include <linux/mmc/host.h> 21#include <linux/mmc/host.h>
21#include <linux/mmc/sh_mmcif.h> 22#include <linux/mmc/sh_mmcif.h>
22#include <linux/mmc/sh_mobile_sdhi.h> 23#include <linux/mmc/sh_mobile_sdhi.h>
@@ -243,10 +244,10 @@ static struct platform_device sh_mmcif_device = {
243}; 244};
244 245
245/* SDHI0 */ 246/* SDHI0 */
246static struct sh_mobile_sdhi_info sdhi_info = { 247static struct tmio_mmc_data sdhi_info = {
247 .dma_slave_tx = SHDMA_SLAVE_SDHI_TX, 248 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI_TX,
248 .dma_slave_rx = SHDMA_SLAVE_SDHI_RX, 249 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI_RX,
249 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 250 .capabilities = MMC_CAP_SD_HIGHSPEED,
250}; 251};
251 252
252static struct resource sdhi_resources[] = { 253static struct resource sdhi_resources[] = {
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index d4b01d4cc102..cbd2a9f02a91 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -18,6 +18,7 @@
18#include <linux/mmc/sh_mobile_sdhi.h> 18#include <linux/mmc/sh_mobile_sdhi.h>
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/mtd/sh_flctl.h> 20#include <linux/mtd/sh_flctl.h>
21#include <linux/mfd/tmio.h>
21#include <linux/delay.h> 22#include <linux/delay.h>
22#include <linux/i2c.h> 23#include <linux/i2c.h>
23#include <linux/regulator/fixed.h> 24#include <linux/regulator/fixed.h>
@@ -447,8 +448,8 @@ static struct resource sdhi0_cn3_resources[] = {
447 }, 448 },
448}; 449};
449 450
450static struct sh_mobile_sdhi_info sdhi0_cn3_data = { 451static struct tmio_mmc_data sdhi0_cn3_data = {
451 .tmio_caps = MMC_CAP_SDIO_IRQ, 452 .capabilities = MMC_CAP_SDIO_IRQ,
452}; 453};
453 454
454static struct platform_device sdhi0_cn3_device = { 455static struct platform_device sdhi0_cn3_device = {
@@ -474,8 +475,8 @@ static struct resource sdhi1_cn7_resources[] = {
474 }, 475 },
475}; 476};
476 477
477static struct sh_mobile_sdhi_info sdhi1_cn7_data = { 478static struct tmio_mmc_data sdhi1_cn7_data = {
478 .tmio_caps = MMC_CAP_SDIO_IRQ, 479 .capabilities = MMC_CAP_SDIO_IRQ,
479}; 480};
480 481
481static struct platform_device sdhi1_cn7_device = { 482static struct platform_device sdhi1_cn7_device = {
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 0d3049244cd3..d531791f06ff 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -601,12 +601,12 @@ static struct platform_device sdhi0_power = {
601 }, 601 },
602}; 602};
603 603
604static struct sh_mobile_sdhi_info sdhi0_info = { 604static struct tmio_mmc_data sdhi0_info = {
605 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 605 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
606 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 606 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
607 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 607 .capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
608 MMC_CAP_NEEDS_POLL, 608 MMC_CAP_NEEDS_POLL,
609 .tmio_flags = TMIO_MMC_USE_GPIO_CD, 609 .flags = TMIO_MMC_USE_GPIO_CD,
610 .cd_gpio = GPIO_PTY7, 610 .cd_gpio = GPIO_PTY7,
611}; 611};
612 612
@@ -635,12 +635,12 @@ static struct platform_device sdhi0_device = {
635 635
636#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 636#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
637/* SDHI1 */ 637/* SDHI1 */
638static struct sh_mobile_sdhi_info sdhi1_info = { 638static struct tmio_mmc_data sdhi1_info = {
639 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 639 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
640 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 640 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
641 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 641 .capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
642 MMC_CAP_NEEDS_POLL, 642 MMC_CAP_NEEDS_POLL,
643 .tmio_flags = TMIO_MMC_USE_GPIO_CD, 643 .flags = TMIO_MMC_USE_GPIO_CD,
644 .cd_gpio = GPIO_PTW7, 644 .cd_gpio = GPIO_PTW7,
645}; 645};
646 646
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 1df4398f8375..7d997cec09c5 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -373,11 +373,11 @@ static struct resource kfr2r09_sh_sdhi0_resources[] = {
373 }, 373 },
374}; 374};
375 375
376static struct sh_mobile_sdhi_info sh7724_sdhi0_data = { 376static struct tmio_mmc_data sh7724_sdhi0_data = {
377 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 377 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
378 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 378 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
379 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, 379 .flags = TMIO_MMC_WRPROTECT_DISABLE,
380 .tmio_caps = MMC_CAP_SDIO_IRQ, 380 .capabilities = MMC_CAP_SDIO_IRQ,
381}; 381};
382 382
383static struct platform_device kfr2r09_sh_sdhi0_device = { 383static struct platform_device kfr2r09_sh_sdhi0_device = {
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 8b73194ed2ce..29b7c0dcfc51 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -15,6 +15,7 @@
15#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
16#include <linux/mmc/sh_mobile_sdhi.h> 16#include <linux/mmc/sh_mobile_sdhi.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/mfd/tmio.h>
18#include <linux/mtd/nand.h> 19#include <linux/mtd/nand.h>
19#include <linux/i2c.h> 20#include <linux/i2c.h>
20#include <linux/regulator/fixed.h> 21#include <linux/regulator/fixed.h>
@@ -408,10 +409,10 @@ static struct resource sdhi_cn9_resources[] = {
408 }, 409 },
409}; 410};
410 411
411static struct sh_mobile_sdhi_info sh7724_sdhi_data = { 412static struct tmio_mmc_data sh7724_sdhi_data = {
412 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 413 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
413 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 414 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
414 .tmio_caps = MMC_CAP_SDIO_IRQ, 415 .capabilities = MMC_CAP_SDIO_IRQ,
415}; 416};
416 417
417static struct platform_device sdhi_cn9_device = { 418static struct platform_device sdhi_cn9_device = {
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 1162bc6945a3..4f6635a075f2 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mmc/host.h> 17#include <linux/mmc/host.h>
18#include <linux/mmc/sh_mobile_sdhi.h> 18#include <linux/mmc/sh_mobile_sdhi.h>
19#include <linux/mfd/tmio.h>
19#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
@@ -468,10 +469,10 @@ static struct resource sdhi0_cn7_resources[] = {
468 }, 469 },
469}; 470};
470 471
471static struct sh_mobile_sdhi_info sh7724_sdhi0_data = { 472static struct tmio_mmc_data sh7724_sdhi0_data = {
472 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 473 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
473 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 474 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
474 .tmio_caps = MMC_CAP_SDIO_IRQ, 475 .capabilities = MMC_CAP_SDIO_IRQ,
475}; 476};
476 477
477static struct platform_device sdhi0_cn7_device = { 478static struct platform_device sdhi0_cn7_device = {
@@ -497,10 +498,10 @@ static struct resource sdhi1_cn8_resources[] = {
497 }, 498 },
498}; 499};
499 500
500static struct sh_mobile_sdhi_info sh7724_sdhi1_data = { 501static struct tmio_mmc_data sh7724_sdhi1_data = {
501 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 502 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
502 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 503 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
503 .tmio_caps = MMC_CAP_SDIO_IRQ, 504 .capabilities = MMC_CAP_SDIO_IRQ,
504}; 505};
505 506
506static struct platform_device sdhi1_cn8_device = { 507static struct platform_device sdhi1_cn8_device = {
diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
index f6ca002cb7c5..0f371524a4d9 100644
--- a/drivers/dma/sh/Kconfig
+++ b/drivers/dma/sh/Kconfig
@@ -51,12 +51,6 @@ config RCAR_HPB_DMAE
51 help 51 help
52 Enable support for the Renesas R-Car series DMA controllers. 52 Enable support for the Renesas R-Car series DMA controllers.
53 53
54config RCAR_AUDMAC_PP
55 tristate "Renesas R-Car Audio DMAC Peripheral Peripheral support"
56 depends on SH_DMAE_BASE
57 help
58 Enable support for the Renesas R-Car Audio DMAC Peripheral Peripheral controllers.
59
60config RCAR_DMAC 54config RCAR_DMAC
61 tristate "Renesas R-Car Gen2 DMA Controller" 55 tristate "Renesas R-Car Gen2 DMA Controller"
62 depends on ARCH_SHMOBILE || COMPILE_TEST 56 depends on ARCH_SHMOBILE || COMPILE_TEST
diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
index 221ab19b8f77..b8a598066ce2 100644
--- a/drivers/dma/sh/Makefile
+++ b/drivers/dma/sh/Makefile
@@ -15,6 +15,5 @@ obj-$(CONFIG_SH_DMAE) += shdma.o
15 15
16obj-$(CONFIG_SUDMAC) += sudmac.o 16obj-$(CONFIG_SUDMAC) += sudmac.o
17obj-$(CONFIG_RCAR_HPB_DMAE) += rcar-hpbdma.o 17obj-$(CONFIG_RCAR_HPB_DMAE) += rcar-hpbdma.o
18obj-$(CONFIG_RCAR_AUDMAC_PP) += rcar-audmapp.o
19obj-$(CONFIG_RCAR_DMAC) += rcar-dmac.o 18obj-$(CONFIG_RCAR_DMAC) += rcar-dmac.o
20obj-$(CONFIG_RENESAS_USB_DMAC) += usb-dmac.o 19obj-$(CONFIG_RENESAS_USB_DMAC) += usb-dmac.o
diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c
deleted file mode 100644
index d95bbdd721f4..000000000000
--- a/drivers/dma/sh/rcar-audmapp.c
+++ /dev/null
@@ -1,376 +0,0 @@
1/*
2 * This is for Renesas R-Car Audio-DMAC-peri-peri.
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * based on the drivers/dma/sh/shdma.c
8 *
9 * Copyright (C) 2011-2012 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
10 * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
11 * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved.
12 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
13 *
14 * This is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 */
20#include <linux/delay.h>
21#include <linux/init.h>
22#include <linux/module.h>
23#include <linux/slab.h>
24#include <linux/dmaengine.h>
25#include <linux/of_dma.h>
26#include <linux/platform_data/dma-rcar-audmapp.h>
27#include <linux/platform_device.h>
28#include <linux/shdma-base.h>
29
30/*
31 * DMA register
32 */
33#define PDMASAR 0x00
34#define PDMADAR 0x04
35#define PDMACHCR 0x0c
36
37/* PDMACHCR */
38#define PDMACHCR_DE (1 << 0)
39
40#define AUDMAPP_MAX_CHANNELS 29
41
42/* Default MEMCPY transfer size = 2^2 = 4 bytes */
43#define LOG2_DEFAULT_XFER_SIZE 2
44#define AUDMAPP_SLAVE_NUMBER 256
45#define AUDMAPP_LEN_MAX (16 * 1024 * 1024)
46
47struct audmapp_chan {
48 struct shdma_chan shdma_chan;
49 void __iomem *base;
50 dma_addr_t slave_addr;
51 u32 chcr;
52};
53
54struct audmapp_device {
55 struct shdma_dev shdma_dev;
56 struct audmapp_pdata *pdata;
57 struct device *dev;
58 void __iomem *chan_reg;
59};
60
61struct audmapp_desc {
62 struct shdma_desc shdma_desc;
63 dma_addr_t src;
64 dma_addr_t dst;
65};
66
67#define to_shdma_chan(c) container_of(c, struct shdma_chan, dma_chan)
68
69#define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan)
70#define to_desc(sdesc) container_of(sdesc, struct audmapp_desc, shdma_desc)
71#define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \
72 struct audmapp_device, shdma_dev.dma_dev)
73
74static void audmapp_write(struct audmapp_chan *auchan, u32 data, u32 reg)
75{
76 struct audmapp_device *audev = to_dev(auchan);
77 struct device *dev = audev->dev;
78
79 dev_dbg(dev, "w %p : %08x\n", auchan->base + reg, data);
80
81 iowrite32(data, auchan->base + reg);
82}
83
84static u32 audmapp_read(struct audmapp_chan *auchan, u32 reg)
85{
86 return ioread32(auchan->base + reg);
87}
88
89static void audmapp_halt(struct shdma_chan *schan)
90{
91 struct audmapp_chan *auchan = to_chan(schan);
92 int i;
93
94 audmapp_write(auchan, 0, PDMACHCR);
95
96 for (i = 0; i < 1024; i++) {
97 if (0 == audmapp_read(auchan, PDMACHCR))
98 return;
99 udelay(1);
100 }
101}
102
103static void audmapp_start_xfer(struct shdma_chan *schan,
104 struct shdma_desc *sdesc)
105{
106 struct audmapp_chan *auchan = to_chan(schan);
107 struct audmapp_device *audev = to_dev(auchan);
108 struct audmapp_desc *desc = to_desc(sdesc);
109 struct device *dev = audev->dev;
110 u32 chcr = auchan->chcr | PDMACHCR_DE;
111
112 dev_dbg(dev, "src/dst/chcr = %pad/%pad/%08x\n",
113 &desc->src, &desc->dst, chcr);
114
115 audmapp_write(auchan, desc->src, PDMASAR);
116 audmapp_write(auchan, desc->dst, PDMADAR);
117 audmapp_write(auchan, chcr, PDMACHCR);
118}
119
120static int audmapp_get_config(struct audmapp_chan *auchan, int slave_id,
121 u32 *chcr, dma_addr_t *dst)
122{
123 struct audmapp_device *audev = to_dev(auchan);
124 struct audmapp_pdata *pdata = audev->pdata;
125 struct audmapp_slave_config *cfg;
126 int i;
127
128 *chcr = 0;
129 *dst = 0;
130
131 if (!pdata) { /* DT */
132 *chcr = ((u32)slave_id) << 16;
133 auchan->shdma_chan.slave_id = (slave_id) >> 8;
134 return 0;
135 }
136
137 /* non-DT */
138
139 if (slave_id >= AUDMAPP_SLAVE_NUMBER)
140 return -ENXIO;
141
142 for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++)
143 if (cfg->slave_id == slave_id) {
144 *chcr = cfg->chcr;
145 *dst = cfg->dst;
146 return 0;
147 }
148
149 return -ENXIO;
150}
151
152static int audmapp_set_slave(struct shdma_chan *schan, int slave_id,
153 dma_addr_t slave_addr, bool try)
154{
155 struct audmapp_chan *auchan = to_chan(schan);
156 u32 chcr;
157 dma_addr_t dst;
158 int ret;
159
160 ret = audmapp_get_config(auchan, slave_id, &chcr, &dst);
161 if (ret < 0)
162 return ret;
163
164 if (try)
165 return 0;
166
167 auchan->chcr = chcr;
168 auchan->slave_addr = slave_addr ? : dst;
169
170 return 0;
171}
172
173static int audmapp_desc_setup(struct shdma_chan *schan,
174 struct shdma_desc *sdesc,
175 dma_addr_t src, dma_addr_t dst, size_t *len)
176{
177 struct audmapp_desc *desc = to_desc(sdesc);
178
179 if (*len > (size_t)AUDMAPP_LEN_MAX)
180 *len = (size_t)AUDMAPP_LEN_MAX;
181
182 desc->src = src;
183 desc->dst = dst;
184
185 return 0;
186}
187
188static void audmapp_setup_xfer(struct shdma_chan *schan,
189 int slave_id)
190{
191}
192
193static dma_addr_t audmapp_slave_addr(struct shdma_chan *schan)
194{
195 struct audmapp_chan *auchan = to_chan(schan);
196
197 return auchan->slave_addr;
198}
199
200static bool audmapp_channel_busy(struct shdma_chan *schan)
201{
202 struct audmapp_chan *auchan = to_chan(schan);
203 u32 chcr = audmapp_read(auchan, PDMACHCR);
204
205 return chcr & ~PDMACHCR_DE;
206}
207
208static bool audmapp_desc_completed(struct shdma_chan *schan,
209 struct shdma_desc *sdesc)
210{
211 return true;
212}
213
214static struct shdma_desc *audmapp_embedded_desc(void *buf, int i)
215{
216 return &((struct audmapp_desc *)buf)[i].shdma_desc;
217}
218
219static const struct shdma_ops audmapp_shdma_ops = {
220 .halt_channel = audmapp_halt,
221 .desc_setup = audmapp_desc_setup,
222 .set_slave = audmapp_set_slave,
223 .start_xfer = audmapp_start_xfer,
224 .embedded_desc = audmapp_embedded_desc,
225 .setup_xfer = audmapp_setup_xfer,
226 .slave_addr = audmapp_slave_addr,
227 .channel_busy = audmapp_channel_busy,
228 .desc_completed = audmapp_desc_completed,
229};
230
231static int audmapp_chan_probe(struct platform_device *pdev,
232 struct audmapp_device *audev, int id)
233{
234 struct shdma_dev *sdev = &audev->shdma_dev;
235 struct audmapp_chan *auchan;
236 struct shdma_chan *schan;
237 struct device *dev = audev->dev;
238
239 auchan = devm_kzalloc(dev, sizeof(*auchan), GFP_KERNEL);
240 if (!auchan)
241 return -ENOMEM;
242
243 schan = &auchan->shdma_chan;
244 schan->max_xfer_len = AUDMAPP_LEN_MAX;
245
246 shdma_chan_probe(sdev, schan, id);
247
248 auchan->base = audev->chan_reg + 0x20 + (0x10 * id);
249 dev_dbg(dev, "%02d : %p / %p", id, auchan->base, audev->chan_reg);
250
251 return 0;
252}
253
254static void audmapp_chan_remove(struct audmapp_device *audev)
255{
256 struct shdma_chan *schan;
257 int i;
258
259 shdma_for_each_chan(schan, &audev->shdma_dev, i) {
260 BUG_ON(!schan);
261 shdma_chan_remove(schan);
262 }
263}
264
265static struct dma_chan *audmapp_of_xlate(struct of_phandle_args *dma_spec,
266 struct of_dma *ofdma)
267{
268 dma_cap_mask_t mask;
269 struct dma_chan *chan;
270 u32 chcr = dma_spec->args[0];
271
272 if (dma_spec->args_count != 1)
273 return NULL;
274
275 dma_cap_zero(mask);
276 dma_cap_set(DMA_SLAVE, mask);
277
278 chan = dma_request_channel(mask, shdma_chan_filter, NULL);
279 if (chan)
280 to_shdma_chan(chan)->hw_req = chcr;
281
282 return chan;
283}
284
285static int audmapp_probe(struct platform_device *pdev)
286{
287 struct audmapp_pdata *pdata = pdev->dev.platform_data;
288 struct device_node *np = pdev->dev.of_node;
289 struct audmapp_device *audev;
290 struct shdma_dev *sdev;
291 struct dma_device *dma_dev;
292 struct resource *res;
293 int err, i;
294
295 if (np)
296 of_dma_controller_register(np, audmapp_of_xlate, pdev);
297 else if (!pdata)
298 return -ENODEV;
299
300 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
301
302 audev = devm_kzalloc(&pdev->dev, sizeof(*audev), GFP_KERNEL);
303 if (!audev)
304 return -ENOMEM;
305
306 audev->dev = &pdev->dev;
307 audev->pdata = pdata;
308 audev->chan_reg = devm_ioremap_resource(&pdev->dev, res);
309 if (IS_ERR(audev->chan_reg))
310 return PTR_ERR(audev->chan_reg);
311
312 sdev = &audev->shdma_dev;
313 sdev->ops = &audmapp_shdma_ops;
314 sdev->desc_size = sizeof(struct audmapp_desc);
315
316 dma_dev = &sdev->dma_dev;
317 dma_dev->copy_align = LOG2_DEFAULT_XFER_SIZE;
318 dma_cap_set(DMA_SLAVE, dma_dev->cap_mask);
319
320 err = shdma_init(&pdev->dev, sdev, AUDMAPP_MAX_CHANNELS);
321 if (err < 0)
322 return err;
323
324 platform_set_drvdata(pdev, audev);
325
326 /* Create DMA Channel */
327 for (i = 0; i < AUDMAPP_MAX_CHANNELS; i++) {
328 err = audmapp_chan_probe(pdev, audev, i);
329 if (err)
330 goto chan_probe_err;
331 }
332
333 err = dma_async_device_register(dma_dev);
334 if (err < 0)
335 goto chan_probe_err;
336
337 return err;
338
339chan_probe_err:
340 audmapp_chan_remove(audev);
341 shdma_cleanup(sdev);
342
343 return err;
344}
345
346static int audmapp_remove(struct platform_device *pdev)
347{
348 struct audmapp_device *audev = platform_get_drvdata(pdev);
349 struct dma_device *dma_dev = &audev->shdma_dev.dma_dev;
350
351 dma_async_device_unregister(dma_dev);
352
353 audmapp_chan_remove(audev);
354 shdma_cleanup(&audev->shdma_dev);
355
356 return 0;
357}
358
359static const struct of_device_id audmapp_of_match[] = {
360 { .compatible = "renesas,rcar-audmapp", },
361 {},
362};
363
364static struct platform_driver audmapp_driver = {
365 .probe = audmapp_probe,
366 .remove = audmapp_remove,
367 .driver = {
368 .name = "rcar-audmapp-engine",
369 .of_match_table = audmapp_of_match,
370 },
371};
372module_platform_driver(audmapp_driver);
373
374MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
375MODULE_DESCRIPTION("Renesas R-Car Audio DMAC peri-peri driver");
376MODULE_LICENSE("GPL");
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 8ee383d339a5..10fcabad80f3 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -171,8 +171,7 @@ static struct shdma_desc *shdma_get_desc(struct shdma_chan *schan)
171 return NULL; 171 return NULL;
172} 172}
173 173
174static int shdma_setup_slave(struct shdma_chan *schan, int slave_id, 174static int shdma_setup_slave(struct shdma_chan *schan, dma_addr_t slave_addr)
175 dma_addr_t slave_addr)
176{ 175{
177 struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device); 176 struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
178 const struct shdma_ops *ops = sdev->ops; 177 const struct shdma_ops *ops = sdev->ops;
@@ -183,25 +182,23 @@ static int shdma_setup_slave(struct shdma_chan *schan, int slave_id,
183 ret = ops->set_slave(schan, match, slave_addr, true); 182 ret = ops->set_slave(schan, match, slave_addr, true);
184 if (ret < 0) 183 if (ret < 0)
185 return ret; 184 return ret;
186
187 slave_id = schan->slave_id;
188 } else { 185 } else {
189 match = slave_id; 186 match = schan->real_slave_id;
190 } 187 }
191 188
192 if (slave_id < 0 || slave_id >= slave_num) 189 if (schan->real_slave_id < 0 || schan->real_slave_id >= slave_num)
193 return -EINVAL; 190 return -EINVAL;
194 191
195 if (test_and_set_bit(slave_id, shdma_slave_used)) 192 if (test_and_set_bit(schan->real_slave_id, shdma_slave_used))
196 return -EBUSY; 193 return -EBUSY;
197 194
198 ret = ops->set_slave(schan, match, slave_addr, false); 195 ret = ops->set_slave(schan, match, slave_addr, false);
199 if (ret < 0) { 196 if (ret < 0) {
200 clear_bit(slave_id, shdma_slave_used); 197 clear_bit(schan->real_slave_id, shdma_slave_used);
201 return ret; 198 return ret;
202 } 199 }
203 200
204 schan->slave_id = slave_id; 201 schan->slave_id = schan->real_slave_id;
205 202
206 return 0; 203 return 0;
207} 204}
@@ -221,10 +218,12 @@ static int shdma_alloc_chan_resources(struct dma_chan *chan)
221 */ 218 */
222 if (slave) { 219 if (slave) {
223 /* Legacy mode: .private is set in filter */ 220 /* Legacy mode: .private is set in filter */
224 ret = shdma_setup_slave(schan, slave->slave_id, 0); 221 schan->real_slave_id = slave->slave_id;
222 ret = shdma_setup_slave(schan, 0);
225 if (ret < 0) 223 if (ret < 0)
226 goto esetslave; 224 goto esetslave;
227 } else { 225 } else {
226 /* Normal mode: real_slave_id was set by filter */
228 schan->slave_id = -EINVAL; 227 schan->slave_id = -EINVAL;
229 } 228 }
230 229
@@ -258,11 +257,14 @@ esetslave:
258 257
259/* 258/*
260 * This is the standard shdma filter function to be used as a replacement to the 259 * This is the standard shdma filter function to be used as a replacement to the
261 * "old" method, using the .private pointer. If for some reason you allocate a 260 * "old" method, using the .private pointer.
262 * channel without slave data, use something like ERR_PTR(-EINVAL) as a filter 261 * You always have to pass a valid slave id as the argument, old drivers that
262 * pass ERR_PTR(-EINVAL) as a filter parameter and set it up in dma_slave_config
263 * need to be updated so we can remove the slave_id field from dma_slave_config.
263 * parameter. If this filter is used, the slave driver, after calling 264 * parameter. If this filter is used, the slave driver, after calling
264 * dma_request_channel(), will also have to call dmaengine_slave_config() with 265 * dma_request_channel(), will also have to call dmaengine_slave_config() with
265 * .slave_id, .direction, and either .src_addr or .dst_addr set. 266 * .direction, and either .src_addr or .dst_addr set.
267 *
266 * NOTE: this filter doesn't support multiple DMAC drivers with the DMA_SLAVE 268 * NOTE: this filter doesn't support multiple DMAC drivers with the DMA_SLAVE
267 * capability! If this becomes a requirement, hardware glue drivers, using this 269 * capability! If this becomes a requirement, hardware glue drivers, using this
268 * services would have to provide their own filters, which first would check 270 * services would have to provide their own filters, which first would check
@@ -276,7 +278,7 @@ bool shdma_chan_filter(struct dma_chan *chan, void *arg)
276{ 278{
277 struct shdma_chan *schan; 279 struct shdma_chan *schan;
278 struct shdma_dev *sdev; 280 struct shdma_dev *sdev;
279 int match = (long)arg; 281 int slave_id = (long)arg;
280 int ret; 282 int ret;
281 283
282 /* Only support channels handled by this driver. */ 284 /* Only support channels handled by this driver. */
@@ -284,19 +286,39 @@ bool shdma_chan_filter(struct dma_chan *chan, void *arg)
284 shdma_alloc_chan_resources) 286 shdma_alloc_chan_resources)
285 return false; 287 return false;
286 288
287 if (match < 0) 289 schan = to_shdma_chan(chan);
290 sdev = to_shdma_dev(chan->device);
291
292 /*
293 * For DT, the schan->slave_id field is generated by the
294 * set_slave function from the slave ID that is passed in
295 * from xlate. For the non-DT case, the slave ID is
296 * directly passed into the filter function by the driver
297 */
298 if (schan->dev->of_node) {
299 ret = sdev->ops->set_slave(schan, slave_id, 0, true);
300 if (ret < 0)
301 return false;
302
303 schan->real_slave_id = schan->slave_id;
304 return true;
305 }
306
307 if (slave_id < 0) {
288 /* No slave requested - arbitrary channel */ 308 /* No slave requested - arbitrary channel */
309 dev_warn(sdev->dma_dev.dev, "invalid slave ID passed to dma_request_slave\n");
289 return true; 310 return true;
311 }
290 312
291 schan = to_shdma_chan(chan); 313 if (slave_id >= slave_num)
292 if (!schan->dev->of_node && match >= slave_num)
293 return false; 314 return false;
294 315
295 sdev = to_shdma_dev(schan->dma_chan.device); 316 ret = sdev->ops->set_slave(schan, slave_id, 0, true);
296 ret = sdev->ops->set_slave(schan, match, 0, true);
297 if (ret < 0) 317 if (ret < 0)
298 return false; 318 return false;
299 319
320 schan->real_slave_id = slave_id;
321
300 return true; 322 return true;
301} 323}
302EXPORT_SYMBOL(shdma_chan_filter); 324EXPORT_SYMBOL(shdma_chan_filter);
@@ -452,6 +474,8 @@ static void shdma_free_chan_resources(struct dma_chan *chan)
452 chan->private = NULL; 474 chan->private = NULL;
453 } 475 }
454 476
477 schan->real_slave_id = 0;
478
455 spin_lock_irq(&schan->chan_lock); 479 spin_lock_irq(&schan->chan_lock);
456 480
457 list_splice_init(&schan->ld_free, &list); 481 list_splice_init(&schan->ld_free, &list);
@@ -764,11 +788,20 @@ static int shdma_config(struct dma_chan *chan,
764 */ 788 */
765 if (!config) 789 if (!config)
766 return -EINVAL; 790 return -EINVAL;
791
792 /*
793 * overriding the slave_id through dma_slave_config is deprecated,
794 * but possibly some out-of-tree drivers still do it.
795 */
796 if (WARN_ON_ONCE(config->slave_id &&
797 config->slave_id != schan->real_slave_id))
798 schan->real_slave_id = config->slave_id;
799
767 /* 800 /*
768 * We could lock this, but you shouldn't be configuring the 801 * We could lock this, but you shouldn't be configuring the
769 * channel, while using it... 802 * channel, while using it...
770 */ 803 */
771 return shdma_setup_slave(schan, config->slave_id, 804 return shdma_setup_slave(schan,
772 config->direction == DMA_DEV_TO_MEM ? 805 config->direction == DMA_DEV_TO_MEM ?
773 config->src_addr : config->dst_addr); 806 config->src_addr : config->dst_addr);
774} 807}
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 7d9d6a321521..26b7889febb2 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -388,7 +388,7 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
388{ 388{
389 struct dma_slave_config cfg = { 0, }; 389 struct dma_slave_config cfg = { 0, };
390 struct dma_chan *chan; 390 struct dma_chan *chan;
391 unsigned int slave_id; 391 void *slave_data = NULL;
392 struct resource *res; 392 struct resource *res;
393 dma_cap_mask_t mask; 393 dma_cap_mask_t mask;
394 int ret; 394 int ret;
@@ -397,13 +397,12 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
397 dma_cap_set(DMA_SLAVE, mask); 397 dma_cap_set(DMA_SLAVE, mask);
398 398
399 if (pdata) 399 if (pdata)
400 slave_id = direction == DMA_MEM_TO_DEV 400 slave_data = direction == DMA_MEM_TO_DEV ?
401 ? pdata->slave_id_tx : pdata->slave_id_rx; 401 (void *)pdata->slave_id_tx :
402 else 402 (void *)pdata->slave_id_rx;
403 slave_id = 0;
404 403
405 chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, 404 chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
406 (void *)(unsigned long)slave_id, &host->pd->dev, 405 slave_data, &host->pd->dev,
407 direction == DMA_MEM_TO_DEV ? "tx" : "rx"); 406 direction == DMA_MEM_TO_DEV ? "tx" : "rx");
408 407
409 dev_dbg(&host->pd->dev, "%s: %s: got channel %p\n", __func__, 408 dev_dbg(&host->pd->dev, "%s: %s: got channel %p\n", __func__,
@@ -414,8 +413,6 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
414 413
415 res = platform_get_resource(host->pd, IORESOURCE_MEM, 0); 414 res = platform_get_resource(host->pd, IORESOURCE_MEM, 0);
416 415
417 /* In the OF case the driver will get the slave ID from the DT */
418 cfg.slave_id = slave_id;
419 cfg.direction = direction; 416 cfg.direction = direction;
420 417
421 if (direction == DMA_DEV_TO_MEM) { 418 if (direction == DMA_DEV_TO_MEM) {
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 6906a905cd54..354f4f335ed5 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -201,7 +201,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
201 of_match_device(sh_mobile_sdhi_of_match, &pdev->dev); 201 of_match_device(sh_mobile_sdhi_of_match, &pdev->dev);
202 struct sh_mobile_sdhi *priv; 202 struct sh_mobile_sdhi *priv;
203 struct tmio_mmc_data *mmc_data; 203 struct tmio_mmc_data *mmc_data;
204 struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; 204 struct tmio_mmc_data *mmd = pdev->dev.platform_data;
205 struct tmio_mmc_host *host; 205 struct tmio_mmc_host *host;
206 struct resource *res; 206 struct resource *res;
207 int irq, ret, i = 0; 207 int irq, ret, i = 0;
@@ -245,30 +245,14 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
245 else 245 else
246 host->bus_shift = 0; 246 host->bus_shift = 0;
247 247
248 mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; 248 if (mmd)
249 if (p) { 249 *mmc_data = *mmd;
250 mmc_data->flags = p->tmio_flags; 250
251 mmc_data->ocr_mask = p->tmio_ocr_mask;
252 mmc_data->capabilities |= p->tmio_caps;
253 mmc_data->capabilities2 |= p->tmio_caps2;
254 mmc_data->cd_gpio = p->cd_gpio;
255
256 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) {
257 /*
258 * Yes, we have to provide slave IDs twice to TMIO:
259 * once as a filter parameter and once for channel
260 * configuration as an explicit slave ID
261 */
262 dma_priv->chan_priv_tx = (void *)p->dma_slave_tx;
263 dma_priv->chan_priv_rx = (void *)p->dma_slave_rx;
264 dma_priv->slave_id_tx = p->dma_slave_tx;
265 dma_priv->slave_id_rx = p->dma_slave_rx;
266 }
267 }
268 dma_priv->filter = shdma_chan_filter; 251 dma_priv->filter = shdma_chan_filter;
269 dma_priv->enable = sh_mobile_sdhi_enable_dma; 252 dma_priv->enable = sh_mobile_sdhi_enable_dma;
270 253
271 mmc_data->alignment_shift = 1; /* 2-byte alignment */ 254 mmc_data->alignment_shift = 1; /* 2-byte alignment */
255 mmc_data->capabilities |= MMC_CAP_MMC_HIGHSPEED;
272 256
273 /* 257 /*
274 * All SDHI blocks support 2-byte and larger block sizes in 4-bit 258 * All SDHI blocks support 2-byte and larger block sizes in 4-bit
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index fc3805ed69d1..4a597f5a53e2 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -43,10 +43,6 @@ struct tmio_mmc_data;
43struct tmio_mmc_host; 43struct tmio_mmc_host;
44 44
45struct tmio_mmc_dma { 45struct tmio_mmc_dma {
46 void *chan_priv_tx;
47 void *chan_priv_rx;
48 int slave_id_tx;
49 int slave_id_rx;
50 enum dma_slave_buswidth dma_buswidth; 46 enum dma_slave_buswidth dma_buswidth;
51 bool (*filter)(struct dma_chan *chan, void *arg); 47 bool (*filter)(struct dma_chan *chan, void *arg);
52 void (*enable)(struct tmio_mmc_host *host, bool enable); 48 void (*enable)(struct tmio_mmc_host *host, bool enable);
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 331bb618e398..e4b05dbb9ca8 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -261,7 +261,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
261{ 261{
262 /* We can only either use DMA for both Tx and Rx or not use it at all */ 262 /* We can only either use DMA for both Tx and Rx or not use it at all */
263 if (!host->dma || (!host->pdev->dev.of_node && 263 if (!host->dma || (!host->pdev->dev.of_node &&
264 (!host->dma->chan_priv_tx || !host->dma->chan_priv_rx))) 264 (!pdata->chan_priv_tx || !pdata->chan_priv_rx)))
265 return; 265 return;
266 266
267 if (!host->chan_tx && !host->chan_rx) { 267 if (!host->chan_tx && !host->chan_rx) {
@@ -278,7 +278,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
278 dma_cap_set(DMA_SLAVE, mask); 278 dma_cap_set(DMA_SLAVE, mask);
279 279
280 host->chan_tx = dma_request_slave_channel_compat(mask, 280 host->chan_tx = dma_request_slave_channel_compat(mask,
281 host->dma->filter, host->dma->chan_priv_tx, 281 host->dma->filter, pdata->chan_priv_tx,
282 &host->pdev->dev, "tx"); 282 &host->pdev->dev, "tx");
283 dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__, 283 dev_dbg(&host->pdev->dev, "%s: TX: got channel %p\n", __func__,
284 host->chan_tx); 284 host->chan_tx);
@@ -286,8 +286,6 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
286 if (!host->chan_tx) 286 if (!host->chan_tx)
287 return; 287 return;
288 288
289 if (host->dma->chan_priv_tx)
290 cfg.slave_id = host->dma->slave_id_tx;
291 cfg.direction = DMA_MEM_TO_DEV; 289 cfg.direction = DMA_MEM_TO_DEV;
292 cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift); 290 cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
293 cfg.dst_addr_width = host->dma->dma_buswidth; 291 cfg.dst_addr_width = host->dma->dma_buswidth;
@@ -299,7 +297,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
299 goto ecfgtx; 297 goto ecfgtx;
300 298
301 host->chan_rx = dma_request_slave_channel_compat(mask, 299 host->chan_rx = dma_request_slave_channel_compat(mask,
302 host->dma->filter, host->dma->chan_priv_rx, 300 host->dma->filter, pdata->chan_priv_rx,
303 &host->pdev->dev, "rx"); 301 &host->pdev->dev, "rx");
304 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__, 302 dev_dbg(&host->pdev->dev, "%s: RX: got channel %p\n", __func__,
305 host->chan_rx); 303 host->chan_rx);
@@ -307,8 +305,6 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
307 if (!host->chan_rx) 305 if (!host->chan_rx)
308 goto ereqrx; 306 goto ereqrx;
309 307
310 if (host->dma->chan_priv_rx)
311 cfg.slave_id = host->dma->slave_id_rx;
312 cfg.direction = DMA_DEV_TO_MEM; 308 cfg.direction = DMA_DEV_TO_MEM;
313 cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset; 309 cfg.src_addr = cfg.dst_addr + host->pdata->dma_rx_offset;
314 cfg.src_addr_width = host->dma->dma_buswidth; 310 cfg.src_addr_width = host->dma->dma_buswidth;
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index a21c378f096a..c3ce81c1a716 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -159,7 +159,6 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
159 return; 159 return;
160 160
161 memset(&cfg, 0, sizeof(cfg)); 161 memset(&cfg, 0, sizeof(cfg));
162 cfg.slave_id = pdata->slave_id_fifo0_tx;
163 cfg.direction = DMA_MEM_TO_DEV; 162 cfg.direction = DMA_MEM_TO_DEV;
164 cfg.dst_addr = (dma_addr_t)FLDTFIFO(flctl); 163 cfg.dst_addr = (dma_addr_t)FLDTFIFO(flctl);
165 cfg.src_addr = 0; 164 cfg.src_addr = 0;
@@ -175,7 +174,6 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
175 if (!flctl->chan_fifo0_rx) 174 if (!flctl->chan_fifo0_rx)
176 goto err; 175 goto err;
177 176
178 cfg.slave_id = pdata->slave_id_fifo0_rx;
179 cfg.direction = DMA_DEV_TO_MEM; 177 cfg.direction = DMA_DEV_TO_MEM;
180 cfg.dst_addr = 0; 178 cfg.dst_addr = 0;
181 cfg.src_addr = (dma_addr_t)FLDTFIFO(flctl); 179 cfg.src_addr = (dma_addr_t)FLDTFIFO(flctl);
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 46ce47076e63..3f4110628474 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -913,7 +913,6 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev,
913 } 913 }
914 914
915 memset(&cfg, 0, sizeof(cfg)); 915 memset(&cfg, 0, sizeof(cfg));
916 cfg.slave_id = id;
917 cfg.direction = dir; 916 cfg.direction = dir;
918 if (dir == DMA_MEM_TO_DEV) { 917 if (dir == DMA_MEM_TO_DEV) {
919 cfg.dst_addr = port_addr; 918 cfg.dst_addr = port_addr;
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index e57eec0b2f46..bcc7c635d8e7 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1030,7 +1030,6 @@ static struct dma_chan *sh_msiof_request_dma_chan(struct device *dev,
1030 } 1030 }
1031 1031
1032 memset(&cfg, 0, sizeof(cfg)); 1032 memset(&cfg, 0, sizeof(cfg));
1033 cfg.slave_id = id;
1034 cfg.direction = dir; 1033 cfg.direction = dir;
1035 if (dir == DMA_MEM_TO_DEV) { 1034 if (dir == DMA_MEM_TO_DEV) {
1036 cfg.dst_addr = port_addr; 1035 cfg.dst_addr = port_addr;
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 605812820e48..24b86d538e88 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -111,6 +111,8 @@ struct dma_chan;
111 * data for the MMC controller 111 * data for the MMC controller
112 */ 112 */
113struct tmio_mmc_data { 113struct tmio_mmc_data {
114 void *chan_priv_tx;
115 void *chan_priv_rx;
114 unsigned int hclk; 116 unsigned int hclk;
115 unsigned long capabilities; 117 unsigned long capabilities;
116 unsigned long capabilities2; 118 unsigned long capabilities2;
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index da77e5e2041d..95d6f0314a7d 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -7,14 +7,4 @@
7#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 7#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
8#define SH_MOBILE_SDHI_IRQ_SDIO "sdio" 8#define SH_MOBILE_SDHI_IRQ_SDIO "sdio"
9 9
10struct sh_mobile_sdhi_info {
11 int dma_slave_tx;
12 int dma_slave_rx;
13 unsigned long tmio_flags;
14 unsigned long tmio_caps;
15 unsigned long tmio_caps2;
16 u32 tmio_ocr_mask; /* available MMC voltages */
17 unsigned int cd_gpio;
18};
19
20#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ 10#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index abdf1f229dc3..dd0ba502ccb3 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -69,6 +69,7 @@ struct shdma_chan {
69 int id; /* Raw id of this channel */ 69 int id; /* Raw id of this channel */
70 int irq; /* Channel IRQ */ 70 int irq; /* Channel IRQ */
71 int slave_id; /* Client ID for slave DMA */ 71 int slave_id; /* Client ID for slave DMA */
72 int real_slave_id; /* argument passed to filter function */
72 int hw_req; /* DMA request line for slave DMA - same 73 int hw_req; /* DMA request line for slave DMA - same
73 * as MID/RID, used with DT */ 74 * as MID/RID, used with DT */
74 enum shdma_pm_state pm_state; 75 enum shdma_pm_state pm_state;
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index b87b22e88e43..bb20550b007c 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -250,6 +250,7 @@ struct fsi_clk {
250 250
251struct fsi_priv { 251struct fsi_priv {
252 void __iomem *base; 252 void __iomem *base;
253 phys_addr_t phys;
253 struct fsi_master *master; 254 struct fsi_master *master;
254 255
255 struct fsi_stream playback; 256 struct fsi_stream playback;
@@ -1371,13 +1372,18 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
1371 shdma_chan_filter, (void *)io->dma_id, 1372 shdma_chan_filter, (void *)io->dma_id,
1372 dev, is_play ? "tx" : "rx"); 1373 dev, is_play ? "tx" : "rx");
1373 if (io->chan) { 1374 if (io->chan) {
1374 struct dma_slave_config cfg; 1375 struct dma_slave_config cfg = {};
1375 int ret; 1376 int ret;
1376 1377
1377 cfg.slave_id = io->dma_id; 1378 if (is_play) {
1378 cfg.dst_addr = 0; /* use default addr */ 1379 cfg.dst_addr = fsi->phys + REG_DODT;
1379 cfg.src_addr = 0; /* use default addr */ 1380 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1380 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; 1381 cfg.direction = DMA_MEM_TO_DEV;
1382 } else {
1383 cfg.src_addr = fsi->phys + REG_DIDT;
1384 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1385 cfg.direction = DMA_DEV_TO_MEM;
1386 }
1381 1387
1382 ret = dmaengine_slave_config(io->chan, &cfg); 1388 ret = dmaengine_slave_config(io->chan, &cfg);
1383 if (ret < 0) { 1389 if (ret < 0) {
@@ -1941,6 +1947,7 @@ static int fsi_probe(struct platform_device *pdev)
1941 /* FSI A setting */ 1947 /* FSI A setting */
1942 fsi = &master->fsia; 1948 fsi = &master->fsia;
1943 fsi->base = master->base; 1949 fsi->base = master->base;
1950 fsi->phys = res->start;
1944 fsi->master = master; 1951 fsi->master = master;
1945 fsi_port_info_init(fsi, &info.port_a); 1952 fsi_port_info_init(fsi, &info.port_a);
1946 fsi_handler_init(fsi, &info.port_a); 1953 fsi_handler_init(fsi, &info.port_a);
@@ -1953,6 +1960,7 @@ static int fsi_probe(struct platform_device *pdev)
1953 /* FSI B setting */ 1960 /* FSI B setting */
1954 fsi = &master->fsib; 1961 fsi = &master->fsib;
1955 fsi->base = master->base + 0x40; 1962 fsi->base = master->base + 0x40;
1963 fsi->phys = res->start + 0x40;
1956 fsi->master = master; 1964 fsi->master = master;
1957 fsi_port_info_init(fsi, &info.port_b); 1965 fsi_port_info_init(fsi, &info.port_b);
1958 fsi_handler_init(fsi, &info.port_b); 1966 fsi_handler_init(fsi, &info.port_b);