public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus-list@drzeus.cx>
To: rmk+lkml@arm.linux.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/21] [MMC] Correct register order
Date: Fri, 23 Jun 2006 18:02:55 +0200	[thread overview]
Message-ID: <449C10AF.60105@drzeus.cx> (raw)
In-Reply-To: <20060621142557.8857.26186.stgit@poseidon.drzeus.cx>

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

New version to fix conflicts by recent merge.


[-- Attachment #2: sdhci-reg-order.patch --]
[-- Type: text/x-patch, Size: 2494 bytes --]

[MMC] Correct register order

The sdhci specification states that some registers must be written to in a
specific order.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---

 drivers/mmc/sdhci.c |   44 +++++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 877226e..4457881 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -270,16 +270,13 @@ static void sdhci_transfer_pio(struct sd
 
 static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
 {
-	u16 mode;
 	u8 count;
 	unsigned target_timeout, current_timeout;
 
 	WARN_ON(host->data);
 
-	if (data == NULL) {
-		writew(0, host->ioaddr + SDHCI_TRANSFER_MODE);
+	if (data == NULL)
 		return;
-	}
 
 	DBG("blksz %04x blks %04x flags %08x\n",
 		data->blksz, data->blocks, data->flags);
@@ -317,19 +314,6 @@ static void sdhci_prepare_data(struct sd
 
 	writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
 
-	mode = SDHCI_TRNS_BLK_CNT_EN;
-	if (data->blocks > 1)
-		mode |= SDHCI_TRNS_MULTI;
-	if (data->flags & MMC_DATA_READ)
-		mode |= SDHCI_TRNS_READ;
-	if (host->flags & SDHCI_USE_DMA)
-		mode |= SDHCI_TRNS_DMA;
-
-	writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
-
-	writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE);
-	writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT);
-
 	if (host->flags & SDHCI_USE_DMA) {
 		int count;
 
@@ -347,6 +331,30 @@ static void sdhci_prepare_data(struct sd
 		host->offset = 0;
 		host->remain = host->cur_sg->length;
 	}
+
+	writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE);
+	writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT);
+}
+
+static void sdhci_set_transfer_mode(struct sdhci_host *host,
+	struct mmc_data *data)
+{
+	u16 mode;
+
+	WARN_ON(host->data);
+
+	if (data == NULL)
+		return;
+
+	mode = SDHCI_TRNS_BLK_CNT_EN;
+	if (data->blocks > 1)
+		mode |= SDHCI_TRNS_MULTI;
+	if (data->flags & MMC_DATA_READ)
+		mode |= SDHCI_TRNS_READ;
+	if (host->flags & SDHCI_USE_DMA)
+		mode |= SDHCI_TRNS_DMA;
+
+	writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
 }
 
 static void sdhci_finish_data(struct sdhci_host *host)
@@ -447,6 +455,8 @@ static void sdhci_send_command(struct sd
 
 	writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT);
 
+	sdhci_set_transfer_mode(host, cmd->data);
+
 	if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
 		printk(KERN_ERR "%s: Unsupported response type! "
 			"Please report this to " BUGMAIL ".\n",

  reply	other threads:[~2006-06-23 16:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 14:23 [PATCH 00/21] Series short description Pierre Ossman
2006-06-21 14:25 ` [PATCH 01/21] [MMC] Check SDHCI base clock Pierre Ossman
2006-06-21 14:25 ` [PATCH 02/21] [MMC] Print device id Pierre Ossman
2006-06-21 14:25 ` [PATCH 03/21] [MMC] Support for multiple voltages Pierre Ossman
2006-06-21 14:25 ` [PATCH 04/21] [MMC] Fix timeout loops in sdhci Pierre Ossman
2006-06-21 14:25 ` [PATCH 05/21] [MMC] Fix sdhci reset timeout Pierre Ossman
2006-06-21 14:25 ` [PATCH 06/21] [MMC] Proper timeout handling Pierre Ossman
2006-06-21 14:25 ` [PATCH 07/21] [MMC] Correct register order Pierre Ossman
2006-06-23 16:02   ` Pierre Ossman [this message]
2006-06-21 14:26 ` [PATCH 08/21] [MMC] Fix interrupt handling Pierre Ossman
2006-06-21 14:26 ` [PATCH 09/21] [MMC] Fix sdhci PIO routines Pierre Ossman
2006-06-21 14:26 ` [PATCH 10/21] [MMC] Avoid sdhci DMA boundaries Pierre Ossman
2006-06-23 16:03   ` Pierre Ossman
2006-06-21 14:26 ` [PATCH 11/21] [MMC] Test for invalid block size Pierre Ossman
2006-06-21 14:26 ` [PATCH 12/21] [MMC] Check only relevant inhibit bits Pierre Ossman
2006-06-21 14:26 ` [PATCH 13/21] [MMC] Check controller version Pierre Ossman
2006-06-21 14:26 ` [PATCH 14/21] [MMC] Reset sdhci controller early Pierre Ossman
2006-06-21 14:26 ` [PATCH 15/21] [MMC] More DMA capabilities tests Pierre Ossman
2006-06-21 14:26 ` [PATCH 16/21] [MMC] Support controller specific quirks Pierre Ossman
2006-06-21 14:26 ` [PATCH 17/21] [MMC] Version bump sdhci Pierre Ossman
2006-06-21 14:26 ` [PATCH 18/21] [PCI] Add SDHCI controller ids Pierre Ossman
2006-06-21 14:26 ` [PATCH 19/21] [MMC] Quirk for broken reset Pierre Ossman
2006-06-21 14:26 ` [PATCH 20/21] [MMC] Force DMA on some controllers Pierre Ossman
2006-06-21 14:26 ` [PATCH 21/21] [MMC] Remove duplicate error message Pierre Ossman
2006-06-27 19:06 ` [PATCH 00/21] Series short description Pierre Ossman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=449C10AF.60105@drzeus.cx \
    --to=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox