Browse Source

sh: prepare the SDHI MFD driver to pass DMA configuration to tmio_mmc.c

Pass DMA slave IDs from platform down to the tmio_mmc driver, to be used
for dmaengine configuration.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Guennadi Liakhovetski 15 years ago
parent
commit
056676dabd
2 changed files with 22 additions and 4 deletions
  1. 20 4
      drivers/mfd/sh_mobile_sdhi.c
  2. 2 0
      include/linux/mfd/sh_mobile_sdhi.h

+ 20 - 4
drivers/mfd/sh_mobile_sdhi.c

@@ -26,11 +26,15 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mfd/sh_mobile_sdhi.h>
+#include <linux/sh_dma.h>
 
 
 struct sh_mobile_sdhi {
 struct sh_mobile_sdhi {
 	struct clk *clk;
 	struct clk *clk;
 	struct tmio_mmc_data mmc_data;
 	struct tmio_mmc_data mmc_data;
 	struct mfd_cell cell_mmc;
 	struct mfd_cell cell_mmc;
+	struct sh_dmae_slave param_tx;
+	struct sh_dmae_slave param_rx;
+	struct tmio_mmc_dma dma_priv;
 };
 };
 
 
 static struct resource sh_mobile_sdhi_resources[] = {
 static struct resource sh_mobile_sdhi_resources[] = {
@@ -64,6 +68,8 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 {
 	struct sh_mobile_sdhi *priv;
 	struct sh_mobile_sdhi *priv;
+	struct tmio_mmc_data *mmc_data;
+	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 	struct resource *mem;
 	struct resource *mem;
 	char clk_name[8];
 	char clk_name[8];
 	int ret, irq;
 	int ret, irq;
@@ -85,6 +91,8 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 		return -ENOMEM;
 	}
 	}
 
 
+	mmc_data = &priv->mmc_data;
+
 	snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
 	snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
 	priv->clk = clk_get(&pdev->dev, clk_name);
 	priv->clk = clk_get(&pdev->dev, clk_name);
 	if (IS_ERR(priv->clk)) {
 	if (IS_ERR(priv->clk)) {
@@ -96,12 +104,20 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 
 
 	clk_enable(priv->clk);
 	clk_enable(priv->clk);
 
 
-	priv->mmc_data.hclk = clk_get_rate(priv->clk);
-	priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
-	priv->mmc_data.capabilities = MMC_CAP_MMC_HIGHSPEED;
+	mmc_data->hclk = clk_get_rate(priv->clk);
+	mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
+	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
+
+	if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
+		priv->param_tx.slave_id = p->dma_slave_tx;
+		priv->param_rx.slave_id = p->dma_slave_rx;
+		priv->dma_priv.chan_priv_tx = &priv->param_tx;
+		priv->dma_priv.chan_priv_rx = &priv->param_rx;
+		mmc_data->dma = &priv->dma_priv;
+	}
 
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
-	priv->cell_mmc.driver_data = &priv->mmc_data;
+	priv->cell_mmc.driver_data = mmc_data;
 	priv->cell_mmc.platform_data = &priv->cell_mmc;
 	priv->cell_mmc.platform_data = &priv->cell_mmc;
 	priv->cell_mmc.data_size = sizeof(priv->cell_mmc);
 	priv->cell_mmc.data_size = sizeof(priv->cell_mmc);
 
 

+ 2 - 0
include/linux/mfd/sh_mobile_sdhi.h

@@ -2,6 +2,8 @@
 #define __SH_MOBILE_SDHI_H__
 #define __SH_MOBILE_SDHI_H__
 
 
 struct sh_mobile_sdhi_info {
 struct sh_mobile_sdhi_info {
+	int dma_slave_tx;
+	int dma_slave_rx;
 	void (*set_pwr)(struct platform_device *pdev, int state);
 	void (*set_pwr)(struct platform_device *pdev, int state);
 };
 };