* [PATCH 0/3] mmc: host: tmio: sdio irq improvements
@ 2017-01-19 20:07 Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 1/3] mmc: host: tmio: refactor calls to sdio irq Wolfram Sang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-01-19 20:07 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, Ulf Hansson, Simon Horman, Wolfram Sang
Here is a small series with two minor improvements (patches 1+2) and one bigger
change (patch 3) for SDIO handling with TMIO/SDHI. Since RFC, I addressed all
comments (Thanks Simon!) and since it is needed for the WLAN cards, I think it
should go in now.
Wolfram Sang (3):
mmc: host: tmio: refactor calls to sdio irq
mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS
mmc: tmio: discard obsolete SDIO irqs before enabling irqs
drivers/mmc/host/sh_mobile_sdhi.c | 6 ++----
drivers/mmc/host/tmio_mmc.h | 2 ++
drivers/mmc/host/tmio_mmc_pio.c | 20 ++++++++++++++------
include/linux/mfd/tmio.h | 6 ++----
4 files changed, 20 insertions(+), 14 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] mmc: host: tmio: refactor calls to sdio irq
2017-01-19 20:07 [PATCH 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
@ 2017-01-19 20:07 ` Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 2/3] mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS Wolfram Sang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-01-19 20:07 UTC (permalink / raw)
To: linux-mmc
Cc: linux-renesas-soc, Ulf Hansson, Simon Horman, Wolfram Sang, Simon Horman
tmio_mmc_sdio_irq() is not used as a seperate irq handler anymore, so we
can make it similar to the other irq helper functions, namely:
* only give the host as argument function which is what it really needs
* prefix function name with __
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/mmc/host/tmio_mmc_pio.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index a140848049ed81..6ab43892c132a9 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -756,9 +756,8 @@ static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host,
return false;
}
-static void tmio_mmc_sdio_irq(int irq, void *devid)
+static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
{
- struct tmio_mmc_host *host = devid;
struct mmc_host *mmc = host->mmc;
struct tmio_mmc_data *pdata = host->pdata;
unsigned int ireg, status;
@@ -799,7 +798,7 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
if (__tmio_mmc_sdcard_irq(host, ireg, status))
return IRQ_HANDLED;
- tmio_mmc_sdio_irq(irq, devid);
+ __tmio_mmc_sdio_irq(host);
return IRQ_HANDLED;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS
2017-01-19 20:07 [PATCH 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 1/3] mmc: host: tmio: refactor calls to sdio irq Wolfram Sang
@ 2017-01-19 20:07 ` Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs Wolfram Sang
2017-01-24 9:56 ` [PATCH 0/3] mmc: host: tmio: sdio irq improvements Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-01-19 20:07 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, Ulf Hansson, Simon Horman, Wolfram Sang
QUIRK sounds like there is something wrong, but actually there are just
some bits which need to be 1. Rename it to be more clear.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Change since RFC: make comments more precise
drivers/mmc/host/sh_mobile_sdhi.c | 6 ++----
drivers/mmc/host/tmio_mmc_pio.c | 2 +-
include/linux/mfd/tmio.h | 6 ++----
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 0b86ccdf9866e7..f82a8a058c7b6d 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -682,10 +682,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
*/
mmc_data->flags |= TMIO_MMC_HAVE_CMD12_CTRL;
- /*
- * All SDHI need SDIO_INFO1 reserved bit
- */
- mmc_data->flags |= TMIO_MMC_SDIO_STATUS_QUIRK;
+ /* All SDHI have SDIO status bits which must be 1 */
+ mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
ret = tmio_mmc_host_probe(host, mmc_data);
if (ret < 0)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 6ab43892c132a9..f21e6a1b1a9206 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -770,7 +770,7 @@ static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdio_irq_mask;
sdio_status = status & ~TMIO_SDIO_MASK_ALL;
- if (pdata->flags & TMIO_MMC_SDIO_STATUS_QUIRK)
+ if (pdata->flags & TMIO_MMC_SDIO_STATUS_SETBITS)
sdio_status |= 6;
sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 0dbcb7e66a02ee..662fedc87a31cf 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -94,10 +94,8 @@
*/
#define TMIO_MMC_HAVE_CMD12_CTRL (1 << 7)
-/*
- * Some controllers needs to set 1 on SDIO status reserved bits
- */
-#define TMIO_MMC_SDIO_STATUS_QUIRK (1 << 8)
+/* Controller has some SDIO status bits which must be 1 */
+#define TMIO_MMC_SDIO_STATUS_SETBITS (1 << 8)
/*
* Some controllers have a 32-bit wide data port register
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs
2017-01-19 20:07 [PATCH 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 1/3] mmc: host: tmio: refactor calls to sdio irq Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 2/3] mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS Wolfram Sang
@ 2017-01-19 20:07 ` Wolfram Sang
2017-01-24 9:56 ` [PATCH 0/3] mmc: host: tmio: sdio irq improvements Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2017-01-19 20:07 UTC (permalink / raw)
To: linux-mmc; +Cc: linux-renesas-soc, Ulf Hansson, Simon Horman, Wolfram Sang
Before enabling SDIO irqs, clear the status bit, so we discard old and
stale interrupts. Needed to get two wireless cards working. Use the
newly introduced macro in all places.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Change since RFC: use #define for SETBITS_MASK
drivers/mmc/host/tmio_mmc.h | 2 ++
drivers/mmc/host/tmio_mmc_pio.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 931d67a059adf0..efe6e6ae9d3d71 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -90,6 +90,8 @@
#define TMIO_SDIO_STAT_EXWT 0x8000
#define TMIO_SDIO_MASK_ALL 0xc007
+#define TMIO_SDIO_SETBITS_MASK 0x0006
+
/* Define some IRQ masks */
/* This is the mask used at reset by the chip */
#define TMIO_MASK_ALL 0x837f031d
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index f21e6a1b1a9206..cb3c4103de156b 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -180,12 +180,21 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
struct tmio_mmc_host *host = mmc_priv(mmc);
if (enable && !host->sdio_irq_enabled) {
+ u16 sdio_status;
+
/* Keep device active while SDIO irq is enabled */
pm_runtime_get_sync(mmc_dev(mmc));
- host->sdio_irq_enabled = true;
+ host->sdio_irq_enabled = true;
host->sdio_irq_mask = TMIO_SDIO_MASK_ALL &
~TMIO_SDIO_STAT_IOIRQ;
+
+ /* Clear obsolete interrupts before enabling */
+ sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS) & ~TMIO_SDIO_MASK_ALL;
+ if (host->pdata->flags & TMIO_MMC_SDIO_STATUS_SETBITS)
+ sdio_status |= TMIO_SDIO_SETBITS_MASK;
+ sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
+
sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
} else if (!enable && host->sdio_irq_enabled) {
host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
@@ -771,7 +780,7 @@ static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
sdio_status = status & ~TMIO_SDIO_MASK_ALL;
if (pdata->flags & TMIO_MMC_SDIO_STATUS_SETBITS)
- sdio_status |= 6;
+ sdio_status |= TMIO_SDIO_SETBITS_MASK;
sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] mmc: host: tmio: sdio irq improvements
2017-01-19 20:07 [PATCH 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
` (2 preceding siblings ...)
2017-01-19 20:07 ` [PATCH v2 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs Wolfram Sang
@ 2017-01-24 9:56 ` Ulf Hansson
3 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2017-01-24 9:56 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Simon Horman
On 19 January 2017 at 21:07, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> Here is a small series with two minor improvements (patches 1+2) and one bigger
> change (patch 3) for SDIO handling with TMIO/SDHI. Since RFC, I addressed all
> comments (Thanks Simon!) and since it is needed for the WLAN cards, I think it
> should go in now.
>
>
> Wolfram Sang (3):
> mmc: host: tmio: refactor calls to sdio irq
> mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS
> mmc: tmio: discard obsolete SDIO irqs before enabling irqs
>
> drivers/mmc/host/sh_mobile_sdhi.c | 6 ++----
> drivers/mmc/host/tmio_mmc.h | 2 ++
> drivers/mmc/host/tmio_mmc_pio.c | 20 ++++++++++++++------
> include/linux/mfd/tmio.h | 6 ++----
> 4 files changed, 20 insertions(+), 14 deletions(-)
>
> --
> 2.11.0
>
Thanks, applied for next!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-24 9:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19 20:07 [PATCH 0/3] mmc: host: tmio: sdio irq improvements Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 1/3] mmc: host: tmio: refactor calls to sdio irq Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 2/3] mmc: host: tmio: SDIO_STATUS_QUIRK is rather SDIO_STATUS_SETBITS Wolfram Sang
2017-01-19 20:07 ` [PATCH v2 3/3] mmc: tmio: discard obsolete SDIO irqs before enabling irqs Wolfram Sang
2017-01-24 9:56 ` [PATCH 0/3] mmc: host: tmio: sdio irq improvements Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.