From: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: u-boot@lists.denx.de, peng.fan@nxp.com, jh80.chung@samsung.com,
trini@konsulko.com, marex@denx.de, tien.fong.chee@altera.com,
balsundar.ponnusamy@altera.com
Subject: Re: [PATCH 2/8] mmc: sdhci-cadence: Use max-frequency property from device tree
Date: Thu, 20 Nov 2025 20:01:15 +0530 [thread overview]
Message-ID: <099ad344-80c8-4f88-8ddc-8ff6012c5974@altera.com> (raw)
In-Reply-To: <aRwOmpXU5__RLICN@nxa18884-linux>
Thanks for your feedback, Peng.
On 11/18/2025 11:43 AM, Peng Fan wrote:
> On Mon, Nov 10, 2025 at 09:37:31AM -0800, Tanmay Kathpalia wrote:
>> When f_max parameter is 0 in sdhci_setup_cfg(), the function defaults
>> to using the maximum frequency from host controller capabilities register
>> instead of the max-frequency property parsed from device tree.
>>
>> The max-frequency property from device tree is parsed by mmc_of_parse()
>> and stored in plat->cfg.f_max, but sdhci_setup_cfg() was being called
>> with f_max=0, causing it to ignore the device tree value and use the
>> host capabilities register value instead.
>>
>> Fix this by passing plat->cfg.f_max to sdhci_setup_cfg() to ensure
>> the device tree specified maximum frequency is respected over the
>> hardware default.
>>
>> Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
>> Reviewed-by: Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>
>> ---
>> drivers/mmc/sdhci-cadence.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
>> index d9fda902076..f31437e5eeb 100644
>> --- a/drivers/mmc/sdhci-cadence.c
>> +++ b/drivers/mmc/sdhci-cadence.c
>> @@ -255,7 +255,7 @@ static int sdhci_cdns_probe(struct udevice *dev)
>>
>> host->mmc = &plat->mmc;
>> host->mmc->dev = dev;
>> - ret = sdhci_setup_cfg(&plat->cfg, host, 0, 0);
>> + ret = sdhci_setup_cfg(&plat->cfg, host, plat->cfg.f_max, 0);
>
> plat is allocated by setting plat_auto in U_BOOT_DRIVER, but it is not
> zeroed. So f_max maybe a random value if max frequency is not set in
> device tree. You need clear it before mmc_of_parse or
> change to use dev_read_u32_default for parsing max frequency in mmc_of_parse.
I agree with your suggestion to use dev_read_u32_default in
mmc_of_parse() for parsing the max-frequency property. This will ensure
that plat->cfg.f_max is correctly set from the device tree, and if
max-frequency is not specified, it will default to 0.
Since this change affects mmc-uclass.c in the MMC subsystem, I plan to
submit a separate patch for that update to keep the changes organized.
>
> Regards
> Peng
>
>> if (ret)
>> return ret;
>>
>> --
>> 2.43.7
>>
>>
next prev parent reply other threads:[~2025-11-20 14:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 17:37 [PATCH 0/8] mmc: sdhci-cadence: Improvements and fixes for Cadence SDHCI driver Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 1/8] mmc: sdhci-cadence: Add reset control support Tanmay Kathpalia
2025-11-18 5:09 ` Peng Fan
2025-11-20 14:59 ` Tanmay Kathpalia
2025-11-26 2:17 ` Peng Fan
2025-11-27 8:29 ` Tanmay Kathpalia
2025-11-27 9:48 ` Peng Fan
2025-11-27 9:52 ` Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 2/8] mmc: sdhci-cadence: Use max-frequency property from device tree Tanmay Kathpalia
2025-11-18 6:13 ` Peng Fan
2025-11-20 14:31 ` Tanmay Kathpalia [this message]
2025-11-10 17:37 ` [PATCH 3/8] mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 4/8] mmc: sdhci: Add SDHCI_SPEC_400, _410, and _420 version defines Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 5/8] mmc: sdhci-cadence: Use hardware version field for Cadence SDHCI controller Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 6/8] mmc: sdhci-cadence: Enable software tuning for both SD and eMMC interfaces Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 7/8] mmc: sdhci-cadence6: socfpga: Fix DT property naming convention Tanmay Kathpalia
2025-11-18 6:22 ` Peng Fan
2025-11-20 14:42 ` Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 8/8] mmc: sdhci-cadence6: Add DLL master control and improve tuning reliability Tanmay Kathpalia
2025-11-18 6:24 ` Peng Fan
2025-11-20 14:50 ` Tanmay Kathpalia
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=099ad344-80c8-4f88-8ddc-8ff6012c5974@altera.com \
--to=tanmay.kathpalia@altera.com \
--cc=balsundar.ponnusamy@altera.com \
--cc=jh80.chung@samsung.com \
--cc=marex@denx.de \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=tien.fong.chee@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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