diff mbox

[RESEND] mmc: dw_mmc: Add check for IDMAC configuration

Message ID 1339495102-4889-1-git-send-email-girish.shivananjappa@linaro.org
State Accepted
Commit 94c6cee91bebfc17596243b6a5f4fe910feec426
Headers show

Commit Message

Girish K S June 12, 2012, 9:58 a.m. UTC
In the Current dwmmc driver there is support for selecting IDMAC from
the menu config option. If the support for IDMAC is enabled in the menu
config and Hardware configuration register's DMA_INTERFACE field is 0.
Still the driver will try to do the DMA initialization.

The dw_mci_idmac_init function currently implemented returns only success
indicating that the DMA initialization is always successful. The current
patch will add a ciheck for existance of the DMA IP and allow the
DMA initialization.

Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
---
 drivers/mmc/host/dw_mmc.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

Comments

Will Newton June 12, 2012, 10:08 a.m. UTC | #1
On Tue, Jun 12, 2012 at 10:58 AM, Girish K S
<girish.shivananjappa@linaro.org> wrote:
> In the Current dwmmc driver there is support for selecting IDMAC from
> the menu config option. If the support for IDMAC is enabled in the menu
> config and Hardware configuration register's DMA_INTERFACE field is 0.
> Still the driver will try to do the DMA initialization.
>
> The dw_mci_idmac_init function currently implemented returns only success
> indicating that the DMA initialization is always successful. The current
> patch will add a ciheck for existance of the DMA IP and allow the
> DMA initialization.
>
> Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
> ---
>  drivers/mmc/host/dw_mmc.c |   15 +++++++++++++--
>  1 files changed, 13 insertions(+), 2 deletions(-)

Ok, this version looks better.

Acked-by: Will Newton <will.newton@imgtec.com>
Chris Ball June 20, 2012, 6:07 a.m. UTC | #2
Hi Girish,

On Tue, Jun 12 2012, Will Newton wrote:
> On Tue, Jun 12, 2012 at 10:58 AM, Girish K S
> <girish.shivananjappa@linaro.org> wrote:
>> In the Current dwmmc driver there is support for selecting IDMAC from
>> the menu config option. If the support for IDMAC is enabled in the menu
>> config and Hardware configuration register's DMA_INTERFACE field is 0.
>> Still the driver will try to do the DMA initialization.
>>
>> The dw_mci_idmac_init function currently implemented returns only success
>> indicating that the DMA initialization is always successful. The current
>> patch will add a ciheck for existance of the DMA IP and allow the
>> DMA initialization.
>>
>> Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
>> ---
>>  drivers/mmc/host/dw_mmc.c |   15 +++++++++++++--
>>  1 files changed, 13 insertions(+), 2 deletions(-)
>
> Ok, this version looks better.
>
> Acked-by: Will Newton <will.newton@imgtec.com>

A quick point of patch etiquette:  you used a subject line of [RESEND
PATCH], but this isn't a resend of a patch.  A resend is when you're
resending a copy of a patch *without any modifications* because it was
ignored, or you'd like more discussion, or you're adding new people to
the e-mail thread.

This is a v2 of a patch, because you made changes since the last patch.
The right way to signify that is with [PATCH v2] in the Subject line,
and a section just below the "---" after the Signed-off-by that explains
what you changed.  E.g.:

=======
Subject: [PATCH v2] mmc: dw_mmc: Add check for IDMAC configuration

In the Current dwmmc driver there is support for selecting IDMAC from
the menu config option. If the support for IDMAC is enabled in the menu
config and Hardware configuration register's DMA_INTERFACE field is 0.
Still the driver will try to do the DMA initialization.

The dw_mci_idmac_init function currently implemented returns only success
indicating that the DMA initialization is always successful. The current
patch will add a ciheck for existance of the DMA IP and allow the
DMA initialization.

Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
---
Changes since v1:
 * Protect against configuration mistakes by falling back to PIO if
   CONFIG_MMC_DW_IDMAC=y but the hardware has no IDMAC support.
 
 drivers/mmc/host/dw_mmc.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
=======

I've applied the patch to mmc-next for 3.6 now.

Thanks,

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index cbd8f3d..c485d1b 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -405,11 +405,23 @@  static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len)
 static int dw_mci_idmac_init(struct dw_mci *host)
 {
 	struct idmac_desc *p;
-	int i;
+	int i, dma_support;
 
 	/* Number of descriptors in the ring buffer */
 	host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
 
+	/* Check if Hardware Configuration Register has support for DMA */
+	dma_support = (mci_readl(host, HCON) >> 16) & 0x3;
+
+	if (!dma_support || dma_support > 2) {
+		dev_err(&host->dev,
+			"Host Controller does not support IDMA Tx.\n");
+		host->dma_ops = NULL;
+		return -ENODEV;
+	}
+
+	dev_info(&host->dev, "Using internal DMA controller.\n");
+
 	/* Forward link the descriptor list */
 	for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
 		p->des3 = host->sg_dma + (sizeof(struct idmac_desc) * (i + 1));
@@ -1871,7 +1883,6 @@  static void dw_mci_init_dma(struct dw_mci *host)
 	/* Determine which DMA interface to use */
 #ifdef CONFIG_MMC_DW_IDMAC
 	host->dma_ops = &dw_mci_idmac_ops;
-	dev_info(&host->dev, "Using internal DMA controller.\n");
 #endif
 
 	if (!host->dma_ops)