* [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms
@ 2023-10-22 21:40 Marek Vasut
2023-10-23 7:04 ` Paul Barker
2023-10-26 8:42 ` Yoshihiro Shimoda
0 siblings, 2 replies; 3+ messages in thread
From: Marek Vasut @ 2023-10-22 21:40 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Jaehoon Chung, Nobuhiro Iwamatsu, Paul Barker, Peng Fan
The R-Car Gen3 SD_CLK_CTRL register does not use BIT(16) to implement
divider 1/1024, instead BIT(16) is reserved bit and divider 1/1024 is
not supported. The divider 1/1024 is specific to Socionext variant of
the IP, as is indicated by Linux commit:
0196c8db8363 ("mmc: tmio: move tmio_mmc_set_clock() to platform hook")
"
Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1. Also, newer
versions of UniPhier SoC variants use bit 16 for 1/1024.
"
Do not set the TMIO_SD_CAP_DIV1024 on Renesas R-Car platforms even if
the IP VERSION register does exist, and indicates IP version is newer
or equal to version 1.0 . The IP version 1.0 or newer does not imply
presence of the 1/1024 divider.
Since the TMIO driver is used exactly by two supported platforms, that
is Renesas R-Car and Socionext UniPhier, it is OK to check whether the
TMIO_SD_CAP_RCAR capability is not set to identify the UniPhier platform
and add the capability only on that platform.
Fixes: 58c35b17aa8f ("mmc: matsushita-common: Always check controller version")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
Cc: Peng Fan <peng.fan@nxp.com>
---
drivers/mmc/tmio-common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
index 83eaf361f0c..890c496b535 100644
--- a/drivers/mmc/tmio-common.c
+++ b/drivers/mmc/tmio-common.c
@@ -759,7 +759,8 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
dev_dbg(dev, "version %x\n", priv->version);
if (priv->version >= 0x10) {
priv->caps |= TMIO_SD_CAP_DMA_INTERNAL;
- priv->caps |= TMIO_SD_CAP_DIV1024;
+ if (!(priv->caps & TMIO_SD_CAP_RCAR))
+ priv->caps |= TMIO_SD_CAP_DIV1024;
}
if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
--
2.42.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms
2023-10-22 21:40 [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms Marek Vasut
@ 2023-10-23 7:04 ` Paul Barker
2023-10-26 8:42 ` Yoshihiro Shimoda
1 sibling, 0 replies; 3+ messages in thread
From: Paul Barker @ 2023-10-23 7:04 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Jaehoon Chung, Nobuhiro Iwamatsu, Peng Fan
[-- Attachment #1.1: Type: text/plain, Size: 1369 bytes --]
On Sun, Oct 22, 2023 at 11:40:43PM +0200, Marek Vasut wrote:
> The R-Car Gen3 SD_CLK_CTRL register does not use BIT(16) to implement
> divider 1/1024, instead BIT(16) is reserved bit and divider 1/1024 is
> not supported. The divider 1/1024 is specific to Socionext variant of
> the IP, as is indicated by Linux commit:
>
> 0196c8db8363 ("mmc: tmio: move tmio_mmc_set_clock() to platform hook")
> "
> Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1. Also, newer
> versions of UniPhier SoC variants use bit 16 for 1/1024.
> "
>
> Do not set the TMIO_SD_CAP_DIV1024 on Renesas R-Car platforms even if
> the IP VERSION register does exist, and indicates IP version is newer
> or equal to version 1.0 . The IP version 1.0 or newer does not imply
> presence of the 1/1024 divider.
>
> Since the TMIO driver is used exactly by two supported platforms, that
> is Renesas R-Car and Socionext UniPhier, it is OK to check whether the
> TMIO_SD_CAP_RCAR capability is not set to identify the UniPhier platform
> and add the capability only on that platform.
>
> Fixes: 58c35b17aa8f ("mmc: matsushita-common: Always check controller version")
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
I've confirmed that the 1/1024 divider doesn't exist in the RZ/G2L
datasheet.
Acked-by: Paul Barker <paul.barker.ct@bp.renesas.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms
2023-10-22 21:40 [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms Marek Vasut
2023-10-23 7:04 ` Paul Barker
@ 2023-10-26 8:42 ` Yoshihiro Shimoda
1 sibling, 0 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-26 8:42 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: Jaehoon Chung, Nobuhiro Iwamatsu, Paul Barker, Peng Fan,
Nguyen Hong Thuan
Hello Marek-san,
> From: U-Boot On Behalf Of Marek Vasut, Sent: Monday, October 23, 2023 6:41 AM
>
> The R-Car Gen3 SD_CLK_CTRL register does not use BIT(16) to implement
> divider 1/1024, instead BIT(16) is reserved bit and divider 1/1024 is
> not supported. The divider 1/1024 is specific to Socionext variant of
> the IP, as is indicated by Linux commit:
>
> 0196c8db8363 ("mmc: tmio: move tmio_mmc_set_clock() to platform hook")
> "
> Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1. Also, newer
> versions of UniPhier SoC variants use bit 16 for 1/1024.
> "
>
> Do not set the TMIO_SD_CAP_DIV1024 on Renesas R-Car platforms even if
> the IP VERSION register does exist, and indicates IP version is newer
> or equal to version 1.0 . The IP version 1.0 or newer does not imply
> presence of the 1/1024 divider.
>
> Since the TMIO driver is used exactly by two supported platforms, that
> is Renesas R-Car and Socionext UniPhier, it is OK to check whether the
> TMIO_SD_CAP_RCAR capability is not set to identify the UniPhier platform
> and add the capability only on that platform.
>
> Fixes: 58c35b17aa8f ("mmc: matsushita-common: Always check controller version")
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Thank you for the patch. It looks good to me. So,
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Also, our outsourcing member tested it on R-Car H3 Salvator-XS and
it works without any regression. So,
Tested-by: Thuan Nguyen Hong <thuan.nguyen-hong@banvien.com.vn>
Best regards,
Yoshihiro Shimoda
> ---
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/mmc/tmio-common.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
> index 83eaf361f0c..890c496b535 100644
> --- a/drivers/mmc/tmio-common.c
> +++ b/drivers/mmc/tmio-common.c
> @@ -759,7 +759,8 @@ int tmio_sd_probe(struct udevice *dev, u32 quirks)
> dev_dbg(dev, "version %x\n", priv->version);
> if (priv->version >= 0x10) {
> priv->caps |= TMIO_SD_CAP_DMA_INTERNAL;
> - priv->caps |= TMIO_SD_CAP_DIV1024;
> + if (!(priv->caps & TMIO_SD_CAP_RCAR))
> + priv->caps |= TMIO_SD_CAP_DIV1024;
> }
>
> if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
> --
> 2.42.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-26 8:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22 21:40 [PATCH] mmc: tmio: Disable 1/1024 clock divider on Renesas R-Car platforms Marek Vasut
2023-10-23 7:04 ` Paul Barker
2023-10-26 8:42 ` Yoshihiro Shimoda
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.