linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: mmci: Bugfixes for SDIO
@ 2011-10-24 13:50 Ulf Hansson
  2011-10-24 13:50 ` [PATCH 1/2] mmc: mmci: Prepare for SDIO before setting up DMA job Ulf Hansson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ulf Hansson @ 2011-10-24 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

This patchserie fixes some SDIO related issues for the mmci host driver.

Previously these patches were included in the patch serie called
"mmc: mmci: Improvements and bugfixes for SDIO", which now has been
split up.

Stefan Nilsson XK (1):
  mmc: mmci: Fix incorrect handling of HW flow control for SDIO

Ulf Hansson (1):
  mmc: mmci: Prepare for SDIO before setting up DMA job

 drivers/mmc/host/mmci.c |   50 ++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

-- 
1.7.5.4

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

* [PATCH 1/2] mmc: mmci: Prepare for SDIO before setting up DMA job
  2011-10-24 13:50 [PATCH 0/2] mmc: mmci: Bugfixes for SDIO Ulf Hansson
@ 2011-10-24 13:50 ` Ulf Hansson
  2011-10-24 13:50 ` [PATCH 2/2] mmc: mmci: Fix incorrect handling of HW flow control for SDIO Ulf Hansson
  2011-11-04 14:34 ` [PATCH 0/2] mmc: mmci: Bugfixes " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2011-10-24 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

Move the SDIO preparation to be done before the DMA job is setup.
This makes it possible to do DMA for SDIO transfers as well as the
earlier supported pio mode.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
---
 drivers/mmc/host/mmci.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 50b5f99..1b73177 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -604,6 +604,11 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 	if (data->flags & MMC_DATA_READ)
 		datactrl |= MCI_DPSM_DIRECTION;
 
+	/* The ST Micro variants has a special bit to enable SDIO */
+	if (variant->sdio && host->mmc->card)
+		if (mmc_card_sdio(host->mmc->card))
+			datactrl |= MCI_ST_DPSM_SDIOEN;
+
 	/*
 	 * Attempt to use DMA operation mode, if this
 	 * should fail, fall back to PIO mode
@@ -632,11 +637,6 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 		irqmask = MCI_TXFIFOHALFEMPTYMASK;
 	}
 
-	/* The ST Micro variants has a special bit to enable SDIO */
-	if (variant->sdio && host->mmc->card)
-		if (mmc_card_sdio(host->mmc->card))
-			datactrl |= MCI_ST_DPSM_SDIOEN;
-
 	writel(datactrl, base + MMCIDATACTRL);
 	writel(readl(base + MMCIMASK0) & ~MCI_DATAENDMASK, base + MMCIMASK0);
 	mmci_set_mask1(host, irqmask);
-- 
1.7.5.4

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

