All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: "Chaotian Jing" <chaotian.jing@mediatek.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"James Liao" <jamesjj.liao@mediatek.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	srv_heupstream <srv_heupstream@mediatek.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Hongzhou Yang" <hongzhou.yang@mediatek.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Bin Zhang (章斌)" <bin.zhang@mediatek.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"Chris Ball" <chris@printf.net>,
	"Will Deacon" <will.deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	linux-mediatek@lists.infradead.org,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Joe.C" <yingjoe.chen@mediatek.com>,
	"Eddie Huang" <eddie.huang@mediatek.com>
Subject: Re: [PATCH v2 2/5] mmc: mediatek: Add Mediatek MMC driver
Date: Fri, 17 Apr 2015 11:37:44 +0200	[thread overview]
Message-ID: <CAPDyKFr5NDTnx_3brksimhqGj+0Rk=tH5fLfWyRddRdPf7i6Lg@mail.gmail.com> (raw)
In-Reply-To: <20150417091213.GM4946@pengutronix.de>

On 17 April 2015 at 11:12, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Ulf,
>
> On Tue, Mar 31, 2015 at 02:23:06PM +0200, Ulf Hansson wrote:
>> On 17 March 2015 at 04:13, Chaotian Jing <chaotian.jing@mediatek.com> wrote:
>> > +
>> > +       msdc_set_buswidth(host, ios->bus_width);
>> > +
>> > +       /* Suspend/Resume will do power off/on */
>> > +       switch (ios->power_mode) {
>> > +       case MMC_POWER_UP:
>> > +               msdc_init_hw(host);
>> > +               if (!IS_ERR(mmc->supply.vmmc)) {
>> > +                       ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
>> > +                                       ios->vdd);
>> > +                       if (ret) {
>> > +                               dev_err(host->dev, "Failed to set vmmc power!\n");
>> > +                               return;
>> > +                       }
>> > +               }
>> > +               break;
>> > +       case MMC_POWER_ON:
>> > +               if (!IS_ERR(mmc->supply.vqmmc)) {
>> > +                       ret = regulator_enable(mmc->supply.vqmmc);
>>
>> The calls to regulator_enable|disable() for the vqmmc will not be
>> balanced properly here. You need a local cache variable like
>> "is_enabled" to keep track of this.
>
> Shouldn't the MMC core provide balanced hooks for this? What about
> MMC_POWER_UP, can this be used for enabling regulators?

Currently host drivers deals with vqmmc enabling/disabling, setting
voltage, etc - entirely by them selves.

Dough Anderson is working on fixing that:
http://lkml.iu.edu/hypermail/linux/kernel/1503.1/03108.html

MMC_POWER_UP is when vmmc shall be enabled.

MMC_POWER_ON is when vqmmc shall be enabled.

Kind regards
Uffe

WARNING: multiple messages have this Message-ID (diff)
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: "Chaotian Jing" <chaotian.jing@mediatek.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"James Liao" <jamesjj.liao@mediatek.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	srv_heupstream <srv_heupstream@mediatek.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Hongzhou Yang" <hongzhou.yang@mediatek.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Bin Zhang (章斌)" <bin.zhang@mediatek.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"Chris Ball" <chris@printf.net>,
	"Will Deacon" <will.deacon@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	linux-mediatek@lists.infradead.org,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Joe.C" <yingjoe.chen@mediatek.com>,
	"Eddie Huang" <eddie.huang@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/5] mmc: mediatek: Add Mediatek MMC driver
Date: Fri, 17 Apr 2015 11:37:44 +0200	[thread overview]
Message-ID: <CAPDyKFr5NDTnx_3brksimhqGj+0Rk=tH5fLfWyRddRdPf7i6Lg@mail.gmail.com> (raw)
In-Reply-To: <20150417091213.GM4946@pengutronix.de>

On 17 April 2015 at 11:12, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Ulf,
>
> On Tue, Mar 31, 2015 at 02:23:06PM +0200, Ulf Hansson wrote:
>> On 17 March 2015 at 04:13, Chaotian Jing <chaotian.jing@mediatek.com> wrote:
>> > +
>> > +       msdc_set_buswidth(host, ios->bus_width);
>> > +
>> > +       /* Suspend/Resume will do power off/on */
>> > +       switch (ios->power_mode) {
>> > +       case MMC_POWER_UP:
>> > +               msdc_init_hw(host);
>> > +               if (!IS_ERR(mmc->supply.vmmc)) {
>> > +                       ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
>> > +                                       ios->vdd);
>> > +                       if (ret) {
>> > +                               dev_err(host->dev, "Failed to set vmmc power!\n");
>> > +                               return;
>> > +                       }
>> > +               }
>> > +               break;
>> > +       case MMC_POWER_ON:
>> > +               if (!IS_ERR(mmc->supply.vqmmc)) {
>> > +                       ret = regulator_enable(mmc->supply.vqmmc);
>>
>> The calls to regulator_enable|disable() for the vqmmc will not be
>> balanced properly here. You need a local cache variable like
>> "is_enabled" to keep track of this.
>
> Shouldn't the MMC core provide balanced hooks for this? What about
> MMC_POWER_UP, can this be used for enabling regulators?

Currently host drivers deals with vqmmc enabling/disabling, setting
voltage, etc - entirely by them selves.

Dough Anderson is working on fixing that:
http://lkml.iu.edu/hypermail/linux/kernel/1503.1/03108.html

MMC_POWER_UP is when vmmc shall be enabled.

MMC_POWER_ON is when vqmmc shall be enabled.

Kind regards
Uffe

WARNING: multiple messages have this Message-ID (diff)
From: ulf.hansson@linaro.org (Ulf Hansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/5] mmc: mediatek: Add Mediatek MMC driver
Date: Fri, 17 Apr 2015 11:37:44 +0200	[thread overview]
Message-ID: <CAPDyKFr5NDTnx_3brksimhqGj+0Rk=tH5fLfWyRddRdPf7i6Lg@mail.gmail.com> (raw)
In-Reply-To: <20150417091213.GM4946@pengutronix.de>

On 17 April 2015 at 11:12, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Ulf,
>
> On Tue, Mar 31, 2015 at 02:23:06PM +0200, Ulf Hansson wrote:
>> On 17 March 2015 at 04:13, Chaotian Jing <chaotian.jing@mediatek.com> wrote:
>> > +
>> > +       msdc_set_buswidth(host, ios->bus_width);
>> > +
>> > +       /* Suspend/Resume will do power off/on */
>> > +       switch (ios->power_mode) {
>> > +       case MMC_POWER_UP:
>> > +               msdc_init_hw(host);
>> > +               if (!IS_ERR(mmc->supply.vmmc)) {
>> > +                       ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,
>> > +                                       ios->vdd);
>> > +                       if (ret) {
>> > +                               dev_err(host->dev, "Failed to set vmmc power!\n");
>> > +                               return;
>> > +                       }
>> > +               }
>> > +               break;
>> > +       case MMC_POWER_ON:
>> > +               if (!IS_ERR(mmc->supply.vqmmc)) {
>> > +                       ret = regulator_enable(mmc->supply.vqmmc);
>>
>> The calls to regulator_enable|disable() for the vqmmc will not be
>> balanced properly here. You need a local cache variable like
>> "is_enabled" to keep track of this.
>
> Shouldn't the MMC core provide balanced hooks for this? What about
> MMC_POWER_UP, can this be used for enabling regulators?

Currently host drivers deals with vqmmc enabling/disabling, setting
voltage, etc - entirely by them selves.

Dough Anderson is working on fixing that:
http://lkml.iu.edu/hypermail/linux/kernel/1503.1/03108.html

MMC_POWER_UP is when vmmc shall be enabled.

MMC_POWER_ON is when vqmmc shall be enabled.

Kind regards
Uffe

  reply	other threads:[~2015-04-17  9:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  3:13 [PATCH v2 0/5] Add Mediatek MMC driver Chaotian Jing
2015-03-17  3:13 ` Chaotian Jing
     [not found] ` <1426562035-16709-1-git-send-email-chaotian.jing-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-03-17  3:13   ` [PATCH v2 1/5] mmc: dt-bindings: add Mediatek MMC bindings Chaotian Jing
2015-03-17  3:13     ` Chaotian Jing
2015-04-20  8:31     ` Sascha Hauer
2015-04-20  8:31       ` Sascha Hauer
2015-03-17  3:13   ` [PATCH v2 2/5] mmc: mediatek: Add Mediatek MMC driver Chaotian Jing
2015-03-17  3:13     ` Chaotian Jing
     [not found]     ` <1426562035-16709-3-git-send-email-chaotian.jing-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-03-31 12:23       ` Ulf Hansson
2015-03-31 12:23         ` Ulf Hansson
2015-03-31 12:23         ` Ulf Hansson
     [not found]         ` <CAPDyKFoUg1snXeOwCiKPF_daxAAfcWE0nUbRAj23Z=k9z5FCyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-03  7:22           ` 答复: " Chaotian Jing (井朝天)
2015-04-03  7:22             ` Chaotian Jing (井朝天)
2015-04-03  7:22             ` Chaotian Jing (井朝天)
2015-04-08 10:38             ` Ulf Hansson
2015-04-08 10:38               ` Ulf Hansson
     [not found]               ` <CAPDyKFrM94E8xXN_q0OqciOHC8WBC+fTOroSnnm+HDTOmWg6Gw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-10  3:17                 ` chaotian.jing
2015-04-10  3:17                   ` chaotian.jing
2015-04-17  9:12         ` Sascha Hauer
2015-04-17  9:12           ` Sascha Hauer
2015-04-17  9:12           ` Sascha Hauer
2015-04-17  9:37           ` Ulf Hansson [this message]
2015-04-17  9:37             ` Ulf Hansson
2015-04-17  9:37             ` Ulf Hansson
2015-04-07 14:01     ` Matthias Brugger
2015-04-07 14:01       ` Matthias Brugger
2015-04-07 14:01       ` Matthias Brugger
     [not found]       ` <CABuKBe+MFHJO8GXRg5KYs2t+j6U4Ynv_hCeW0YQCrS_eZ-fuLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-08  6:39         ` chaotian.jing
2015-04-08  6:39           ` chaotian.jing
2015-04-17 13:45     ` Sascha Hauer
2015-04-17 13:45       ` Sascha Hauer
     [not found]       ` <20150417134547.GN4946-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-04-19  3:22         ` chaotian.jing
2015-04-19  3:22           ` chaotian.jing
2015-03-17  3:13   ` [PATCH v2 3/5] mmc: mediatek: Add PM support for " Chaotian Jing
2015-03-17  3:13     ` Chaotian Jing
2015-03-31 14:46     ` Ulf Hansson
2015-03-31 14:46       ` Ulf Hansson
2015-03-31 14:46       ` Ulf Hansson
2015-04-03  8:27       ` 答复: " Chaotian Jing (井朝天)
2015-04-03  8:27         ` Chaotian Jing (井朝天)
2015-04-03  8:27         ` Chaotian Jing (井朝天)
2015-04-20  6:49     ` Sascha Hauer
2015-04-20  6:49       ` Sascha Hauer
2015-04-20  6:52     ` Sascha Hauer
2015-04-20  6:52       ` Sascha Hauer
2015-03-17  3:13   ` [PATCH v2 4/5] arm64: mediatek: Add Mediatek MMC support in defconfig Chaotian Jing
2015-03-17  3:13     ` Chaotian Jing
2015-03-17  3:13   ` [PATCH v2 5/5] arm64: dts: mediatek: Add MT8173 MMC dts Chaotian Jing
2015-03-17  3:13     ` Chaotian Jing

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='CAPDyKFr5NDTnx_3brksimhqGj+0Rk=tH5fLfWyRddRdPf7i6Lg@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bin.zhang@mediatek.com \
    --cc=catalin.marinas@arm.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.huang@mediatek.com \
    --cc=hongzhou.yang@mediatek.com \
    --cc=jamesjj.liao@mediatek.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=srv_heupstream@mediatek.com \
    --cc=will.deacon@arm.com \
    --cc=yingjoe.chen@mediatek.com \
    /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.