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 10/21] [MMC] Avoid sdhci DMA boundaries
Date: Fri, 23 Jun 2006 18:03:51 +0200	[thread overview]
Message-ID: <449C10E7.8010606@drzeus.cx> (raw)
In-Reply-To: <20060621142608.8857.96591.stgit@poseidon.drzeus.cx>

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

New version to fix conflicts by recent merge.


[-- Attachment #2: sdhci-dma-bounds.patch --]
[-- Type: text/x-patch, Size: 2215 bytes --]

[MMC] Avoid sdhci DMA boundaries

The sdhci controllers will issue an interrupt when a configurable number of
bytes have been transfered using DMA. The purpose is to handle multiple,
scattered memory pages.

Unfortunately, it requires that all transfers are completely aligned to
memory pages, which we cannot guarantee. So we just disable the function.

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

 drivers/mmc/sdhci.c |   13 +++++++++----
 drivers/mmc/sdhci.h |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 2636cf5..f8c02ee 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -326,6 +326,9 @@ static void sdhci_prepare_data(struct sd
 	DBG("tsac %d ms nsac %d clk\n",
 		data->timeout_ns / 1000000, data->timeout_clks);
 
+	/* Sanity checks */
+	BUG_ON((1 << data->blksz_bits) * data->blocks > 524288);
+
 	/* timeout in us */
 	target_timeout = data->timeout_ns / 1000 +
 		data->timeout_clks / host->clock;
@@ -375,7 +378,9 @@ static void sdhci_prepare_data(struct sd
 		host->remain = host->cur_sg->length;
 	}
 
-	writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE);
+	/* We do not handle DMA boundaries, so set it to max (512 KiB) */
+	writew(SDHCI_MAKE_BLKSZ(7, data->blksz),
+		host->ioaddr + SDHCI_BLOCK_SIZE);
 	writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT);
 }
 
@@ -1188,10 +1193,10 @@ static int __devinit sdhci_probe_slot(st
 	mmc->max_phys_segs = 16;
 
 	/*
-	 * Maximum number of sectors in one transfer. Limited by sector
-	 * count register.
+	 * Maximum number of sectors in one transfer. Limited by DMA boundary
+	 * size (512KiB), which means (512 KiB/512=) 1024 entries.
 	 */
-	mmc->max_sectors = 0x3FFF;
+	mmc->max_sectors = 1024;
 
 	/*
 	 * Maximum segment size. Could be one segment with the maximum number
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h
index f8df28f..8ed2a89 100644
--- a/drivers/mmc/sdhci.h
+++ b/drivers/mmc/sdhci.h
@@ -23,6 +23,7 @@ #define  PCI_SLOT_INFO_FIRST_BAR_MASK	0x
 #define SDHCI_DMA_ADDRESS	0x00
 
 #define SDHCI_BLOCK_SIZE	0x04
+#define  SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))
 
 #define SDHCI_BLOCK_COUNT	0x06
 

  reply	other threads:[~2006-06-23 16:03 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
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 [this message]
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=449C10E7.8010606@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