All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
@ 2018-09-26 15:00 Niklas Söderlund
  2018-10-01 12:42 ` Simon Horman
  2018-10-02 22:54 ` Wolfram Sang
  0 siblings, 2 replies; 7+ messages in thread
From: Niklas Söderlund @ 2018-09-26 15:00 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson, linux-mmc
  Cc: linux-renesas-soc, Masaharu Hayakawa, Niklas Söderlund

From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

The initial value of the interrupt mask register may be different from
the H/W manual at the startup of the kernel by setting from the
bootloader. Since the error interrupts may be unmasked, the driver sets
initial value.

The initial value is only known for R-Car Gen2 and Gen3 platforms so
limit the initialization to those platforms.

Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

---

* Changes since v1
- Limit the initialization to Gen2+ platforms by checking the
  TMIO_MMC_MIN_RCAR2 flag.
- Rename the constant for the initialization value to reflect it's only
  for R-Car Gen2+ platforms.
---
 drivers/mmc/host/tmio_mmc.h      | 1 +
 drivers/mmc/host/tmio_mmc_core.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index a9972dc60c6fbb8c..00673cec47a4de13 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -99,6 +99,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           0x837f031d
 #define TMIO_MASK_READOP  (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND)
 #define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND)
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index f05c3a622f090cd6..5aae7e2129400671 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1232,6 +1232,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
 	_host->set_clock(_host, 0);
 	tmio_mmc_reset(_host);
 
+	if (pdata->flags & TMIO_MMC_MIN_RCAR2)
+		sd_ctrl_write32_as_16_and_16(_host, CTL_IRQ_MASK,
+					     TMIO_MASK_INIT_RCAR2);
+
 	_host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
 	tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
 
