From: Linus Walleij <linusw@kernel.org>
To: u-boot@lists.u-boot-project.org, Tom Rini <trini@konsulko.com>,
Stefan Hansson <newbyte@postmarketos.org>,
Stephan Gerhold <stephan.gerhold@linaro.org>
Cc: Linus Walleij <linusw@kernel.org>
Subject: [PATCH v2 3/8] mmc: arm_pl180: Set initial supply voltages
Date: Mon, 17 Aug 2026 11:31:52 +0200 [thread overview]
Message-ID: <20260817-ux500-external-sdcard-v2-3-ca9a110bd9c6@kernel.org> (raw)
In-Reply-To: <20260817-ux500-external-sdcard-v2-0-ca9a110bd9c6@kernel.org>
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 <linusw@kernel.org>
---
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;
default:
host->version2 = false; /* ARM variant */
@@ -440,6 +454,26 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
if (dev_read_bool(dev, "st,sig-pin-fbclk"))
host->pwr_init |= SDI_PWR_FBCLKEN;
+ if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
+ ret = device_get_supply_regulator(dev, "vmmc-supply",
+ &mmc->vmmc_supply);
+ if (!ret) {
+ ret = arm_pl180_set_supply_voltage(mmc->vmmc_supply,
+ supply_uV);
+ if (ret && ret != -ENOSYS)
+ return ret;
+ }
+
+ ret = device_get_supply_regulator(dev, "vqmmc-supply",
+ &mmc->vqmmc_supply);
+ if (!ret) {
+ ret = arm_pl180_set_supply_voltage(mmc->vqmmc_supply,
+ supply_uV);
+ if (ret && ret != -ENOSYS)
+ return ret;
+ }
+ }
+
gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
ret = mmc_of_parse(dev, cfg);
--
2.55.0
next prev parent reply other threads:[~2026-08-17 13:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 9:31 [PATCH v2 0/8] arm: u8500: Enable upstream DT based SD card boot Linus Walleij
2026-08-17 9:31 ` [PATCH v2 1/8] pinctrl: Add compact Nomadik pin controller Linus Walleij
2026-08-17 15:57 ` Stephan Gerhold
2026-08-17 9:31 ` [PATCH v2 2/8] mmc: arm_pl180: Configure Ux500 signal direction Linus Walleij
2026-08-17 15:59 ` Stephan Gerhold
2026-08-17 9:31 ` Linus Walleij [this message]
2026-08-17 16:15 ` [PATCH v2 3/8] mmc: arm_pl180: Set initial supply voltages Stephan Gerhold
2026-08-17 9:31 ` [PATCH v2 4/8] power: regulator: Add AB8500 AUX3 support Linus Walleij
2026-08-17 16:21 ` Stephan Gerhold
2026-08-17 9:31 ` [PATCH v2 5/8] configs: stemmy: Enable SD card regulators Linus Walleij
2026-08-17 16:24 ` Stephan Gerhold
2026-08-17 9:31 ` [PATCH v2 6/8] configs: stemmy: Boot EFI from external SD card Linus Walleij
2026-08-17 16:29 ` Stephan Gerhold
2026-08-17 9:31 ` [PATCH v2 7/8] arm: u8500: Switch Stemmy to upstream Janice device tree Linus Walleij
2026-08-17 16:45 ` Stephan Gerhold
2026-08-17 20:54 ` Linus Walleij
2026-08-18 10:39 ` Stephan Gerhold
2026-08-18 13:31 ` Linus Walleij
2026-08-19 8:53 ` Linus Walleij
2026-08-17 9:31 ` [PATCH v2 8/8] arm: u8500: Give Golden panel regulators unique names Linus Walleij
2026-08-17 16:47 ` Stephan Gerhold
2026-08-17 20:36 ` Linus Walleij
2026-08-17 21:14 ` Tom Rini
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=20260817-ux500-external-sdcard-v2-3-ca9a110bd9c6@kernel.org \
--to=linusw@kernel.org \
--cc=newbyte@postmarketos.org \
--cc=stephan.gerhold@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.