From: Michael Wu <michael@allwinnertech.com>
To: ulf.hansson@linaro.org, mripard@kernel.org, wens@csie.org,
samuel@sholland.org, andre.przywara@arm.com
Cc: jernej.skrabec@gmail.com, linux-mmc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
Michael Wu <michael@allwinnertech.com>
Subject: [PATCH v2] mmc: sunxi-mmc: check ocr_avail on resource request
Date: Tue, 4 Jan 2022 14:03:25 +0800 [thread overview]
Message-ID: <20220104060325.3957-1-michael@allwinnertech.com> (raw)
Some platforms have no regulator, discrete power devices are used instead.
However, sunxi_mmc_probe does not catch this exception when regulator is
absent in DTS. This leads to sd or eMMC init failure.
To solve this, a fixed vmmc regulator must be hooked up in DTS, like this:
reg_dummy_vmmc: dummy_vmmc {
compatible = "regulator-fixed";
regulator-name = "dummy-vmmc";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
mmc0:mmc@4020000 {
compatible = "allwinner,sun50i-a100-emmc";
device_type = "mmc0";
vmmc-supply = <®_dummy_vmmc>;
}
In this patch, we print an error message and abort the probe process if
the regulator is not specified in DTS.
Signed-off-by: Michael Wu <michael@allwinnertech.com>
---
drivers/mmc/host/sunxi-mmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 2702736a1c57..0da74bddaf87 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1300,6 +1300,11 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
if (ret)
return ret;
+ if (!host->mmc->ocr_avail) {
+ dev_err(&pdev->dev, "Could not get mmc regulator\n");
+ return -EINVAL;
+ }
+
host->reg_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(host->reg_base))
return PTR_ERR(host->reg_base);
--
2.29.0
next reply other threads:[~2022-01-04 6:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 6:03 Michael Wu [this message]
2022-01-12 9:34 ` [PATCH v2] mmc: sunxi-mmc: check ocr_avail on resource request Maxime Ripard
2022-01-12 10:37 ` Ulf Hansson
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=20220104060325.3957-1-michael@allwinnertech.com \
--to=michael@allwinnertech.com \
--cc=andre.przywara@arm.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=ulf.hansson@linaro.org \
--cc=wens@csie.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).