* [PATCH 2/2] mmc: mmci: Fix incorrect handling of HW flow control for SDIO
  2011-10-24 13:50 [PATCH 0/2] mmc: mmci: Bugfixes for SDIO Ulf Hansson
  2011-10-24 13:50 ` [PATCH 1/2] mmc: mmci: Prepare for SDIO before setting up DMA job Ulf Hansson
@ 2011-10-24 13:50 ` Ulf Hansson
  2011-11-04 14:34 ` [PATCH 0/2] mmc: mmci: Bugfixes " Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2011-10-24 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>

For data writes smaller <= 8 bytes (only SDIO case), HW flow control was
disabled but never re-enabled again. This meant that a following large read
request would randomly give buffer overrun errors.

Moreover HW flow control is not needed for transfers that fits in the
FIFO of PL18x. Thus it is disabled for write operations <= the FIFO size.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
---
 drivers/mmc/host/mmci.c |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 1b73177..07d1378 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -606,9 +606,32 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 
 	/* The ST Micro variants has a special bit to enable SDIO */
 	if (variant->sdio && host->mmc->card)
-		if (mmc_card_sdio(host->mmc->card))
+		if (mmc_card_sdio(host->mmc->card)) {
+			/*
+			 * The ST Micro variants has a special bit
+			 * to enable SDIO.
+			 */
 			datactrl |= MCI_ST_DPSM_SDIOEN;
 
+			/*
+			 * The ST Micro variant for SDIO transfer sizes
+			 * less then or equal to 8 bytes needs to have clock
+			 * H/W flow control disabled. Since flow control is
+			 * not really needed for anything that fits in the
+			 * FIFO, we can disable it for any write smaller
+			 * than the FIFO size.
+			 */
+			if ((host->size <= variant->fifosize) &&
+			    (data->flags & MMC_DATA_WRITE))
+				writel(readl(host->base + MMCICLOCK) &
+				       ~variant->clkreg_enable,
+				       host->base + MMCICLOCK);
+			else
+				writel(readl(host->base + MMCICLOCK) |
+				       variant->clkreg_enable,
+				       host->base + MMCICLOCK);
+		}
+
 	/*
 	 * Attempt to use DMA operation mode, if this
 	 * should fail, fall back to PIO mode
@@ -807,23 +830,6 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
 		count = min(remain, maxcnt);
 
 		/*
-		 * The ST Micro variant for SDIO transfer sizes
-		 * less then 8 bytes should have clock H/W flow
-		 * control disabled.
-		 */
-		if (variant->sdio &&
-		    mmc_card_sdio(host->mmc->card)) {
-			if (count < 8)
-				writel(readl(host->base + MMCICLOCK) &
-					~variant->clkreg_enable,
-					host->base + MMCICLOCK);
-			else
-				writel(readl(host->base + MMCICLOCK) |
-					variant->clkreg_enable,
-					host->base + MMCICLOCK);
-		}
-
-		/*
 		 * SDIO especially may want to send something that is
 		 * not divisible by 4 (as opposed to card sectors
 		 * etc), and the FIFO only accept full 32-bit writes.
-- 
1.7.5.4

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

* [PATCH 0/2] mmc: mmci: Bugfixes for SDIO
  2011-10-24 13:50 [PATCH 0/2] mmc: mmci: Bugfixes for SDIO Ulf Hansson
  2011-10-24 13:50 ` [PATCH 1/2] mmc: mmci: Prepare for SDIO before setting up DMA job Ulf Hansson
  2011-10-24 13:50 ` [PATCH 2/2] mmc: mmci: Fix incorrect handling of HW flow control for SDIO Ulf Hansson
@ 2011-11-04 14:34 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2011-11-04 14:34 UTC (permalink / raw)
  To: linux-arm-kernel

Is this patch and it's patchserie considered OK?

-Russell, patches are available in your patchtracker.

Br
Ulf Hansson

Ulf HANSSON wrote:
> This patchserie fixes some SDIO related issues for the mmci host driver.
> 
> Previously these patches were included in the patch serie called
> "mmc: mmci: Improvements and bugfixes for SDIO", which now has been
> split up.
> 
> Stefan Nilsson XK (1):
>   mmc: mmci: Fix incorrect handling of HW flow control for SDIO
> 
> Ulf Hansson (1):
>   mmc: mmci: Prepare for SDIO before setting up DMA job
> 
>  drivers/mmc/host/mmci.c |   50 ++++++++++++++++++++++++++--------------------
>  1 files changed, 28 insertions(+), 22 deletions(-)
> 

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

end of thread, other threads:[~2011-11-04 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 13:50 [PATCH 0/2] mmc: mmci: Bugfixes for SDIO Ulf Hansson
2011-10-24 13:50 ` [PATCH 1/2] mmc: mmci: Prepare for SDIO before setting up DMA job Ulf Hansson
2011-10-24 13:50 ` [PATCH 2/2] mmc: mmci: Fix incorrect handling of HW flow control for SDIO Ulf Hansson
2011-11-04 14:34 ` [PATCH 0/2] mmc: mmci: Bugfixes " Ulf Hansson

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).