[PATCH] mmc:sdhci: restore the enabled dma when do reset all

Subsystems: multimedia card (mmc), secure digital (sd) and sdio subsystem, secure digital host controller interface (sdhci) driver, the rest

STALE5334d

3 messages, 3 authors, 2011-12-29 · open the first message on its own page

[PATCH] mmc:sdhci: restore the enabled dma when do reset all

From: Shaohui Xie <hidden>
Date: 2011-12-28 10:30:30

If dma is enabled, it'll be cleared when reset all is performed, this can
be observed on some platforms, such as P2041 which has a version 2.3
controller, but platform like P4080 which has a version 2.2 controller,
does not suffer this, so we will check if the dma is enabled, we should
restore it after reset all.

Signed-off-by: Shaohui Xie <redacted>
---
based on http://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git,
branch 'for-linus'.

 drivers/mmc/host/sdhci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 19ed580..22033c3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -29,6 +29,7 @@
 #include <linux/mmc/host.h>
 
 #include "sdhci.h"
+#include "sdhci-esdhc.h"
 
 #define DRIVER_NAME "sdhci"
 
@@ -176,6 +177,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 {
 	unsigned long timeout;
 	u32 uninitialized_var(ier);
+	u32 uninitialized_var(dma);
 
 	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
 		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
@@ -189,6 +191,8 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	if (host->ops->platform_reset_enter)
 		host->ops->platform_reset_enter(host, mask);
 
+	dma = sdhci_readl(host, ESDHC_DMA_SYSCTL);
+
 	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
 
 	if (mask & SDHCI_RESET_ALL)
@@ -214,6 +218,9 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 
 	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
 		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
+
+	if ((dma & ESDHC_DMA_SNOOP) && (mask & SDHCI_RESET_ALL))
+		sdhci_writel(host, dma, ESDHC_DMA_SYSCTL);
 }
 
 static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);
-- 
1.6.4

Re: [PATCH] mmc:sdhci: restore the enabled dma when do reset all

From: Adrian Hunter <adrian.hunter@intel.com>
Date: 2011-12-28 11:52:35

On 28/12/11 11:41, Shaohui Xie wrote:
quoted hunk
If dma is enabled, it'll be cleared when reset all is performed, this can
be observed on some platforms, such as P2041 which has a version 2.3
controller, but platform like P4080 which has a version 2.2 controller,
does not suffer this, so we will check if the dma is enabled, we should
restore it after reset all.

Signed-off-by: Shaohui Xie <redacted>
---
based on http://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git,
branch 'for-linus'.

 drivers/mmc/host/sdhci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 19ed580..22033c3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -29,6 +29,7 @@
 #include <linux/mmc/host.h>
 
 #include "sdhci.h"
+#include "sdhci-esdhc.h"
 
 #define DRIVER_NAME "sdhci"
 
@@ -176,6 +177,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 {
 	unsigned long timeout;
 	u32 uninitialized_var(ier);
+	u32 uninitialized_var(dma);
 
 	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
 		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) &
@@ -189,6 +191,8 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	if (host->ops->platform_reset_enter)
 		host->ops->platform_reset_enter(host, mask);
 
+	dma = sdhci_readl(host, ESDHC_DMA_SYSCTL);

You must not access eSDHC-specific registers in generic SDHCI code

quoted hunk
+
 	sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);
 
 	if (mask & SDHCI_RESET_ALL)
@@ -214,6 +218,9 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
 
 	if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET)
 		sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK, ier);
+
+	if ((dma & ESDHC_DMA_SNOOP) && (mask & SDHCI_RESET_ALL))
+		sdhci_writel(host, dma, ESDHC_DMA_SYSCTL);
 }
 
 static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);

RE: [PATCH] mmc:sdhci: restore the enabled dma when do reset all

From: Xie Shaohui-B21989 <hidden>
Date: 2011-12-29 09:05:28

-----Original Message-----
From: Adrian Hunter [mailto:adrian.hunter@intel.com]
Sent: Wednesday, December 28, 2011 7:43 PM
To: Xie Shaohui-B21989
Cc: linux-mmc@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] mmc:sdhci: restore the enabled dma when do reset all

On 28/12/11 11:41, Shaohui Xie wrote:
quoted
If dma is enabled, it'll be cleared when reset all is performed, this
can be observed on some platforms, such as P2041 which has a version
2.3 controller, but platform like P4080 which has a version 2.2
controller, does not suffer this, so we will check if the dma is
enabled, we should restore it after reset all.

Signed-off-by: Shaohui Xie <redacted>
---
based on http://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git,
branch 'for-linus'.

 drivers/mmc/host/sdhci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
19ed580..22033c3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -29,6 +29,7 @@
 #include <linux/mmc/host.h>

 #include "sdhci.h"
+#include "sdhci-esdhc.h"

 #define DRIVER_NAME "sdhci"
@@ -176,6 +177,7 @@ static void sdhci_reset(struct sdhci_host *host,
u8 mask)  {
 	unsigned long timeout;
 	u32 uninitialized_var(ier);
+	u32 uninitialized_var(dma);

 	if (host->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) {
 		if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & @@ -189,6
+191,8 @@
quoted
static void sdhci_reset(struct sdhci_host *host, u8 mask)
 	if (host->ops->platform_reset_enter)
 		host->ops->platform_reset_enter(host, mask);

+	dma =3D sdhci_readl(host, ESDHC_DMA_SYSCTL);

You must not access eSDHC-specific registers in generic SDHCI code
[Xie Shaohui] OK. Thank you, I'll call the wrapper API here.


Best Regards,=20
Shaohui Xie
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help