From: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
To: Marek Vasut <marek.vasut@mailbox.org>, u-boot@lists.denx.de
Cc: peng.fan@nxp.com, jh80.chung@samsung.com, trini@konsulko.com,
marex@denx.de, tien.fong.chee@altera.com, festevam@gmail.com,
ivitro@gmail.com, max.merchel@ew.tq-group.com
Subject: Re: [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling"
Date: Thu, 15 Jan 2026 15:09:54 +0530 [thread overview]
Message-ID: <01992946-b7df-4a0c-bb62-4658caadabcc@altera.com> (raw)
In-Reply-To: <f6ebd731-cc2c-47b1-98d4-961abd40ef85@mailbox.org>
Hi Marek,
On 1/9/2026 4:51 AM, Marek Vasut wrote:
> On 1/8/26 12:40 PM, Tanmay Kathpalia wrote:
>> This reverts commit aebb523a23818a8ee4199c9532b51e3d4020696f.
>>
>> The change to use dev_read_u32_default() with a default value of 0
>> causes regression for host controller drivers that hardcode f_max
>> before calling mmc_of_parse().
>>
>> When the "max-frequency" property is not specified in the device tree,
>> dev_read_u32_default() returns 0, which overwrites the previously
>> configured f_max value set by the driver. This effectively resets
>> the maximum frequency to 0, breaking MMC functionality for those
>> controllers.
>>
>> Revert to the original dev_read_u32() behavior which only updates
>> cfg->f_max when the "max-frequency" property is explicitly present
>> in the device tree, preserving driver-configured values otherwise.
>>
>> Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
>> ---
>> drivers/mmc/mmc-uclass.c | 9 ++-------
>> 1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
>> index bf0bea93853..2f4dc5bd887 100644
>> --- a/drivers/mmc/mmc-uclass.c
>> +++ b/drivers/mmc/mmc-uclass.c
>> @@ -243,13 +243,8 @@ int mmc_of_parse(struct udevice *dev, struct
>> mmc_config *cfg)
>> return -EINVAL;
>> }
>> - /*
>> - * Maximum frequency is obtained from the optional "max-
>> frequency" property.
>> - * If not specified in device tree, defaults to 0 and
>> sdhci_setup_cfg()
>> - * will set the MMC configuration maximum frequency to the host
>> controller's
>> - * maximum base clock frequency from capabilities register.
>> - */
>> - cfg->f_max = dev_read_u32_default(dev, "max-frequency", 0);
>> + /* f_max is obtained from the optional "max-frequency" property */
>> + dev_read_u32(dev, "max-frequency", &cfg->f_max);
>
> Why not do this then ?
>
> cfg->f_max = dev_read_u32_default(dev, "max-frequency", cfg->f_max);
Good point — you're right.
cfg->f_max = dev_read_u32_default(dev, "max-frequency", cfg->f_max);
is cleaner and safer.
I'll send a follow-up patch with this change.
Thanks!
prev parent reply other threads:[~2026-01-15 9:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 11:40 [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling" Tanmay Kathpalia
2026-01-08 13:21 ` Peng Fan
2026-01-08 23:21 ` Marek Vasut
2026-01-15 9:39 ` Tanmay Kathpalia [this message]
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=01992946-b7df-4a0c-bb62-4658caadabcc@altera.com \
--to=tanmay.kathpalia@altera.com \
--cc=festevam@gmail.com \
--cc=ivitro@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=marek.vasut@mailbox.org \
--cc=marex@denx.de \
--cc=max.merchel@ew.tq-group.com \
--cc=peng.fan@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