* [PATCH 1/2] mmc: tmio: fix a recently introduced bug in DMA code
2011-07-14 16:39 [PATCH 0/2] mmc: tmio: two bug-fixes Guennadi Liakhovetski
@ 2011-07-14 16:39 ` Guennadi Liakhovetski
2011-07-14 16:39 ` [PATCH 2/2] mmc: tmio: fix a deadlock Guennadi Liakhovetski
2011-07-14 19:27 ` [PATCH 0/2] mmc: tmio: two bug-fixes Chris Ball
2 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2011-07-14 16:39 UTC (permalink / raw)
To: linux-mmc
Cc: linux-sh, Magnus Damm, Rafael J. Wysocki, Chris Ball, Ian Molton,
Simon Horman
A recent commit "mmc: tmio: Share register access functions" has swapped
arguments of a macro and broken DMA with TMIO MMC. This patch fixes the
arguments back.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/mmc/host/tmio_mmc_dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index f24a029..7e86662 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -26,7 +26,7 @@ static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{
#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
/* Switch DMA mode on or off - SuperH specific? */
- sd_ctrl_write16(host, enable ? 2 : 0, CTL_DMA_ENABLE);
+ sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
#endif
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] mmc: tmio: fix a deadlock
2011-07-14 16:39 [PATCH 0/2] mmc: tmio: two bug-fixes Guennadi Liakhovetski
2011-07-14 16:39 ` [PATCH 1/2] mmc: tmio: fix a recently introduced bug in DMA code Guennadi Liakhovetski
@ 2011-07-14 16:39 ` Guennadi Liakhovetski
2011-07-14 19:27 ` [PATCH 0/2] mmc: tmio: two bug-fixes Chris Ball
2 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2011-07-14 16:39 UTC (permalink / raw)
To: linux-mmc
Cc: linux-sh, Magnus Damm, Rafael J. Wysocki, Chris Ball, Ian Molton,
Simon Horman
Currently the tmio-mmc driver contains a recursive runtime PM method
invocation, which leads to a deadlock on a mutex. Avoid it by taking
care not to request DMA too early.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/mmc/host/tmio_mmc.h | 5 +++++
drivers/mmc/host/tmio_mmc_dma.c | 5 ++++-
drivers/mmc/host/tmio_mmc_pio.c | 4 ++--
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 551d1ef..60ba335 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -109,6 +109,7 @@ static inline void tmio_mmc_kunmap_atomic(struct scatterlist *sg,
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);
+void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable);
void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);
void tmio_mmc_release_dma(struct tmio_mmc_host *host);
#else
@@ -117,6 +118,10 @@ static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
{
}
+static inline void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
+{
+}
+
static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
struct tmio_mmc_data *pdata)
{
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 7e86662..2aa616d 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -22,8 +22,11 @@
#define TMIO_MMC_MIN_DMA_LEN 8
-static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
+void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{
+ if (!host->chan_tx || !host->chan_rx)
+ return;
+
#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
/* Switch DMA mode on or off - SuperH specific? */
sd_ctrl_write16(host, CTL_DMA_ENABLE, enable ? 2 : 0);
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 221ffb7..1f16357 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -984,7 +984,7 @@ int tmio_mmc_host_resume(struct device *dev)
if (host->pm_global) {
/* Runtime PM resume callback didn't run */
tmio_mmc_reset(host);
- tmio_mmc_request_dma(host, host->pdata);
+ tmio_mmc_enable_dma(host, true);
host->pm_global = false;
}
@@ -1007,7 +1007,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
struct tmio_mmc_data *pdata = host->pdata;
tmio_mmc_reset(host);
- tmio_mmc_request_dma(host, host->pdata);
+ tmio_mmc_enable_dma(host, true);
if (pdata->power) {
/* Only entered after a card-insert interrupt */
--
1.7.2.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 0/2] mmc: tmio: two bug-fixes
2011-07-14 16:39 [PATCH 0/2] mmc: tmio: two bug-fixes Guennadi Liakhovetski
2011-07-14 16:39 ` [PATCH 1/2] mmc: tmio: fix a recently introduced bug in DMA code Guennadi Liakhovetski
2011-07-14 16:39 ` [PATCH 2/2] mmc: tmio: fix a deadlock Guennadi Liakhovetski
@ 2011-07-14 19:27 ` Chris Ball
2011-07-15 8:46 ` Guennadi Liakhovetski
2 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2011-07-14 19:27 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-mmc, linux-sh, Magnus Damm, Rafael J. Wysocki, Ian Molton,
Simon Horman
Hi Guennadi,
On Thu, Jul 14 2011, Guennadi Liakhovetski wrote:
> There go two more bug-fixes for tmio on top of my earlier patches from
> today, so, should still be easy enough to trace. So, to pull them
> together, the previous ones were
>
> [PATCH v3] mmc: tmio: fix recursive spinlock, don't schedule with
> interrupts disabled
> [PATCH v3] mmc: tmio: maximize power saving
>
> And now follow
>
> [PATCH 1/2] mmc: tmio: fix a recently introduced bug in DMA code
> [PATCH 2/2] mmc: tmio: fix a deadlock
Pushed these four plus "mmc: sh_mmcif: maximize power saving" to
mmc-next for 3.1. Thanks!
By the way, feel free to send me a MAINTAINERS update taking over
TMIO if you'd like to; you've been doing the work. :-)
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread