* [PATCH] mmc: renesas_sdhi: Set the SDBUF after reset
@ 2024-03-13 9:30 Claudiu
2024-03-13 12:23 ` Sergey Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Claudiu @ 2024-03-13 9:30 UTC (permalink / raw)
To: wsa+renesas, ulf.hansson
Cc: linux-mmc, linux-renesas-soc, linux-kernel, claudiu.beznea,
Claudiu Beznea, Hien Huynh
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
For development purpose, renesas_sdhi_probe() could be called w/
dma_ops = NULL to force the usage of PIO mode. In this case the
renesas_sdhi_enable_dma() will not be called before transferring data.
If renesas_sdhi_enable_dma() is not called, renesas_sdhi_clk_enable()
call from renesas_sdhi_probe() will configure SDBUF by calling the
renesas_sdhi_sdbuf_width() function, but then SDBUF will be reseted in
tmio_mmc_host_probe() when calling tmio_mmc_reset() though host->reset().
If SDBUF is zero the data transfer will not work in PIO mode for RZ/G3S.
To fix this call again the renesas_sdhi_sdbuf_width(host, 16); in
renesas_sdhi_reset(). The call of renesas_sdhi_sdbuf_width() was not
removed from renesas_sdhi_clk_enable() as the host->reset() is optional.
Co-developed-by: Hien Huynh <hien.huynh.px@renesas.com>
Signed-off-by: Hien Huynh <hien.huynh.px@renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/mmc/host/renesas_sdhi_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index c675dec587ef..b51e04fa5445 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -589,6 +589,12 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve)
sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
priv->needs_adjust_hs400 = false;
renesas_sdhi_set_clock(host, host->clk_cache);
+
+ /*
+ * In case the controller works in PIO mode the SDBUF needs to be set as its
+ * reset value is zero.
+ */
+ renesas_sdhi_sdbuf_width(host, 16);
} else if (priv->scc_ctl) {
renesas_sdhi_scc_reset(host, priv);
}
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mmc: renesas_sdhi: Set the SDBUF after reset
2024-03-13 9:30 [PATCH] mmc: renesas_sdhi: Set the SDBUF after reset Claudiu
@ 2024-03-13 12:23 ` Sergey Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Shtylyov @ 2024-03-13 12:23 UTC (permalink / raw)
To: Claudiu, wsa+renesas, ulf.hansson
Cc: linux-mmc, linux-renesas-soc, linux-kernel, Claudiu Beznea, Hien Huynh
On 3/13/24 12:30 PM, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> For development purpose, renesas_sdhi_probe() could be called w/
> dma_ops = NULL to force the usage of PIO mode. In this case the
> renesas_sdhi_enable_dma() will not be called before transferring data.
>
> If renesas_sdhi_enable_dma() is not called, renesas_sdhi_clk_enable()
> call from renesas_sdhi_probe() will configure SDBUF by calling the
> renesas_sdhi_sdbuf_width() function, but then SDBUF will be reseted in
s/reseted/reset/.
> tmio_mmc_host_probe() when calling tmio_mmc_reset() though host->reset().
> If SDBUF is zero the data transfer will not work in PIO mode for RZ/G3S.
>
> To fix this call again the renesas_sdhi_sdbuf_width(host, 16); in
Semicolon clearly doesn't fit here...
> renesas_sdhi_reset(). The call of renesas_sdhi_sdbuf_width() was not
> removed from renesas_sdhi_clk_enable() as the host->reset() is optional.
>
> Co-developed-by: Hien Huynh <hien.huynh.px@renesas.com>
> Signed-off-by: Hien Huynh <hien.huynh.px@renesas.com>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
[...]
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index c675dec587ef..b51e04fa5445 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -589,6 +589,12 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve)
> sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
> priv->needs_adjust_hs400 = false;
> renesas_sdhi_set_clock(host, host->clk_cache);
> +
> + /*
> + * In case the controller works in PIO mode the SDBUF needs to be set as its
Well, it won't hurt wrapping the comment at 80 columns here...
> + * reset value is zero.
> + */
> + renesas_sdhi_sdbuf_width(host, 16);
> } else if (priv->scc_ctl) {
> renesas_sdhi_scc_reset(host, priv);
> }
MBR, Sergey
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-13 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 9:30 [PATCH] mmc: renesas_sdhi: Set the SDBUF after reset Claudiu
2024-03-13 12:23 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®