On Mon, Aug 17, 2026 at 11:31:52AM +0200, Linus Walleij wrote:
> Obtain the optional vmmc and vqmmc regulators and configure them for
> the normal SD voltage range before card initialization.
> 
> The Ux500 boards supply their SD cards from AB8500 or AB8505 AUX3,
> whose highest voltage selector is 2.91 V. Request that exact voltage
> for the Ux500 MMCI variant while retaining the normal 3.3 V target for
> other PL180 implementations.
> 
> Ignore the unsupported set-value operation for fixed regulators; their
> voltage is already described by their fixed constraints.
> 
> Signed-off-by: Linus Walleij <[email protected]>
> ---
>  drivers/mmc/arm_pl180_mmci.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index af21b814641e..654608b7e74c 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -16,6 +16,7 @@
>  #include <log.h>
>  #include <malloc.h>
>  #include <mmc.h>
> +#include <power/regulator.h>
>  #include <dm/device_compat.h>
>  #include <dm.h>
>  
> @@ -28,11 +29,22 @@
>  #define MMC_CLOCK_MAX        48000000
>  #define MMC_CLOCK_MIN        400000
>  
> +#define SD_VOLTAGE_MIN_UV    2700000
> +#define SD_VOLTAGE_UV                3300000
> +#define SD_VOLTAGE_MAX_UV    3600000
> +#define UX500_SD_VOLTAGE_UV  2910000
> +
>  struct arm_pl180_mmc_plat {
>       struct mmc_config cfg;
>       struct mmc mmc;
>  };
>  
> +static int arm_pl180_set_supply_voltage(struct udevice *supply, int 
> target_uV)
> +{
> +     return regulator_set_value_clamp(supply, SD_VOLTAGE_MIN_UV,
> +                                      target_uV, SD_VOLTAGE_MAX_UV);
> +}
> +
>  static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
>  {
>       u32 hoststatus, statusmask;
> @@ -385,6 +397,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
>       struct pl180_mmc_host *host = dev_get_priv(dev);
>       struct mmc_config *cfg = &pdata->cfg;
>       struct clk clk;
> +     int supply_uV = SD_VOLTAGE_UV;
>       u32 periphid;
>       int ret;
>  
> @@ -422,6 +435,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
>               cfg->voltages = VOLTAGE_WINDOW_MMC;
>               cfg->f_min = host->clock_in / (2 + SDI_CLKCR_CLKDIV_INIT_V2);
>               host->version2 = true;
> +             supply_uV = UX500_SD_VOLTAGE_UV;
>               break;

Do we need to differentiate between MMC and SD here and for the voltage
below? There seems to be the magic number VOLTAGE_WINDOW_MMC /
VOLTAGE_WINDOW_SD here, which I have set to MMC in the Ux500 case above.
The other platforms have it set to VOLTAGE_WINDOW_SD...

If I'm reading this correctly this voltage is sent to the card to let
it pick the preferred voltage, but it doesn't look like U-Boot is
designed to act on that signal...

Thanks,
Stephan

Reply via email to