linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] omap-hsmmc.c: re-organize dma line population
@ 2010-05-11  8:32 Madhvapathi Sriram
  2010-05-11 10:52 ` Grazvydas Ignotas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Madhvapathi Sriram @ 2010-05-11  8:32 UTC (permalink / raw)
  To: linux-omap; +Cc: madhu.cr, Madhvapathi Sriram

 - This moves the dma line population from omap_hsmmc.c to plat-omap/devices.c
 - This is done to keep platform specific code inside the platform directory
   rather than the host driver
 - This makes the porting work across OMAP platforms easier

Signed-off-by: Madhvapathi Sriram <sriram.m@ti.com>
---
 arch/arm/plat-omap/devices.c  |   49 ++++++++++++++++++++++++++++++++++++++++-
 drivers/mmc/host/omap_hsmmc.c |   35 +++++++---------------------
 2 files changed, 57 insertions(+), 27 deletions(-)

diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 95677d1..a62b148 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -30,6 +30,7 @@
 #include <plat/mcbsp.h>
 #include <plat/dsp_common.h>
 #include <plat/omap44xx.h>
+#include <plat/dma.h>
 
 #if	defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
 
@@ -232,7 +233,7 @@ static inline void omap_init_mcpdm(void) {}
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
 	defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
 
-#define OMAP_MMC_NR_RES		2
+#define OMAP_MMC_NR_RES		4
 
 /*
  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
@@ -255,6 +256,52 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
 	res[0].flags = IORESOURCE_MEM;
 	res[1].start = res[1].end = irq;
 	res[1].flags = IORESOURCE_IRQ;
+	/* Populate DMA lines based on the instance used. Rx first,Tx next*/
+	switch (id) {
+	case 0:
+		res[2].start = OMAP24XX_DMA_MMC1_RX;
+		res[2].end = OMAP24XX_DMA_MMC1_RX;
+		res[2].flags = IORESOURCE_DMA;
+		res[3].start = OMAP24XX_DMA_MMC1_TX;
+		res[3].end = OMAP24XX_DMA_MMC1_TX;
+		res[3].flags = IORESOURCE_DMA;
+		break;
+	case 1:
+		res[2].start = OMAP24XX_DMA_MMC2_RX;
+		res[2].end = OMAP24XX_DMA_MMC2_RX;
+		res[2].flags = IORESOURCE_DMA;
+		res[3].start = OMAP24XX_DMA_MMC2_TX;
+		res[3].end = OMAP24XX_DMA_MMC2_TX;
+		res[3].flags = IORESOURCE_DMA;
+		break;
+	case 2:
+		res[2].start = OMAP34XX_DMA_MMC3_RX;
+		res[2].end = OMAP34XX_DMA_MMC3_RX;
+		res[2].flags = IORESOURCE_DMA;
+		res[3].start = OMAP34XX_DMA_MMC3_TX;
+		res[3].end = OMAP34XX_DMA_MMC3_TX;
+		res[3].flags = IORESOURCE_DMA;
+		break;
+	case 3:
+		res[2].start = OMAP44XX_DMA_MMC4_RX;
+		res[2].end = OMAP44XX_DMA_MMC4_RX;
+		res[2].flags = IORESOURCE_DMA;
+		res[3].start = OMAP44XX_DMA_MMC4_TX;
+		res[3].end = OMAP44XX_DMA_MMC4_TX;
+		res[3].flags = IORESOURCE_DMA;
+		break;
+	case 4:
+		res[2].start = OMAP44XX_DMA_MMC5_RX;
+		res[2].end = OMAP44XX_DMA_MMC5_RX;
+		res[2].flags = IORESOURCE_DMA;
+		res[3].start = OMAP44XX_DMA_MMC5_TX;
+		res[3].end = OMAP44XX_DMA_MMC5_TX;
+		res[3].flags = IORESOURCE_DMA;
+		break;
+	default:
+		ret = -ENODEV;
+		goto fail;
+	}
 
 	ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
 	if (ret == 0)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e9caf69..61d30ab 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2096,32 +2096,15 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
 
 	omap_hsmmc_conf_bus_power(host);
 
-	/* Select DMA lines */
-	switch (host->id) {
-	case OMAP_MMC1_DEVID:
-		host->dma_line_tx = OMAP24XX_DMA_MMC1_TX;
-		host->dma_line_rx = OMAP24XX_DMA_MMC1_RX;
-		break;
-	case OMAP_MMC2_DEVID:
-		host->dma_line_tx = OMAP24XX_DMA_MMC2_TX;
-		host->dma_line_rx = OMAP24XX_DMA_MMC2_RX;
-		break;
-	case OMAP_MMC3_DEVID:
-		host->dma_line_tx = OMAP34XX_DMA_MMC3_TX;
-		host->dma_line_rx = OMAP34XX_DMA_MMC3_RX;
-		break;
-	case OMAP_MMC4_DEVID:
-		host->dma_line_tx = OMAP44XX_DMA_MMC4_TX;
-		host->dma_line_rx = OMAP44XX_DMA_MMC4_RX;
-		break;
-	case OMAP_MMC5_DEVID:
-		host->dma_line_tx = OMAP44XX_DMA_MMC5_TX;
-		host->dma_line_rx = OMAP44XX_DMA_MMC5_RX;
-		break;
-	default:
-		dev_err(mmc_dev(host->mmc), "Invalid MMC id\n");
-		goto err_irq;
-	}
+	res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+	if (!res)
+		goto err1;
+	host->dma_line_rx = res->start;
+
+	res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+	if (!res)
+		goto err1;
+	host->dma_line_tx = res->start;
 
 	/* Request IRQ for MMC operations */
 	ret = request_irq(host->irq, omap_hsmmc_irq, IRQF_DISABLED,
-- 
1.5.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] omap-hsmmc.c: re-organize dma line population
  2010-05-11  8:32 [PATCH 1/1] omap-hsmmc.c: re-organize dma line population Madhvapathi Sriram
@ 2010-05-11 10:52 ` Grazvydas Ignotas
  2010-05-11 11:19 ` Venkatraman S
  2010-05-11 19:56 ` Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Grazvydas Ignotas @ 2010-05-11 10:52 UTC (permalink / raw)
  To: Madhvapathi Sriram; +Cc: linux-omap, madhu.cr

