linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: tmio: Don't access hardware registers after stopping clocks
@ 2012-06-12 12:57 Laurent Pinchart
  2012-06-12 13:31 ` Guennadi Liakhovetski
  2012-06-14 11:12 ` Magnus Damm
  0 siblings, 2 replies; 15+ messages in thread
From: Laurent Pinchart @ 2012-06-12 12:57 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: linux-mmc, linux-sh

The tmio_mmc_set_ios() function configures the MMC power, clock and bus
width. When the MMC controller gets powered off, runtime PM switches the
MSTP clock off. Writing to to CTL_SD_MEM_CARD_OPT register afterwards
fails and prints an error message to the kernel log.

As configuring the bus width is pointless when the interface gets
powered down, skip the operation when power is off.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/mmc/host/tmio_mmc_pio.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 9a7996a..de1226d 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -816,13 +816,15 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		tmio_mmc_clk_stop(host);
 	}
 
-	switch (ios->bus_width) {
-	case MMC_BUS_WIDTH_1:
-		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
-	break;
-	case MMC_BUS_WIDTH_4:
-		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
-	break;
+	if (host->power) {
+		switch (ios->bus_width) {
+		case MMC_BUS_WIDTH_1:
+			sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
+		break;
+		case MMC_BUS_WIDTH_4:
+			sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
+		break;
+		}
 	}
 
 	/* Let things settle. delay taken from winCE driver */
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-06-19  9:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 12:57 [PATCH] mmc: tmio: Don't access hardware registers after stopping clocks Laurent Pinchart
2012-06-12 13:31 ` Guennadi Liakhovetski
2012-06-12 21:28   ` Laurent Pinchart
2012-06-14 11:12 ` Magnus Damm
2012-06-14 19:12   ` Laurent Pinchart
2012-06-14 19:37     ` Rafael J. Wysocki
2012-06-14 20:34       ` Laurent Pinchart
2012-06-14 21:48         ` Rafael J. Wysocki
2012-06-15 10:03           ` Rafael J. Wysocki
2012-06-15 10:17             ` Laurent Pinchart
2012-06-15 19:08               ` Rafael J. Wysocki
2012-06-15  0:47     ` Magnus Damm
2012-06-15  7:09       ` Guennadi Liakhovetski
2012-06-19  6:53         ` Magnus Damm
2012-06-19  9:34           ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).