-- 
2.19.0

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-09-26 15:00 [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register Niklas Söderlund
@ 2018-10-01 12:42 ` Simon Horman
  2018-10-02 22:54 ` Wolfram Sang
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2018-10-01 12:42 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc,
	Masaharu Hayakawa

On Wed, Sep 26, 2018 at 05:00:26PM +0200, Niklas Söderlund wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> 
> The initial value of the interrupt mask register may be different from
> the H/W manual at the startup of the kernel by setting from the
> bootloader. Since the error interrupts may be unmasked, the driver sets
> initial value.
> 
> The initial value is only known for R-Car Gen2 and Gen3 platforms so
> limit the initialization to those platforms.
> 
> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-09-26 15:00 [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register Niklas Söderlund
  2018-10-01 12:42 ` Simon Horman
@ 2018-10-02 22:54 ` Wolfram Sang
  2018-10-05 15:50   ` Niklas Söderlund
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2018-10-02 22:54 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Wolfram Sang, Ulf Hansson, linux-mmc, linux-renesas-soc,
	Masaharu Hayakawa

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

On Wed, Sep 26, 2018 at 05:00:26PM +0200, Niklas Söderlund wrote:
> From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> 
> The initial value of the interrupt mask register may be different from
> the H/W manual at the startup of the kernel by setting from the
> bootloader. Since the error interrupts may be unmasked, the driver sets
> initial value.
> 
> The initial value is only known for R-Car Gen2 and Gen3 platforms so
> limit the initialization to those platforms.
> 
> Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> ---
> 
> * Changes since v1
> - Limit the initialization to Gen2+ platforms by checking the
>   TMIO_MMC_MIN_RCAR2 flag.
> - Rename the constant for the initialization value to reflect it's only
>   for R-Car Gen2+ platforms.

Those changes are good! I wonder, though, if we shouldn't move the code
out of TMIO core into the SDHI core? This seems very Renesas specific.
What do you think?


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

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-10-02 22:54 ` Wolfram Sang
@ 2018-10-05 15:50   ` Niklas Söderlund
  2018-10-09 23:53     ` Wolfram Sang
  0 siblings, 1 reply; 7+ messages in thread
From: Niklas Söderlund @ 2018-10-05 15:50 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Ulf Hansson, linux-mmc, linux-renesas-soc, Masaharu Hayakawa

Hi Wolfram,

Thanks for your feedback.

On 2018-10-03 00:54:02 +0200, Wolfram Sang wrote:
> On Wed, Sep 26, 2018 at 05:00:26PM +0200, Niklas S�derlund wrote:
> > From: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> > 
> > The initial value of the interrupt mask register may be different from
> > the H/W manual at the startup of the kernel by setting from the
> > bootloader. Since the error interrupts may be unmasked, the driver sets
> > initial value.
> > 
> > The initial value is only known for R-Car Gen2 and Gen3 platforms so
> > limit the initialization to those platforms.
> > 
> > Signed-off-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>
> > Signed-off-by: Niklas S�derlund <niklas.soderlund+renesas@ragnatech.se>
> > 
> > ---
> > 
> > * Changes since v1
> > - Limit the initialization to Gen2+ platforms by checking the
> >   TMIO_MMC_MIN_RCAR2 flag.
> > - Rename the constant for the initialization value to reflect it's only
> >   for R-Car Gen2+ platforms.
> 
> Those changes are good! I wonder, though, if we shouldn't move the code
> out of TMIO core into the SDHI core? This seems very Renesas specific.
> What do you think?
> 

There are already checks for TMIO_MMC_MIN_RCAR2 inside 
tmio_mmc_host_probe(), but I agree with you it would be good if instead 
of adding to that start to move Renesas specific code out.

I did a quick test and it seems sane to move this to the end of 
renesas_sdhi_hw_reset(). Before I send a v3 of this what is your view?

-- 
Regards,
Niklas S�derlund

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-10-05 15:50   ` Niklas Söderlund
@ 2018-10-09 23:53     ` Wolfram Sang
  2018-10-10 11:08       ` Niklas Söderlund
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2018-10-09 23:53 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Ulf Hansson, linux-mmc, linux-renesas-soc, Masaharu Hayakawa

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

Hi Niklas,

> There are already checks for TMIO_MMC_MIN_RCAR2 inside 
> tmio_mmc_host_probe(), but I agree with you it would be good if instead 
> of adding to that start to move Renesas specific code out.

Thanks!

> I did a quick test and it seems sane to move this to the end of 
> renesas_sdhi_hw_reset(). Before I send a v3 of this what is your view?

It seems a good place to me if it also gets called when probing the
device. From a quick glimpse, I see that this function ends up in
mmc_ops->hw_reset, but I haven't verified that the MMC core calls it
during probe. But you said you tested it...


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

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-10-09 23:53     ` Wolfram Sang
@ 2018-10-10 11:08       ` Niklas Söderlund
  2018-10-10 11:39         ` Wolfram Sang
  0 siblings, 1 reply; 7+ messages in thread
From: Niklas Söderlund @ 2018-10-10 11:08 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Ulf Hansson, linux-mmc, linux-renesas-soc, Masaharu Hayakawa

Hi Wolfram,

Thanks for our feedback.

On 2018-10-10 01:53:58 +0200, Wolfram Sang wrote:
> Hi Niklas,
> 
> > There are already checks for TMIO_MMC_MIN_RCAR2 inside 
> > tmio_mmc_host_probe(), but I agree with you it would be good if instead 
> > of adding to that start to move Renesas specific code out.
> 
> Thanks!
> 
> > I did a quick test and it seems sane to move this to the end of 
> > renesas_sdhi_hw_reset(). Before I send a v3 of this what is your view?
> 
> It seems a good place to me if it also gets called when probing the
> device. From a quick glimpse, I see that this function ends up in
> mmc_ops->hw_reset, but I haven't verified that the MMC core calls it
> during probe. But you said you tested it...
> 

You are correct, in mmc/next it is not called during probe. I see now I 
did my testing on-top of the reset series I'm currently reworking and 
then it's called at the right time to use the initial set irq mask for 
the _host->sdcard_irq_mask read out in tmio_mmc_host_probe().

I will move this patch back to the top of the reset series as it would 
IMHO create the least amount of code churn. Another option is to merge 
this version now and move it once the reset series is accepted.

-- 
Regards,
Niklas S�derlund

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

* Re: [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register
  2018-10-10 11:08       ` Niklas Söderlund
@ 2018-10-10 11:39         ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2018-10-10 11:39 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Ulf Hansson, linux-mmc, linux-renesas-soc, Masaharu Hayakawa

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


> I will move this patch back to the top of the reset series as it would 
> IMHO create the least amount of code churn. Another option is to merge 
> this version now and move it once the reset series is accepted.

Less code churn sounds good to me.

Thanks, Niklas!


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

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

end of thread, other threads:[~2018-10-10 19:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 15:00 [PATCH v2] mmc: tmio: Add initial setting of interrupt mask register Niklas Söderlund
2018-10-01 12:42 ` Simon Horman
2018-10-02 22:54 ` Wolfram Sang
2018-10-05 15:50   ` Niklas Söderlund
2018-10-09 23:53     ` Wolfram Sang
2018-10-10 11:08       ` Niklas Söderlund
2018-10-10 11:39         ` Wolfram Sang

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.