All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Michael Wu <michael@allwinnertech.com>
Cc: ulf.hansson@linaro.org, wens@csie.org, samuel@sholland.org,
	andre.przywara@arm.com, 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
Subject: Re: [PATCH v2] mmc: sunxi-mmc: check ocr_avail on resource request
Date: Wed, 12 Jan 2022 10:34:15 +0100	[thread overview]
Message-ID: <20220112093415.wdy3ht5yizw5lffl@houat> (raw)
In-Reply-To: <20220104060325.3957-1-michael@allwinnertech.com>

[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]

Hi,

On Tue, Jan 04, 2022 at 02:03:25PM +0800, Michael Wu wrote:
> Some platforms have no regulator, discrete power devices are used instead.

Is it really the case? vmmc at least should be mandatory so a platform
not having a regulator would violate the binding itself.

> However, sunxi_mmc_probe does not catch this exception when regulator is
> absent in DTS. This leads to sd or eMMC init failure.

This will still happen with your patch though?

> 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 = <&reg_dummy_vmmc>;
> }
> 
> In this patch, we print an error message and abort the probe process if
> the regulator is not specified in DTS.

I'm fine with the patch itself, but it's really not clear to me what
situation is being fixed or improved here.

You're first mentioning that this is fixing the driver probing even if a
regulator is absent, but then states (rightfully) that in such a case we
should use a fixed regulator. So we should always have a regulator then?

I assume that you want the driver to properly error out instead of going
on if either a regulator is missing or if its voltages are out of range?

If the former, then we should probably check if host->mmc->supply.vmmc
returned an error. If the latter, then yes, checking ocr_avail is
probably fine but we should make it clearer in the error message that
it's what it's about.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime@cerno.tech>
To: Michael Wu <michael@allwinnertech.com>
Cc: ulf.hansson@linaro.org, wens@csie.org, samuel@sholland.org,
	andre.przywara@arm.com, 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
Subject: Re: [PATCH v2] mmc: sunxi-mmc: check ocr_avail on resource request
Date: Wed, 12 Jan 2022 10:34:15 +0100	[thread overview]
Message-ID: <20220112093415.wdy3ht5yizw5lffl@houat> (raw)
In-Reply-To: <20220104060325.3957-1-michael@allwinnertech.com>


[-- Attachment #1.1: Type: text/plain, Size: 1731 bytes --]

Hi,

On Tue, Jan 04, 2022 at 02:03:25PM +0800, Michael Wu wrote:
> Some platforms have no regulator, discrete power devices are used instead.

Is it really the case? vmmc at least should be mandatory so a platform
not having a regulator would violate the binding itself.

> However, sunxi_mmc_probe does not catch this exception when regulator is
> absent in DTS. This leads to sd or eMMC init failure.

This will still happen with your patch though?

> 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 = <&reg_dummy_vmmc>;
> }
> 
> In this patch, we print an error message and abort the probe process if
> the regulator is not specified in DTS.

I'm fine with the patch itself, but it's really not clear to me what
situation is being fixed or improved here.

You're first mentioning that this is fixing the driver probing even if a
regulator is absent, but then states (rightfully) that in such a case we
should use a fixed regulator. So we should always have a regulator then?

I assume that you want the driver to properly error out instead of going
on if either a regulator is missing or if its voltages are out of range?

If the former, then we should probably check if host->mmc->supply.vmmc
returned an error. If the latter, then yes, checking ocr_avail is
probably fine but we should make it clearer in the error message that
it's what it's about.

Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-01-12  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  6:03 [PATCH v2] mmc: sunxi-mmc: check ocr_avail on resource request Michael Wu
2022-01-04  6:03 ` Michael Wu
2022-01-12  9:34 ` Maxime Ripard [this message]
2022-01-12  9:34   ` Maxime Ripard
2022-01-12 10:37   ` Ulf Hansson
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=20220112093415.wdy3ht5yizw5lffl@houat \
    --to=maxime@cerno.tech \
    --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=michael@allwinnertech.com \
    --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 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.