On Tue, May 11, 2010 at 11:32 AM, Madhvapathi Sriram <sriram.m@ti.com> wrote:
>  - This moves the dma line population from omap_hsmmc.c to plat-omap/devices.c
>  - This is done to keep platform specific code inside the platform directory
>   rather than the host driver
>  - This makes the porting work across OMAP platforms easier
>
> Signed-off-by: Madhvapathi Sriram <sriram.m@ti.com>
> ---
>  arch/arm/plat-omap/devices.c  |   49 ++++++++++++++++++++++++++++++++++++++++-
>  drivers/mmc/host/omap_hsmmc.c |   35 +++++++---------------------
>  2 files changed, 57 insertions(+), 27 deletions(-)
>
> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> index 95677d1..a62b148 100644
> --- a/arch/arm/plat-omap/devices.c
> +++ b/arch/arm/plat-omap/devices.c
> @@ -30,6 +30,7 @@
>  #include <plat/mcbsp.h>
>  #include <plat/dsp_common.h>
>  #include <plat/omap44xx.h>
> +#include <plat/dma.h>
>
>  #if    defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
>
> @@ -232,7 +233,7 @@ static inline void omap_init_mcpdm(void) {}
>  #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
>        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
>
> -#define OMAP_MMC_NR_RES                2
> +#define OMAP_MMC_NR_RES                4
>
>  /*
>  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
> @@ -255,6 +256,52 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
>        res[0].flags = IORESOURCE_MEM;
>        res[1].start = res[1].end = irq;
>        res[1].flags = IORESOURCE_IRQ;

You can just set .flags right here, no need to repeat in each switch case:
> +       res[2].flags = IORESOURCE_DMA;
> +       res[3].flags = IORESOURCE_DMA;

> +       /* Populate DMA lines based on the instance used. Rx first,Tx next*/
> +       switch (id) {
> +       case 0:
> +               res[2].start = OMAP24XX_DMA_MMC1_RX;
> +               res[2].end = OMAP24XX_DMA_MMC1_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP24XX_DMA_MMC1_TX;
> +               res[3].end = OMAP24XX_DMA_MMC1_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       case 1:
> +               res[2].start = OMAP24XX_DMA_MMC2_RX;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] omap-hsmmc.c: re-organize dma line population
  2010-05-11  8:32 [PATCH 1/1] omap-hsmmc.c: re-organize dma line population Madhvapathi Sriram
  2010-05-11 10:52 ` Grazvydas Ignotas
@ 2010-05-11 11:19 ` Venkatraman S
  2010-05-11 19:56 ` Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Venkatraman S @ 2010-05-11 11:19 UTC (permalink / raw)
  To: Madhvapathi Sriram; +Cc: linux-omap, madhu.cr

Madhvapathi Sriram <sriram.m@ti.com> wrote:
>  - This moves the dma line population from omap_hsmmc.c to plat-omap/devices.c
>  - This is done to keep platform specific code inside the platform directory
>   rather than the host driver
>  - This makes the porting work across OMAP platforms easier
>
> Signed-off-by: Madhvapathi Sriram <sriram.m@ti.com>
> ---
>  arch/arm/plat-omap/devices.c  |   49 ++++++++++++++++++++++++++++++++++++++++-
>  drivers/mmc/host/omap_hsmmc.c |   35 +++++++---------------------
>  2 files changed, 57 insertions(+), 27 deletions(-)
>
> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> index 95677d1..a62b148 100644
> --- a/arch/arm/plat-omap/devices.c
> +++ b/arch/arm/plat-omap/devices.c
> @@ -30,6 +30,7 @@
>  #include <plat/mcbsp.h>
>  #include <plat/dsp_common.h>
>  #include <plat/omap44xx.h>
> +#include <plat/dma.h>
>
>  #if    defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
>
> @@ -232,7 +233,7 @@ static inline void omap_init_mcpdm(void) {}
>  #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
>        defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
>
> -#define OMAP_MMC_NR_RES                2
> +#define OMAP_MMC_NR_RES                4
>
>  /*
>  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
> @@ -255,6 +256,52 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
>        res[0].flags = IORESOURCE_MEM;
>        res[1].start = res[1].end = irq;
>        res[1].flags = IORESOURCE_IRQ;
> +       /* Populate DMA lines based on the instance used. Rx first,Tx next*/
> +       switch (id) {
> +       case 0:
> +               res[2].start = OMAP24XX_DMA_MMC1_RX;
> +               res[2].end = OMAP24XX_DMA_MMC1_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP24XX_DMA_MMC1_TX;
> +               res[3].end = OMAP24XX_DMA_MMC1_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       case 1:
> +               res[2].start = OMAP24XX_DMA_MMC2_RX;
> +               res[2].end = OMAP24XX_DMA_MMC2_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP24XX_DMA_MMC2_TX;
> +               res[3].end = OMAP24XX_DMA_MMC2_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       case 2:
> +               res[2].start = OMAP34XX_DMA_MMC3_RX;
> +               res[2].end = OMAP34XX_DMA_MMC3_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP34XX_DMA_MMC3_TX;
> +               res[3].end = OMAP34XX_DMA_MMC3_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       case 3:
> +               res[2].start = OMAP44XX_DMA_MMC4_RX;
> +               res[2].end = OMAP44XX_DMA_MMC4_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP44XX_DMA_MMC4_TX;
> +               res[3].end = OMAP44XX_DMA_MMC4_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       case 4:
> +               res[2].start = OMAP44XX_DMA_MMC5_RX;
> +               res[2].end = OMAP44XX_DMA_MMC5_RX;
> +               res[2].flags = IORESOURCE_DMA;
> +               res[3].start = OMAP44XX_DMA_MMC5_TX;
> +               res[3].end = OMAP44XX_DMA_MMC5_TX;
> +               res[3].flags = IORESOURCE_DMA;
> +               break;
> +       default:
> +               ret = -ENODEV;
> +               goto fail;
> +       }
>
>        ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
>        if (ret == 0)
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index e9caf69..61d30ab 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -2096,32 +2096,15 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
>
>        omap_hsmmc_conf_bus_power(host);
>
> -       /* Select DMA lines */
> -       switch (host->id) {
> -       case OMAP_MMC1_DEVID:
> -               host->dma_line_tx = OMAP24XX_DMA_MMC1_TX;
> -               host->dma_line_rx = OMAP24XX_DMA_MMC1_RX;
> -               break;
> -       case OMAP_MMC2_DEVID:
> -               host->dma_line_tx = OMAP24XX_DMA_MMC2_TX;
> -               host->dma_line_rx = OMAP24XX_DMA_MMC2_RX;
> -               break;
> -       case OMAP_MMC3_DEVID:
> -               host->dma_line_tx = OMAP34XX_DMA_MMC3_TX;
> -               host->dma_line_rx = OMAP34XX_DMA_MMC3_RX;
> -               break;
> -       case OMAP_MMC4_DEVID:
> -               host->dma_line_tx = OMAP44XX_DMA_MMC4_TX;
> -               host->dma_line_rx = OMAP44XX_DMA_MMC4_RX;
> -               break;
> -       case OMAP_MMC5_DEVID:
> -               host->dma_line_tx = OMAP44XX_DMA_MMC5_TX;
> -               host->dma_line_rx = OMAP44XX_DMA_MMC5_RX;
> -               break;
> -       default:
> -               dev_err(mmc_dev(host->mmc), "Invalid MMC id\n");
> -               goto err_irq;
> -       }
> +       res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> +       if (!res)
> +               goto err1;
> +       host->dma_line_rx = res->start;
> +
> +       res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
> +       if (!res)
> +               goto err1;
> +       host->dma_line_tx = res->start;
>
>        /* Request IRQ for MMC operations */
>        ret = request_irq(host->irq, omap_hsmmc_irq, IRQF_DISABLED,
> --

This is part of hwmod work and present in Kevin's runtime PM changes. See
http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=commit;h=78977ffbbe9f90ee6becc543526252d081381f72
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] omap-hsmmc.c: re-organize dma line population
  2010-05-11  8:32 [PATCH 1/1] omap-hsmmc.c: re-organize dma line population Madhvapathi Sriram
  2010-05-11 10:52 ` Grazvydas Ignotas
  2010-05-11 11:19 ` Venkatraman S
@ 2010-05-11 19:56 ` Tony Lindgren
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2010-05-11 19:56 UTC (permalink / raw)
  To: Madhvapathi Sriram; +Cc: linux-omap, madhu.cr

* Madhvapathi Sriram <sriram.m@ti.com> [100511 02:26]:
> @@ -255,6 +256,52 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
>  	res[0].flags = IORESOURCE_MEM;
>  	res[1].start = res[1].end = irq;
>  	res[1].flags = IORESOURCE_IRQ;
> +	/* Populate DMA lines based on the instance used. Rx first,Tx next*/
> +	switch (id) {
> +	case 0:
> +		res[2].start = OMAP24XX_DMA_MMC1_RX;
> +		res[2].end = OMAP24XX_DMA_MMC1_RX;
> +		res[2].flags = IORESOURCE_DMA;
> +		res[3].start = OMAP24XX_DMA_MMC1_TX;
> +		res[3].end = OMAP24XX_DMA_MMC1_TX;
> +		res[3].flags = IORESOURCE_DMA;
> +		break;
> +	case 1:
> +		res[2].start = OMAP24XX_DMA_MMC2_RX;
> +		res[2].end = OMAP24XX_DMA_MMC2_RX;
> +		res[2].flags = IORESOURCE_DMA;
> +		res[3].start = OMAP24XX_DMA_MMC2_TX;
> +		res[3].end = OMAP24XX_DMA_MMC2_TX;
> +		res[3].flags = IORESOURCE_DMA;
> +		break;
> +	case 2:
> +		res[2].start = OMAP34XX_DMA_MMC3_RX;
> +		res[2].end = OMAP34XX_DMA_MMC3_RX;
> +		res[2].flags = IORESOURCE_DMA;
> +		res[3].start = OMAP34XX_DMA_MMC3_TX;
> +		res[3].end = OMAP34XX_DMA_MMC3_TX;
> +		res[3].flags = IORESOURCE_DMA;
> +		break;
> +	case 3:
> +		res[2].start = OMAP44XX_DMA_MMC4_RX;
> +		res[2].end = OMAP44XX_DMA_MMC4_RX;
> +		res[2].flags = IORESOURCE_DMA;
> +		res[3].start = OMAP44XX_DMA_MMC4_TX;
> +		res[3].end = OMAP44XX_DMA_MMC4_TX;
> +		res[3].flags = IORESOURCE_DMA;
> +		break;
> +	case 4:
> +		res[2].start = OMAP44XX_DMA_MMC5_RX;
> +		res[2].end = OMAP44XX_DMA_MMC5_RX;
> +		res[2].flags = IORESOURCE_DMA;
> +		res[3].start = OMAP44XX_DMA_MMC5_TX;
> +		res[3].end = OMAP44XX_DMA_MMC5_TX;
> +		res[3].flags = IORESOURCE_DMA;
> +		break;
> +	default:
> +		ret = -ENODEV;
> +		goto fail;
> +	}

To me it seems like this should go into mach-omap2/hsmmc.c instead
of plat-omap/devices.c.

Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-11 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11  8:32 [PATCH 1/1] omap-hsmmc.c: re-organize dma line population Madhvapathi Sriram
2010-05-11 10:52 ` Grazvydas Ignotas
2010-05-11 11:19 ` Venkatraman S
2010-05-11 19:56 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).