public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: tmio/sdhi: add support for custom MASK_ALL
@ 2021-02-23 10:08 Wolfram Sang
  2021-02-23 10:08 ` [PATCH 1/2] mmc: tmio: support custom irq masks Wolfram Sang
  2021-02-23 10:08 ` [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Wolfram Sang
  0 siblings, 2 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-02-23 10:08 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

Here is a small series to ensure SDHI Gen2+ will use its custom MASK_ALL
value all the time.

Please let me know what you think.

Happy hacking,

   Wolfram


Wolfram Sang (2):
  mmc: tmio: support custom irq masks
  mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL

 drivers/mmc/host/renesas_sdhi_core.c | 3 ++-
 drivers/mmc/host/tmio_mmc.h          | 3 ++-
 drivers/mmc/host/tmio_mmc_core.c     | 8 +++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.30.0


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

* [PATCH 1/2] mmc: tmio: support custom irq masks
  2021-02-23 10:08 [PATCH 0/2] mmc: tmio/sdhi: add support for custom MASK_ALL Wolfram Sang
@ 2021-02-23 10:08 ` Wolfram Sang
  2021-02-26  8:14   ` Yoshihiro Shimoda
  2021-03-02 10:39   ` Ulf Hansson
  2021-02-23 10:08 ` [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Wolfram Sang
  1 sibling, 2 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-02-23 10:08 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

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(-)

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


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

* [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL
  2021-02-23 10:08 [PATCH 0/2] mmc: tmio/sdhi: add support for custom MASK_ALL Wolfram Sang
  2021-02-23 10:08 ` [PATCH 1/2] mmc: tmio: support custom irq masks Wolfram Sang
@ 2021-02-23 10:08 ` Wolfram Sang
  2021-02-26  8:14   ` Yoshihiro Shimoda
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2021-02-23 10:08 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

Populate the new member for custom mask values to make sure this value
is applied whenever needed. Also, rename the define holding the value
because this is not only about initialization anymore.

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

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index a1de5c431f07..734442dacdfa 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -582,7 +582,7 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
 			       sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
 	}
 
-	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_INIT_RCAR2);
+	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_ALL_RCAR2);
 
 	if (sd_ctrl_read16(host, CTL_VERSION) >= SDHI_VER_GEN3_SD) {
 		val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT);
@@ -1043,6 +1043,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		host->ops.start_signal_voltage_switch =
 			renesas_sdhi_start_signal_voltage_switch;
 		host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27;
+		host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2;
 		host->reset = renesas_sdhi_reset;
 	}
 
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 7d5201d6a006..3b242f2e2c98 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -100,7 +100,7 @@
 
 /* Define some IRQ masks */
 /* This is the mask used at reset by the chip */
-#define TMIO_MASK_INIT_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */
+#define TMIO_MASK_ALL_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */
 #define TMIO_MASK_ALL           0x837f031d
 #define TMIO_MASK_READOP  (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND)
 #define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND)
-- 
2.30.0


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

* RE: [PATCH 1/2] mmc: tmio: support custom irq masks
  2021-02-23 10:08 ` [PATCH 1/2] mmc: tmio: support custom irq masks Wolfram Sang
@ 2021-02-26  8:14   ` Yoshihiro Shimoda
  2021-03-02 10:39   ` Ulf Hansson
  1 sibling, 0 replies; 9+ messages in thread
From: Yoshihiro Shimoda @ 2021-02-26  8:14 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc@vger.kernel.org; +Cc: linux-renesas-soc@vger.kernel.org

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


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

* RE: [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL
  2021-02-23 10:08 ` [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Wolfram Sang
@ 2021-02-26  8:14   ` Yoshihiro Shimoda
  2021-02-26  8:51     ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Yoshihiro Shimoda @ 2021-02-26  8:14 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc@vger.kernel.org; +Cc: linux-renesas-soc@vger.kernel.org

Hi Wolfram-san,

Thank you for the patch!

> From: Wolfram Sang, Sent: Tuesday, February 23, 2021 7:09 PM
<snip>
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 7d5201d6a006..3b242f2e2c98 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -100,7 +100,7 @@
> 
>  /* Define some IRQ masks */
>  /* This is the mask used at reset by the chip */
> -#define TMIO_MASK_INIT_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */
> +#define TMIO_MASK_ALL_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */

nit: Perhaps, we also have to change the comment "Initial value"?

Anyway,

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


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

* Re: [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL
  2021-02-26  8:14   ` Yoshihiro Shimoda
@ 2021-02-26  8:51     ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-02-26  8:51 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]


> > -#define TMIO_MASK_INIT_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */
> > +#define TMIO_MASK_ALL_RCAR2	0x8b7f031d /* Initial value for R-Car Gen2+ */
> 
> nit: Perhaps, we also have to change the comment "Initial value"?

Good point, I will fix it. Thank you!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] mmc: tmio: support custom irq masks
  2021-02-23 10:08 ` [PATCH 1/2] mmc: tmio: support custom irq masks Wolfram Sang
  2021-02-26  8:14   ` Yoshihiro Shimoda
@ 2021-03-02 10:39   ` Ulf Hansson
  2021-03-04  9:29     ` Wolfram Sang
  1 sibling, 1 reply; 9+ messages in thread
From: Ulf Hansson @ 2021-03-02 10:39 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc@vger.kernel.org, Linux-Renesas, Yoshihiro Shimoda

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
>

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

* Re: [PATCH 1/2] mmc: tmio: support custom irq masks
  2021-03-02 10:39   ` Ulf Hansson
@ 2021-03-04  9:29     ` Wolfram Sang
  2021-03-04 13:50       ` Ulf Hansson
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2021-03-04  9:29 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc@vger.kernel.org, Linux-Renesas, Yoshihiro Shimoda

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]


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

Thanks for the heads up! Just sent.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] mmc: tmio: support custom irq masks
  2021-03-04  9:29     ` Wolfram Sang
@ 2021-03-04 13:50       ` Ulf Hansson
  0 siblings, 0 replies; 9+ messages in thread
From: Ulf Hansson @ 2021-03-04 13:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc@vger.kernel.org,
	Linux-Renesas, Yoshihiro Shimoda

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

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

end of thread, other threads:[~2021-03-04 13:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-23 10:08 [PATCH 0/2] mmc: tmio/sdhi: add support for custom MASK_ALL Wolfram Sang
2021-02-23 10:08 ` [PATCH 1/2] mmc: tmio: support custom irq masks Wolfram Sang
2021-02-26  8:14   ` Yoshihiro Shimoda
2021-03-02 10:39   ` Ulf Hansson
2021-03-04  9:29     ` Wolfram Sang
2021-03-04 13:50       ` Ulf Hansson
2021-02-23 10:08 ` [PATCH 2/2] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Wolfram Sang
2021-02-26  8:14   ` Yoshihiro Shimoda
2021-02-26  8:51     ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox