linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Philip Rakity <prakity@marvell.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Chris Ball <cjb@laptop.org>, Magnus Damm <magnus.damm@gmail.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH 4/5 v3] mmc: add a function to get a regulator, supplying card's Vdd
Date: Mon, 28 May 2012 11:12:18 +0300	[thread overview]
Message-ID: <4FC33362.4010806@intel.com> (raw)
In-Reply-To: <1925406B-D680-40BB-890A-78447EEB4583@marvell.com>

On 28/05/12 06:32, Philip Rakity wrote:
> 
> 
> I have started looking at this area and I am rather confused.  It seems to me two "dedicated" regulators are required.

It probably pays not to assume too much about regulators.  For example:

Sometimes vccq is always on, so there may be just 1 regulator for vcc.

wl12xx/SDIO is setup with a fake regulator that actually controls
the enable line.

There is a case where power is supplied at a different voltage than
spec'ed i.e. commit 6e8201f57c9359c9c5dc8f9805c15a4392492a10

> One regulator controls VDD (vcc) and this is the regulator called vmmc.  This regulator MAY support the ability to switch voltages and MAY support the ability to be turned on and off.
> The other regulator supports signal voltage (vccq) for UHS and SDXC cards.  Currently this is not in sdhci.c (I have a patch for this in preparation).  Use of this regulator requires that the VDD regulator be capable of being set to 1.8 or 3.3v and be capable of being turned on/off.  on/off support is needed is the switch to 1.8v signaling fails for any reason.
> 
> 
> 
> On May 27, 2012, at 8:20 PM, Ulf Hansson wrote:
> 
>> Hi Guennadi,
>>
>> On 25 May 2012 17:14, Guennadi Liakhovetski <g.liakhovetski@gmx.de> wrote:
>>> Add a function to get a regulator, supplying card's Vdd on a specific host.
>>> If such a regulator is found, the function checks, whether a valid OCR mask
>>> can be obtained from this regulator.
>>>
>>> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
>>> ---
>>>
>>> v3: remove bogus attempts to ignore the dummy regulator, drop the check
>>> for whether the regulator can change status, do not assign
>>> MMC_CAP_POWER_OFF_CARD automatically. Thanks to Mark and Magnus for
>>> comments.
>>>
>>>  drivers/mmc/core/core.c  |   17 +++++++++++++++++
>>>  include/linux/mmc/host.h |    6 ++++++
>>>  2 files changed, 23 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
>>> index 0b6141d..0f92ec0 100644
>>> --- a/drivers/mmc/core/core.c
>>> +++ b/drivers/mmc/core/core.c
>>> @@ -1013,6 +1013,23 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
>>>  }
>>>  EXPORT_SYMBOL(mmc_regulator_set_ocr);
>>>
>>> +struct regulator *mmc_regulator_get_vmmc(struct mmc_host *mmc)
>>> +{
>>> +       struct device *dev = mmc_dev(mmc);
>>> +       struct regulator *supply = devm_regulator_get(dev, "vmmc");
>>> +       int ret;
>>> +
>>> +       if (IS_ERR(supply))
>>> +               return NULL;
>>> +
>>> +       ret = mmc_regulator_get_ocrmask(supply);
>>> +       if (ret > 0)
>>
>> Could we have an "else" were a dev_warn prints some info and as well
>> the "ret" maybe?
>>
>>> +               mmc->ocr_avail = ret;
>>> +
>>> +       return supply;
>>> +}
>>> +EXPORT_SYMBOL(mmc_regulator_get_vmmc);
>>> +
>>>  #endif /* CONFIG_REGULATOR */
>>>
>>>  /*
>>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>>> index 0707d22..368b317 100644
>>> --- a/include/linux/mmc/host.h
>>> +++ b/include/linux/mmc/host.h
>>> @@ -364,6 +364,7 @@ int mmc_regulator_get_ocrmask(struct regulator *supply);
>>>  int mmc_regulator_set_ocr(struct mmc_host *mmc,
>>>                        struct regulator *supply,
>>>                        unsigned short vdd_bit);
>>> +struct regulator *mmc_regulator_get_vmmc(struct mmc_host *mmc);
>>>  #else
>>>  static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
>>>  {
>>> @@ -376,6 +377,11 @@ static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
>>>  {
>>>        return 0;
>>>  }
>>> +
>>> +static inline struct regulator *mmc_regulator_get_vmmc(struct mmc_host *mmc)
>>> +{
>>> +       return NULL;
>>> +}
>>>  #endif
>>>
>>
>> Some follow-up thoughts, if mmc_regulator_get_vmmc is supposed to be
>> used from the host drivers, the mmc_regulator_get_ocrmask function do
>> no longer have to be an exported function, but instead a static
>> function on core.c I suppose this can be fixed in separate patch,
>> where we also add mmc_regulator_get_vmmc for all host drivers?
> 
> 
>  have started looking at this area and I am rather confused.  It seems to me two "dedicated" regulators are required.
> One regulator controls VDD (vcc) and this is the regulator called vmmc.  This regulator MAY support the ability to switch voltages and MAY support the ability to be turned on and off.  The main sdhci.c code needs to check the voltages supported by the regulator against the voltages that the host controller supports and adjust the  mmc capabilities to the common set.  I don't think we do this at the moment.
> 
> The other regulator supports signal voltage (vccq) for UHS and SDXC cards.  Currently this is not in sdhci.c (I have a patch for this in preparation).  Use of this regulator requires that the vccq regulator be capable of being set to 1.8 or 3.3v and the VDD (vmmc) regulator be capable of being turned on/off.  on/off support is needed is the switch to 1.8v signaling fails for any reason.
> 
> 
> 
>>
>> Kind regards
>> Ulf Hansson
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2012-05-28  8:12 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 15:14 [PATCH 0/0/6 v3] mmc core, tmio / sdhi and sh-mmcif updates Guennadi Liakhovetski
2012-05-25 15:14 ` [PATCH 0/3:1/6 v3] mmc: sh-mmcif: clock management updates Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 1/3 v3] mmc: sh_mmcif: simplify and use meaningful label names in error-handling Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 2/3 v3] mmc: sh_mmcif: fix clock management Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 3/3 v3] mmc: sh_mmcif: re-read the clock frequency every time the clock is turned on Guennadi Liakhovetski
2012-05-25 15:14 ` [PATCH 0/5:2/6 v3] mmc: sh_mmcif: add regulator support Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 1/5 v3] mmc: sh_mmcif: remove redundant .down_pwr() callback Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 2/5 v3] sh: ecovec: remove unused .down_pwr() MMCIF callback Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 3/5 v3] mmc: sh_mmcif: remove unused .down_pwr() callback Guennadi Liakhovetski
2012-05-25 15:14   ` [PATCH 4/5 v3] mmc: add a function to get a regulator, supplying card's Vdd Guennadi Liakhovetski
2012-05-28  3:20     ` Ulf Hansson
2012-05-28  3:32       ` Philip Rakity
2012-05-28  8:12         ` Adrian Hunter [this message]
2012-05-28 14:43           ` Mark Brown
2012-06-11 12:39             ` Guennadi Liakhovetski
2012-06-11 14:23               ` Mark Brown
2012-06-11 14:36                 ` Philip Rakity
2012-06-11 14:43                   ` Ulf Hansson
2012-05-28 14:45     ` Mark Brown
2012-06-11 11:03       ` Guennadi Liakhovetski
2012-06-11 13:41         ` Chris Ball
2012-05-25 15:14   ` [PATCH 5/5 v3] mmc: sh_mmcif: add regulator support Guennadi Liakhovetski
2012-05-25 15:15 ` [PATCH 0/8:3/6 v3] mmc: tmio: clock and PM updates Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 1/8 v3] mmc: tmio: stop interface clock before runtime PM suspending Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 2/8 v3] mmc: tmio: don't needlessly enable interrupts during probing Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 3/8 v3] mmc: tmio: add callbacks to enable-update and disable the interface clock Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 4/8 v3] mmc: sdhi: implement tmio-mmc clock enable-update and disable callbacks Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 5/8 v3] mmc: tmio: add regulator support Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 6/8 v3] mmc: sdhi: do not install dummy callbacks Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 7/8 v3] mmc: tmio: use MMC opcode defines instead of numbers Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 8/8 v3] mmc: tmio: remove a duplicated comment line Guennadi Liakhovetski
2012-05-25 15:15 ` [PATCH 00/10:4/6 v3] mmc: cd-gpio: extend to handle more slot functions Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 01/10 v3] mmc: extend and rename cd-gpio helpers to handle more slot GPIO functions Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 02/10 v3] mmc: use a more generic name for slot function types and fields Guennadi Liakhovetski
2012-05-25 15:15   ` [PATCH 03/10 v3] mmc: add two capability flags for CD and WP signal polarity Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 04/10 v3] mmc: add CD GPIO polling support to slot functions Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 05/10 v3] mmc: convert slot functions to managed allocation Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 06/10 v3] mmc: add WP pin handler to slot functions Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 07/10 v3] mmc: tmio: support caps2 flags Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 08/10 v3] mmc: sh_mobile_sdhi: " Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 09/10 v3] ARM: mach-shmobile: specify inverted SDHI card-detect signal polarity Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 10/10 v3] mmc: tmio: use generic GPIO CD and WP handlers Guennadi Liakhovetski
2012-05-25 15:16 ` [PATCH 0/2:5/6 v3] mmc: add primitive OF support to sh-mmcif and sdhi Guennadi Liakhovetski
2012-05-25 15:16   ` [PATCH 1/2 v3] mmc: sdhi: add OF support, make platform data optional Guennadi Liakhovetski
2012-05-25 15:17   ` [PATCH 2/2 v3] mmc: sh-mmcif: " Guennadi Liakhovetski
2012-05-25 15:17 ` [PATCH 0/3:6/6 v3] sh, ARM: mach-shmobile: update MMC platform data Guennadi Liakhovetski
2012-05-25 15:17   ` [PATCH 1/3 v3] sh: ecovec: switch MMC power control to regulators Guennadi Liakhovetski
2012-05-25 15:17   ` [PATCH 2/3 v3] ARM: mach-shmobile: switch all SDHI instances on mackerel to use GPIO CD Guennadi Liakhovetski
2012-05-25 15:17   ` [PATCH 3/3 v3] ARM: mach-shmobile: specify IRQ names on mackerel SDHI0 interface Guennadi Liakhovetski
2012-05-25 15:31 ` [PATCH 0/0/6 v3] mmc core, tmio / sdhi and sh-mmcif updates Guennadi Liakhovetski
2012-05-25 15:45   ` Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 0/3:1/6 v3] mmc: sh-mmcif: clock management updates Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 1/3 v3] mmc: sh_mmcif: simplify and use meaningful label names in error-handling Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 2/3 v3] mmc: sh_mmcif: fix clock management Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 3/3 v3] mmc: sh_mmcif: re-read the clock frequency every time the clock is turned on Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 0/5:2/6 v3] mmc: sh_mmcif: add regulator support Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 1/5 v3] mmc: sh_mmcif: remove redundant .down_pwr() callback Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 2/5 v3] sh: ecovec: remove unused .down_pwr() MMCIF callback Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 3/5 v3] mmc: sh_mmcif: remove unused .down_pwr() callback Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 4/5 v3] mmc: add a function to get a regulator, supplying card's Vdd Guennadi Liakhovetski
2012-05-28 14:46     ` Mark Brown
2012-05-25 15:45   ` [PATCH 5/5 v3] mmc: sh_mmcif: add regulator support Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 0/8:3/6 v3] mmc: tmio: clock and PM updates Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 1/8 v3] mmc: tmio: stop interface clock before runtime PM suspending Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 2/8 v3] mmc: tmio: don't needlessly enable interrupts during probing Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 3/8 v3] mmc: tmio: add callbacks to enable-update and disable the interface clock Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 4/8 v3] mmc: sdhi: implement tmio-mmc clock enable-update and disable callbacks Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 5/8 v3] mmc: tmio: add regulator support Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 6/8 v3] mmc: sdhi: do not install dummy callbacks Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 7/8 v3] mmc: tmio: use MMC opcode defines instead of numbers Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 8/8 v3] mmc: tmio: remove a duplicated comment line Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 00/10:4/6 v3] mmc: cd-gpio: extend to handle more slot functions Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 01/10 v3] mmc: extend and rename cd-gpio helpers to handle more slot GPIO functions Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 02/10 v3] mmc: use a more generic name for slot function types and fields Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 03/10 v3] mmc: add two capability flags for CD and WP signal polarity Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 04/10 v3] mmc: add CD GPIO polling support to slot functions Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 05/10 v3] mmc: convert slot functions to managed allocation Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 06/10 v3] mmc: add WP pin handler to slot functions Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 07/10 v3] mmc: tmio: support caps2 flags Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 08/10 v3] mmc: sh_mobile_sdhi: " Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 09/10 v3] ARM: mach-shmobile: specify inverted SDHI card-detect signal polarity Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 10/10 v3] mmc: tmio: use generic GPIO CD and WP handlers Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 0/2:5/6 v3] mmc: add primitive OF support to sh-mmcif and sdhi Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 1/2 v3] mmc: sdhi: add OF support, make platform data optional Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 2/2 v3] mmc: sh-mmcif: " Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 0/3:6/6 v3] sh, ARM: mach-shmobile: update MMC platform data Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 1/3 v3] sh: ecovec: switch MMC power control to regulators Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 2/3 v3] ARM: mach-shmobile: switch all SDHI instances on mackerel to use GPIO CD Guennadi Liakhovetski
2012-05-25 15:45   ` [PATCH 3/3 v3] ARM: mach-shmobile: specify IRQ names on mackerel SDHI0 interface Guennadi Liakhovetski
2012-05-25 16:01   ` [PATCH 0/0/6 v3] mmc core, tmio / sdhi and sh-mmcif updates Guennadi Liakhovetski

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=4FC33362.4010806@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cjb@laptop.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-mmc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=prakity@marvell.com \
    --cc=ulf.hansson@linaro.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).