From: Marek Vasut <marek.vasut@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: drzeus-mmc@drzeus.cx
Subject: [PATCH] fix misalignment in pxamci
Date: Sat, 5 Jul 2008 02:19:52 +0200 [thread overview]
Message-ID: <200807050219.52218.marek.vasut@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Hi,
Philipp Zabel finally made the pxamci issue clear. It turned out, that pxamci
needs the DMA destination address to be aligned to 8 bytes. In some cases it
happened, that the address was aligned to 4 bytes causing controller to
incorrectly transfer data (and resulting into error like "mmc0: unrecognised
SCR structure version 1"). The following patch allows to debug this issue and
moreover fixes it by moving one 4 byte entry of mmc_card structure, aligning
the DMA destination back to 8 bytes.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
[-- Attachment #2: pxamci-lkml.patch --]
[-- Type: text/x-diff, Size: 1766 bytes --]
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 65210fc..75b2810 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -153,6 +153,13 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
if (length & 31 && !(data->flags & MMC_DATA_READ))
host->sg_cpu[i].dcmd |= DCMD_ENDIRQEN;
if (data->flags & MMC_DATA_READ) {
+#ifdef CONFIG_MMC_DEBUG
+ /* we need destination address to be aligned to 8 bytes
+ here, if it isn't, we have serious problem */
+ if (sg_dma_address(&data->sg[i]) % 8)
+ pr_debug("%s:%i Misaligned DMA destination\n",
+ __FILE__, __LINE__);
+#endif
host->sg_cpu[i].dsadr = host->res->start + MMC_RXFIFO;
host->sg_cpu[i].dtadr = sg_dma_address(&data->sg[i]);
} else {
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 0d508ac..cb76462 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -89,6 +89,7 @@ struct mmc_card {
#define MMC_TYPE_MMC 0 /* MMC card */
#define MMC_TYPE_SD 1 /* SD card */
#define MMC_TYPE_SDIO 2 /* SDIO card */
+ unsigned int sdio_funcs; /* number of SDIO functions */
unsigned int state; /* (our) card state */
#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
#define MMC_STATE_READONLY (1<<1) /* card is read-only */
@@ -104,7 +105,6 @@ struct mmc_card {
struct sd_scr scr; /* extra SD information */
struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
- unsigned int sdio_funcs; /* number of SDIO functions */
struct sdio_cccr cccr; /* common card info */
struct sdio_cis cis; /* common tuple info */
struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */
next reply other threads:[~2008-07-05 0:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-05 0:19 Marek Vasut [this message]
2008-07-05 8:21 ` [PATCH] fix misalignment in pxamci pHilipp Zabel
2008-07-28 16:23 ` Uli Luckas
2008-07-29 6:30 ` pHilipp Zabel
2008-07-29 7:55 ` Marek Vasut
2008-07-29 11:09 ` 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=200807050219.52218.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=drzeus-mmc@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.