* [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk
@ 2014-12-05 9:58 Alessio Igor Bogani
2014-12-05 12:07 ` Dong Aisheng
0 siblings, 1 reply; 5+ messages in thread
From: Alessio Igor Bogani @ 2014-12-05 9:58 UTC (permalink / raw)
To: Chris Ball; +Cc: linux-mmc, Alessio Igor Bogani
The commit 0718e59ae259 ("mmc: sdhci: move FSL ESDHC reset handling quirk into
esdhc code") states that Freescale esdhc is the only controller which needs
the interrupt registers restored after a reset. So it moves
SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET quirk handling code into the
esdhc-imx driver only. Unfortunately the same controller is used in
other boards which use the of-esdhc driver instead (like powerpc P2020).
This patch partially reverts the above mentioned commit and make
SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET dependency explicit in both drivers.
Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 13 +++----------
drivers/mmc/host/sdhci-of-esdhc.c | 1 +
drivers/mmc/host/sdhci.c | 5 +++++
include/linux/mmc/sdhci.h | 2 ++
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 587ee0e..216e765 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -872,14 +872,6 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
esdhc_change_pinstate(host, timing);
}
-static void esdhc_reset(struct sdhci_host *host, u8 mask)
-{
- sdhci_reset(host, mask);
-
- sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
- sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
-}
-
static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -912,14 +904,15 @@ static struct sdhci_ops sdhci_esdhc_ops = {
.set_timeout = esdhc_set_timeout,
.set_bus_width = esdhc_pltfm_set_bus_width,
.set_uhs_signaling = esdhc_set_uhs_signaling,
- .reset = esdhc_reset,
+ .reset = sdhci_reset,
};
static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_HISPD_BIT
| SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
| SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC
- | SDHCI_QUIRK_BROKEN_CARD_DETECTION,
+ | SDHCI_QUIRK_BROKEN_CARD_DETECTION
+ | SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET,
.ops = &sdhci_esdhc_ops,
};
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 8872c85..9121078 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -359,6 +359,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
* host control register
*/
host->quirks2 |= SDHCI_QUIRK2_BROKEN_HOST_CONTROL;
+ host->quirks |= SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET;
}
/* call to generic mmc_of_parse to support additional capabilities */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ada1a3e..ac86775 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -205,6 +205,11 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
host->ops->reset(host, mask);
+ if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET) {
+ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
+ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
+ }
+
if (mask & SDHCI_RESET_ALL) {
if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
if (host->ops->enable_dma)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index dba793e..201978d 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -59,6 +59,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
/* Controller does not like fast PIO transfers */
#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
+/* Controller losing signal/interrupt enable states after reset */
+#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19)
/* Controller has to be forced to use block size of 2048 bytes */
#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
/* Controller cannot do multi-block transfers */
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk
2014-12-05 9:58 [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk Alessio Igor Bogani
@ 2014-12-05 12:07 ` Dong Aisheng
2014-12-09 8:41 ` Alessio Igor Bogani
0 siblings, 1 reply; 5+ messages in thread
From: Dong Aisheng @ 2014-12-05 12:07 UTC (permalink / raw)
To: Alessio Igor Bogani; +Cc: Chris Ball, linux-mmc
On Fri, Dec 5, 2014 at 5:58 PM, Alessio Igor Bogani
<alessio.bogani@elettra.eu> wrote:
> The commit 0718e59ae259 ("mmc: sdhci: move FSL ESDHC reset handling quirk into
> esdhc code") states that Freescale esdhc is the only controller which needs
> the interrupt registers restored after a reset. So it moves
> SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET quirk handling code into the
> esdhc-imx driver only. Unfortunately the same controller is used in
> other boards which use the of-esdhc driver instead (like powerpc P2020).
>
> This patch partially reverts the above mentioned commit and make
> SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET dependency explicit in both drivers.
>
> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Personally i prefer to manually restore irq in sdhci-of-esdhc driver
too as imx esdhc driver
instead of reverting the patch to avoid adding new QUIRK in common
driver if it's only
for esdhc controller.
I think people hates to see a lot QUIRK in common driver...
Regards
Dong Aisheng
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 13 +++----------
> drivers/mmc/host/sdhci-of-esdhc.c | 1 +
> drivers/mmc/host/sdhci.c | 5 +++++
> include/linux/mmc/sdhci.h | 2 ++
> 4 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 587ee0e..216e765 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -872,14 +872,6 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
> esdhc_change_pinstate(host, timing);
> }
>
> -static void esdhc_reset(struct sdhci_host *host, u8 mask)
> -{
> - sdhci_reset(host, mask);
> -
> - sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
> - sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
> -}
> -
> static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
> {
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -912,14 +904,15 @@ static struct sdhci_ops sdhci_esdhc_ops = {
> .set_timeout = esdhc_set_timeout,
> .set_bus_width = esdhc_pltfm_set_bus_width,
> .set_uhs_signaling = esdhc_set_uhs_signaling,
> - .reset = esdhc_reset,
> + .reset = sdhci_reset,
> };
>
> static const struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
> .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_NO_HISPD_BIT
> | SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC
> | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC
> - | SDHCI_QUIRK_BROKEN_CARD_DETECTION,
> + | SDHCI_QUIRK_BROKEN_CARD_DETECTION
> + | SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET,
> .ops = &sdhci_esdhc_ops,
> };
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 8872c85..9121078 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -359,6 +359,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
> * host control register
> */
> host->quirks2 |= SDHCI_QUIRK2_BROKEN_HOST_CONTROL;
> + host->quirks |= SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET;
> }
>
> /* call to generic mmc_of_parse to support additional capabilities */
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index ada1a3e..ac86775 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -205,6 +205,11 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
>
> host->ops->reset(host, mask);
>
> + if (host->quirks & SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET) {
> + sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
> + sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
> + }
> +
> if (mask & SDHCI_RESET_ALL) {
> if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
> if (host->ops->enable_dma)
> diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
> index dba793e..201978d 100644
> --- a/include/linux/mmc/sdhci.h
> +++ b/include/linux/mmc/sdhci.h
> @@ -59,6 +59,8 @@ struct sdhci_host {
> #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
> /* Controller does not like fast PIO transfers */
> #define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
> +/* Controller losing signal/interrupt enable states after reset */
> +#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19)
> /* Controller has to be forced to use block size of 2048 bytes */
> #define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
> /* Controller cannot do multi-block transfers */
> --
> 2.1.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk
2014-12-05 12:07 ` Dong Aisheng
@ 2014-12-09 8:41 ` Alessio Igor Bogani
0 siblings, 0 replies; 5+ messages in thread
From: Alessio Igor Bogani @ 2014-12-09 8:41 UTC (permalink / raw)
To: Dong Aisheng; +Cc: Chris Ball, linux-mmc
Hi,
On 5 December 2014 at 13:07, Dong Aisheng <dongas86@gmail.com> wrote:
> On Fri, Dec 5, 2014 at 5:58 PM, Alessio Igor Bogani
> <alessio.bogani@elettra.eu> wrote:
[...]
>> This patch partially reverts the above mentioned commit and make
>> SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET dependency explicit in both drivers.
>
> Personally i prefer to manually restore irq in sdhci-of-esdhc driver
> too as imx esdhc driver
> instead of reverting the patch to avoid adding new QUIRK in common
> driver if it's only
> for esdhc controller.
Thanks for review. Updated patch follows.
Ciao,
Alessio
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk
2014-12-09 8:40 Alessio Igor Bogani
@ 2014-12-19 10:44 ` Ulf Hansson
0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2014-12-19 10:44 UTC (permalink / raw)
To: Alessio Igor Bogani; +Cc: Chris Ball, Dong Aisheng, linux-mmc
On 9 December 2014 at 09:40, Alessio Igor Bogani
<alessio.bogani@elettra.eu> wrote:
> The commit 0718e59ae259 ("mmc: sdhci: move FSL ESDHC reset handling quirk into
> esdhc code") states that Freescale esdhc is the only controller which needs
> the interrupt registers restored after a reset. So it moves
> SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET quirk handling code into the
> esdhc-imx driver only. Unfortunately the same controller is used in
> other boards which use the of-esdhc driver instead (like powerpc P2020).
>
> Restore interrupts after reset in the sdhci-of-esdhc driver also.
>
> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Thanks! Queued for 3.20.
Next time, please bump the version when sending an updated patch.
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-of-esdhc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 8872c85..4a654d4 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -276,6 +276,14 @@ static void esdhc_pltfm_set_bus_width(struct sdhci_host *host, int width)
> ESDHC_CTRL_BUSWIDTH_MASK, ctrl);
> }
>
> +static void esdhc_reset(struct sdhci_host *host, u8 mask)
> +{
> + sdhci_reset(host, mask);
> +
> + sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
> + sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
> +}
> +
> static const struct sdhci_ops sdhci_esdhc_ops = {
> .read_l = esdhc_readl,
> .read_w = esdhc_readw,
> @@ -290,7 +298,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
> .platform_init = esdhc_of_platform_init,
> .adma_workaround = esdhci_of_adma_workaround,
> .set_bus_width = esdhc_pltfm_set_bus_width,
> - .reset = sdhci_reset,
> + .reset = esdhc_reset,
> .set_uhs_signaling = sdhci_set_uhs_signaling,
> };
>
> --
> 2.1.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk
@ 2014-12-09 8:40 Alessio Igor Bogani
2014-12-19 10:44 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Alessio Igor Bogani @ 2014-12-09 8:40 UTC (permalink / raw)
To: Chris Ball, Dong Aisheng; +Cc: linux-mmc, Alessio Igor Bogani
The commit 0718e59ae259 ("mmc: sdhci: move FSL ESDHC reset handling quirk into
esdhc code") states that Freescale esdhc is the only controller which needs
the interrupt registers restored after a reset. So it moves
SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET quirk handling code into the
esdhc-imx driver only. Unfortunately the same controller is used in
other boards which use the of-esdhc driver instead (like powerpc P2020).
Restore interrupts after reset in the sdhci-of-esdhc driver also.
Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
---
drivers/mmc/host/sdhci-of-esdhc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 8872c85..4a654d4 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -276,6 +276,14 @@ static void esdhc_pltfm_set_bus_width(struct sdhci_host *host, int width)
ESDHC_CTRL_BUSWIDTH_MASK, ctrl);
}
+static void esdhc_reset(struct sdhci_host *host, u8 mask)
+{
+ sdhci_reset(host, mask);
+
+ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
+ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
+}
+
static const struct sdhci_ops sdhci_esdhc_ops = {
.read_l = esdhc_readl,
.read_w = esdhc_readw,
@@ -290,7 +298,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
.platform_init = esdhc_of_platform_init,
.adma_workaround = esdhci_of_adma_workaround,
.set_bus_width = esdhc_pltfm_set_bus_width,
- .reset = sdhci_reset,
+ .reset = esdhc_reset,
.set_uhs_signaling = sdhci_set_uhs_signaling,
};
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-19 10:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-05 9:58 [PATCH] mmc: sdhci: Fix FSL ESDHC reset handling quirk Alessio Igor Bogani
2014-12-05 12:07 ` Dong Aisheng
2014-12-09 8:41 ` Alessio Igor Bogani
2014-12-09 8:40 Alessio Igor Bogani
2014-12-19 10:44 ` Ulf Hansson
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).