* [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling"
@ 2026-01-08 11:40 Tanmay Kathpalia
2026-01-08 13:21 ` Peng Fan
2026-01-08 23:21 ` Marek Vasut
0 siblings, 2 replies; 4+ messages in thread
From: Tanmay Kathpalia @ 2026-01-08 11:40 UTC (permalink / raw)
To: u-boot
Cc: peng.fan, jh80.chung, trini, marex, tien.fong.chee,
tanmay.kathpalia, festevam, ivitro, max.merchel
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);
if (dev_read_bool(dev, "cap-sd-highspeed"))
cfg->host_caps |= MMC_CAP(SD_HS);
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling"
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
1 sibling, 0 replies; 4+ messages in thread
From: Peng Fan @ 2026-01-08 13:21 UTC (permalink / raw)
To: Tanmay Kathpalia
Cc: u-boot, peng.fan, jh80.chung, trini, marex, tien.fong.chee,
festevam, ivitro, max.merchel
On Thu, Jan 08, 2026 at 03:40:02AM -0800, 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>
Applied.
Thanks,
Peng
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling"
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
1 sibling, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2026-01-08 23:21 UTC (permalink / raw)
To: Tanmay Kathpalia, u-boot
Cc: peng.fan, jh80.chung, trini, marex, tien.fong.chee, festevam,
ivitro, max.merchel
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);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling"
2026-01-08 23:21 ` Marek Vasut
@ 2026-01-15 9:39 ` Tanmay Kathpalia
0 siblings, 0 replies; 4+ messages in thread
From: Tanmay Kathpalia @ 2026-01-15 9:39 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: peng.fan, jh80.chung, trini, marex, tien.fong.chee, festevam,
ivitro, max.merchel
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!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-15 9:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox