Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Biju <biju.das.au@gmail.com>
Cc: Ulf Hansson <ulfh@kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v24 08/15] mmc: renesas_sdhi: Add TMIO_MMC_INTERNAL_DIVIDER flag
Date: Thu, 3 Sep 2026 11:37:55 +0200	[thread overview]
Message-ID: <apk_81IYqxrWZyJK@shikoro> (raw)
In-Reply-To: <20260820171657.62815-9-biju.das.jz@bp.renesas.com>

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

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Fallback `f_max` and `f_min` initialization fails to account for the internal clock divider.
> --
> 
> --- Patch [8]: [PATCH v24 08/15] mmc: renesas_sdhi: Add TMIO_MMC_INTERNAL_DIVIDER flag ---
> commit c4a63c19303286f5b383bdabaa2a3f3827a8c5c5
> Author: Biju Das <biju.das.jz@bp.renesas.com>
> 
> mmc: renesas_sdhi: Add TMIO_MMC_INTERNAL_DIVIDER flag
> 
> This commit introduces the TMIO_MMC_INTERNAL_DIVIDER flag to support SoCs
> like RZ/G3L that have a fixed internal /2 clock divider. It adds a helper
> function to fold this division into the reported clock rate and uses it in
> the clock update path.
> 
> > diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> > index ff428b6187bbd..b5f2ff68db758 100644
> > --- a/drivers/mmc/host/renesas_sdhi_core.c
> > +++ b/drivers/mmc/host/renesas_sdhi_core.c
> > @@ -125,6 +125,27 @@ static int renesas_sdhi_clk_enable(struct tmio_mmc_host *host)
> >  	return 0;
> >  }
> >  
> 
> [Severity: Medium]
> Since this patch introduces an internal /2 clock divider, should
> renesas_sdhi_clk_enable() (which is just above this hunk) also be updated
> to account for it?
> 
> If the device tree omits the max-frequency property, f_max defaults to
> the raw parent clock rate:
> 
> drivers/mmc/host/renesas_sdhi_core.c:renesas_sdhi_clk_enable() {
>     ...
> 	if (!mmc->f_max)
> 		mmc->f_max = clk_get_rate(priv->clk);
> 
> 	/*
> 	 * Minimum frequency is the minimum input clock frequency
> 	 * divided by our maximum divider.
> 	 */
> 	mmc->f_min = max(clk_round_rate(priv->clk, 1) / host->pdata->max_divider, 1L);
>     ...
> }
> 
> For hardware with the internal divider, this advertises double the actual
> achievable bus frequency. If the clock provider cannot scale up to 4x the
> requested frequency, the MMC core might negotiate a high-speed mode that the
> hardware cannot satisfy, resulting in a mode mismatch where the bus silently
> runs at half the expected speed.
> 
> Could mmc->f_max and mmc->f_min calculation be adjusted when the
> TMIO_MMC_INTERNAL_DIVIDER flag is set?

Looks valid from a glimpse. Please comment if you think this report
makes sense or not.


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

  reply	other threads:[~2026-09-03  9:37 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 17:16 [PATCH v24 00/15] Add Renesas RZ/G3L SD/eMMC support Biju
2026-08-20 17:16 ` [PATCH v24 01/15] dt-bindings: mmc: renesas,sdhi: Document RZ/G3L (r9a08g046) SoC Biju
2026-09-02 10:45   ` Wolfram Sang
2026-08-20 17:16 ` [PATCH v24 02/15] mmc: renesas_sdhi: Clean up whitespace and add OF table sentinels Biju
2026-09-02 10:47   ` Wolfram Sang
2026-09-04  6:40     ` Biju Das
2026-09-09 18:46       ` wsa+renesas
2026-08-20 17:16 ` [PATCH v24 03/15] mmc: renesas_sdhi: Add clk_mask field to support flexible clock divider widths Biju
2026-09-02 10:51   ` Wolfram Sang
2026-09-04 10:54     ` Biju Das
2026-09-02 10:54   ` Wolfram Sang
2026-09-04 11:03     ` Biju Das
2026-09-10 21:52       ` wsa+renesas
2026-08-20 17:16 ` [PATCH v24 04/15] mmc: renesas_sdhi: Add max_divider field to support SoC-specific clock ranges Biju
2026-09-02 11:05   ` Wolfram Sang
2026-09-04 12:46     ` Biju Das
2026-09-10 21:56       ` wsa+renesas
2026-08-20 17:16 ` [PATCH v24 05/15] mmc: renesas_sdhi: Add SDHI_SD_CLK_CTL_DIV1 macro for 1/1 option Biju
2026-09-02 11:06   ` Wolfram Sang
2026-08-20 17:16 ` [PATCH v24 06/15] mmc: renesas_sdhi: Make clock divider mask configurable Biju
2026-09-02 11:09   ` Wolfram Sang
2026-09-04 12:48     ` Biju Das
2026-08-20 17:16 ` [PATCH v24 07/15] mmc: renesas_sdhi: Add tuning delay support for RZ/G2L Biju
2026-09-03  9:30   ` Wolfram Sang
2026-09-04 14:47     ` Biju Das
2026-09-13 17:47       ` wsa+renesas
2026-09-03  9:34   ` Wolfram Sang
2026-09-04 15:15     ` Biju Das
2026-08-20 17:16 ` [PATCH v24 08/15] mmc: renesas_sdhi: Add TMIO_MMC_INTERNAL_DIVIDER flag Biju
2026-09-03  9:37   ` Wolfram Sang [this message]
2026-09-07  6:37     ` Biju Das
2026-09-03  9:43   ` Wolfram Sang
2026-09-07  7:19     ` Biju Das
2026-08-20 17:16 ` [PATCH v24 09/15] mmc: renesas_sdhi: Add optional axis/axim reset controls Biju
2026-09-03  9:48   ` Wolfram Sang
2026-08-20 17:16 ` [PATCH v24 10/15] mmc: renesas_sdhi: Add write32_hook for CTL_SD_CARD_CLK_CTL register writes Biju
2026-09-03 10:30   ` Wolfram Sang
2026-09-07  8:19     ` Biju Das
2026-09-03 10:32   ` Wolfram Sang
2026-09-07  8:27     ` Biju Das
2026-08-20 17:16 ` [PATCH v24 11/15] mmc: renesas_sdhi: Add RZ/G3L SDHI support Biju
2026-09-03 12:01   ` Wolfram Sang
2026-09-07 12:53     ` Biju Das
2026-08-20 17:16 ` [PATCH v24 12/15] mmc: renesas_sdhi: Save and restore IOVS across suspend/resume Biju
2026-08-20 17:16 ` [PATCH v24 13/15] mmc: renesas_sdhi: Make HS400 OSEL bit configurable per SoC Biju
2026-08-20 17:16 ` [PATCH v24 14/15] mmc: renesas_sdhi: Add RZ/G3L HS400 support Biju
2026-08-20 17:16 ` [PATCH v24 15/15] mmc: renesas_sdhi: Add HS400 enhanced strobe support for RZ/G3L Biju
2026-09-01 14:52 ` [PATCH v24 00/15] Add Renesas RZ/G3L SD/eMMC support Wolfram Sang
2026-09-03 20:11 ` Wolfram Sang
2026-09-04  2:24   ` Biju Das
2026-09-04  8:00   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=apk_81IYqxrWZyJK@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox