diff mbox series

[1/2] mmc: tmio: support custom irq masks

Message ID 20210223100830.25125-2-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: tmio/sdhi: add support for custom MASK_ALL | expand

Commit Message

Wolfram Sang Feb. 23, 2021, 10:08 a.m. UTC
SDHI Gen2+ has a different value for TMIO_MASK_ALL, so add a member to
support that. If the member is not used, the previous default value is
applied.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc.h      | 1 +
 drivers/mmc/host/tmio_mmc_core.c | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Yoshihiro Shimoda Feb. 26, 2021, 8:14 a.m. UTC | #1
Hi Wolfram-san,

> From: Wolfram Sang, Sent: Tuesday, February 23, 2021 7:08 PM
> 
> SDHI Gen2+ has a different value for TMIO_MASK_ALL, so add a member to
> support that. If the member is not used, the previous default value is
> applied.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thank you for the patch!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

And, I tested on my environment (r8a77951-salvator-xs.dts) and
I didn't observe any regression, so,

Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda
Ulf Hansson March 2, 2021, 10:39 a.m. UTC | #2
On Tue, 23 Feb 2021 at 11:10, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> SDHI Gen2+ has a different value for TMIO_MASK_ALL, so add a member to
> support that. If the member is not used, the previous default value is
> applied.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

To be clear, I am awaiting a v2 of patch 2/2.

Kind regards
Uffe


> ---
>  drivers/mmc/host/tmio_mmc.h      | 1 +
>  drivers/mmc/host/tmio_mmc_core.c | 8 +++++---
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 2d1db9396d4a..7d5201d6a006 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -164,6 +164,7 @@ struct tmio_mmc_host {
>         u32                     sdio_irq_mask;
>         unsigned int            clk_cache;
>         u32                     sdcard_irq_setbit_mask;
> +       u32                     sdcard_irq_mask_all;
>
>         spinlock_t              lock;           /* protect host private data */
>         unsigned long           last_req_ts;
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 0e7a2faa5238..eca767dcabba 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1175,7 +1175,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
>         tmio_mmc_reset(_host);
>
>         _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
> -       tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
> +       if (!_host->sdcard_irq_mask_all)
> +               _host->sdcard_irq_mask_all = TMIO_MASK_ALL;
> +       tmio_mmc_disable_mmc_irqs(_host, _host->sdcard_irq_mask_all);
>
>         if (_host->native_hotplug)
>                 tmio_mmc_enable_mmc_irqs(_host,
> @@ -1229,7 +1231,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
>         cancel_work_sync(&host->done);
>         cancel_delayed_work_sync(&host->delayed_reset_work);
>         tmio_mmc_release_dma(host);
> -       tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL);
> +       tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
>
>         if (host->native_hotplug)
>                 pm_runtime_put_noidle(&pdev->dev);
> @@ -1259,7 +1261,7 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
>  {
>         struct tmio_mmc_host *host = dev_get_drvdata(dev);
>
> -       tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL);
> +       tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
>
>         if (host->clk_cache)
>                 host->set_clock(host, 0);
> --
> 2.30.0
>
Wolfram Sang March 4, 2021, 9:29 a.m. UTC | #3
> To be clear, I am awaiting a v2 of patch 2/2.

Thanks for the heads up! Just sent.
Ulf Hansson March 4, 2021, 1:50 p.m. UTC | #4
On Thu, 4 Mar 2021 at 10:29, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
>
> > To be clear, I am awaiting a v2 of patch 2/2.
>
> Thanks for the heads up! Just sent.

V2 patch applied (could find the email in my inbox, but the patch was
picked up by the patchtracker, weird).

In any case, thanks and kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 2d1db9396d4a..7d5201d6a006 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -164,6 +164,7 @@  struct tmio_mmc_host {
 	u32			sdio_irq_mask;
 	unsigned int		clk_cache;
 	u32			sdcard_irq_setbit_mask;
+	u32			sdcard_irq_mask_all;
 
 	spinlock_t		lock;		/* protect host private data */
 	unsigned long		last_req_ts;
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 0e7a2faa5238..eca767dcabba 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1175,7 +1175,9 @@  int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
 	tmio_mmc_reset(_host);
 
 	_host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
-	tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
+	if (!_host->sdcard_irq_mask_all)
+		_host->sdcard_irq_mask_all = TMIO_MASK_ALL;
+	tmio_mmc_disable_mmc_irqs(_host, _host->sdcard_irq_mask_all);
 
 	if (_host->native_hotplug)
 		tmio_mmc_enable_mmc_irqs(_host,
@@ -1229,7 +1231,7 @@  void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 	cancel_work_sync(&host->done);
 	cancel_delayed_work_sync(&host->delayed_reset_work);
 	tmio_mmc_release_dma(host);
-	tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL);
+	tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
 
 	if (host->native_hotplug)
 		pm_runtime_put_noidle(&pdev->dev);
@@ -1259,7 +1261,7 @@  int tmio_mmc_host_runtime_suspend(struct device *dev)
 {
 	struct tmio_mmc_host *host = dev_get_drvdata(dev);
 
-	tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL);
+	tmio_mmc_disable_mmc_irqs(host, host->sdcard_irq_mask_all);
 
 	if (host->clk_cache)
 		host->set_clock(host, 0);