From: James Hogan <james.hogan@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: Chris Ball <cjb@laptop.org>, Will Newton <will.newton@imgtec.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Matt Fleming <matt@console-pimps.org>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
james@albanarts.com
Subject: [PATCH 1/6] mmc: dw_mmc: clear TXDR/RXDR ints before enabling
Date: Fri, 24 Jun 2011 13:54:06 +0100 [thread overview]
Message-ID: <4E0488EE.5040706@imgtec.com> (raw)
In-Reply-To: <4E0488A9.6050109@imgtec.com>
DMA is only used for transactions exceeding a certain length, otherwise
PIO is used. The TXDR and RXDR interrupts are masked when in DMA mode
but still fire. When switching to PIO mode (e.g. to get SCR field when
an SD card is inserted) these interrupts are not cleared and so they
trigger the ISR as soon as they are unmasked. If the previous DMA did a
write, then the ISR will handle the TXDR interrupt even if the
transaction is a read, completing the transaction without modifying the
read buffer.
This is fixed primarily by clearing these two interrupts before
unmasking them when setting up PIO mode, and also by making the ISR more
robust by only handling TXDR/RXDR in the correct read/write direction.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
drivers/mmc/host/dw_mmc.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 22be372..08c0592 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -497,6 +497,7 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
else
host->dir_status = DW_MCI_SEND_STATUS;
+ mci_writel(host, RINTSTS, SDMMC_INT_TXDR | SDMMC_INT_RXDR);
temp = mci_readl(host, INTMASK);
temp |= SDMMC_INT_TXDR | SDMMC_INT_RXDR;
mci_writel(host, INTMASK, temp);
@@ -1230,13 +1231,13 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
if (pending & SDMMC_INT_RXDR) {
mci_writel(host, RINTSTS, SDMMC_INT_RXDR);
- if (host->sg)
+ if (host->dir_status == DW_MCI_RECV_STATUS && host->sg)
dw_mci_read_data_pio(host);
}
if (pending & SDMMC_INT_TXDR) {
mci_writel(host, RINTSTS, SDMMC_INT_TXDR);
- if (host->sg)
+ if (host->dir_status == DW_MCI_SEND_STATUS && host->sg)
dw_mci_write_data_pio(host);
}
--
1.7.2.3
next prev parent reply other threads:[~2011-06-24 13:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 12:52 [PATCH 0/6] mmc: dw_mmc: misc fixes and improvements James Hogan
2011-06-24 12:54 ` James Hogan [this message]
2011-06-24 12:55 ` [PATCH 2/6] mmc: dw_mmc: fix race with request and removal James Hogan
2011-06-24 12:55 ` [PATCH 3/6] mmc: dw_mmc: convert card tasklet to workqueue James Hogan
2011-06-24 12:56 ` [PATCH 4/6] mmc: dw_mmc: brackets in register access macros James Hogan
2011-06-24 12:57 ` [PATCH 5/6] mmc: dw_mmc: don't hard code fifo depth, fix usage James Hogan
2011-06-24 12:57 ` [PATCH 6/6] mmc: dw_mmc: handle unaligned buffers and sizes James Hogan
2011-06-24 14:53 ` [PATCH 0/6] mmc: dw_mmc: misc fixes and improvements Will Newton
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=4E0488EE.5040706@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=cjb@laptop.org \
--cc=james@albanarts.com \
--cc=jh80.chung@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=will.newton@imgtec.com \
/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