* [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
[not found] <1346748609-11115-1-git-send-email-t.figa@samsung.com>
@ 2012-09-04 8:50 ` Tomasz Figa
2012-09-05 8:36 ` Jaehoon Chung
2012-09-19 5:42 ` Chris Ball
0 siblings, 2 replies; 11+ messages in thread
From: Tomasz Figa @ 2012-09-04 8:50 UTC (permalink / raw)
To: linux-samsung-soc
Cc: linux-arm-kernel, kyungmin.park, jy0922.shim, kgene.kim,
thomas.abraham, Tomasz Figa, Ben Dooks, Chris Ball, linux-mmc
Some boards use fixed voltage regulator for vmmc supply (e.g. for eMMC
memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to operate
correctly.
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Chris Ball <cjb@laptop.org>
CC: linux-mmc@vger.kernel.org
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
drivers/mmc/host/sdhci-s3c.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
index 8a6811f..ecbde68 100644
--- a/Documentation/devicetree/bindings/mmc/mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc.txt
@@ -16,6 +16,7 @@ Optional properties:
- wp-inverted: when present, polarity on the wp gpio line is inverted
- non-removable: non-removable slot (like eMMC)
- max-frequency: maximum operating clock frequency
+- broken-voltage: vmmc regulator does not allow voltage control
Example:
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 445910e..39715b8 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -443,6 +443,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
if (!ourhost->gpios)
return -ENOMEM;
+ if (of_get_property(node, "broken-voltage", 0))
+ pdata->host_caps2 |= MMC_CAP2_BROKEN_VOLTAGE;
+
/* get the card detection method */
if (of_get_property(node, "broken-cd", 0)) {
pdata->cd_type = S3C_SDHCI_CD_NONE;
--
1.7.12
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-04 8:50 ` [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk Tomasz Figa
@ 2012-09-05 8:36 ` Jaehoon Chung
2012-09-19 5:42 ` Chris Ball
1 sibling, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2012-09-05 8:36 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, Chris Ball, linux-mmc
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
On 09/04/2012 05:50 PM, Tomasz Figa wrote:
> Some boards use fixed voltage regulator for vmmc supply (e.g. for eMMC
> memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to operate
> correctly.
>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: Chris Ball <cjb@laptop.org>
> CC: linux-mmc@vger.kernel.org
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
> drivers/mmc/host/sdhci-s3c.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
> index 8a6811f..ecbde68 100644
> --- a/Documentation/devicetree/bindings/mmc/mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/mmc.txt
> @@ -16,6 +16,7 @@ Optional properties:
> - wp-inverted: when present, polarity on the wp gpio line is inverted
> - non-removable: non-removable slot (like eMMC)
> - max-frequency: maximum operating clock frequency
> +- broken-voltage: vmmc regulator does not allow voltage control
>
> Example:
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 445910e..39715b8 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -443,6 +443,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> if (!ourhost->gpios)
> return -ENOMEM;
>
> + if (of_get_property(node, "broken-voltage", 0))
> + pdata->host_caps2 |= MMC_CAP2_BROKEN_VOLTAGE;
> +
> /* get the card detection method */
> if (of_get_property(node, "broken-cd", 0)) {
> pdata->cd_type = S3C_SDHCI_CD_NONE;
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-04 8:50 ` [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk Tomasz Figa
2012-09-05 8:36 ` Jaehoon Chung
@ 2012-09-19 5:42 ` Chris Ball
2012-09-19 10:13 ` Tomasz Figa
1 sibling, 1 reply; 11+ messages in thread
From: Chris Ball @ 2012-09-19 5:42 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, linux-mmc
Hi,
On Tue, Sep 04 2012, Tomasz Figa wrote:
> Some boards use fixed voltage regulator for vmmc supply (e.g. for eMMC
> memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to operate
> correctly.
>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: Chris Ball <cjb@laptop.org>
> CC: linux-mmc@vger.kernel.org
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
> drivers/mmc/host/sdhci-s3c.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
> index 8a6811f..ecbde68 100644
> --- a/Documentation/devicetree/bindings/mmc/mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/mmc.txt
> @@ -16,6 +16,7 @@ Optional properties:
> - wp-inverted: when present, polarity on the wp gpio line is inverted
> - non-removable: non-removable slot (like eMMC)
> - max-frequency: maximum operating clock frequency
> +- broken-voltage: vmmc regulator does not allow voltage control
>
> Example:
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 445910e..39715b8 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -443,6 +443,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> if (!ourhost->gpios)
> return -ENOMEM;
>
> + if (of_get_property(node, "broken-voltage", 0))
> + pdata->host_caps2 |= MMC_CAP2_BROKEN_VOLTAGE;
> +
> /* get the card detection method */
> if (of_get_property(node, "broken-cd", 0)) {
> pdata->cd_type = S3C_SDHCI_CD_NONE;
Is there a reason we can't make this a property on the regulator instead?
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 5:42 ` Chris Ball
@ 2012-09-19 10:13 ` Tomasz Figa
2012-09-19 10:24 ` Chris Ball
0 siblings, 1 reply; 11+ messages in thread
From: Tomasz Figa @ 2012-09-19 10:13 UTC (permalink / raw)
To: Chris Ball
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, linux-mmc
Hi Chris,
On Wednesday 19 of September 2012 01:42:01 Chris Ball wrote:
> On Tue, Sep 04 2012, Tomasz Figa wrote:
> > Some boards use fixed voltage regulator for vmmc supply (e.g. for eMMC
> > memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to operate
> > correctly.
>>
> Is there a reason we can't make this a property on the regulator instead?
Is there a reason we can't make this a property of the mmc subsystem? ;)
Now, seriously, could you elaborate on this a bit more? Do you mean that a
regulator should provide a dummy set voltage operation that would accept
any voltage?
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 10:13 ` Tomasz Figa
@ 2012-09-19 10:24 ` Chris Ball
2012-09-19 10:34 ` Tomasz Figa
0 siblings, 1 reply; 11+ messages in thread
From: Chris Ball @ 2012-09-19 10:24 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, linux-mmc
Hi Tomasz,
On Wed, Sep 19 2012, Tomasz Figa wrote:
> Hi Chris,
>
> On Wednesday 19 of September 2012 01:42:01 Chris Ball wrote:
>> On Tue, Sep 04 2012, Tomasz Figa wrote:
>> > Some boards use fixed voltage regulator for vmmc supply (e.g. for eMMC
>> > memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to operate
>> > correctly.
>>>
>> Is there a reason we can't make this a property on the regulator instead?
>
> Is there a reason we can't make this a property of the mmc subsystem? ;)
>
> Now, seriously, could you elaborate on this a bit more? Do you mean that a
> regulator should provide a dummy set voltage operation that would accept
> any voltage?
Sorry for the terseness.
It seems like we're encoding exactly the same information twice in two
different subsystems -- I don't see the point, so I'd like to think
about how we could do better.
For example, if we're only concerned about fixed regulators, could we
just detect a fixed regulator in the driver and avoid the failing call
to regulator_set_voltage() directly, without needing to go via this
capability? Seems like the capability doesn't tell us anything we
couldn't already have known.
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 10:24 ` Chris Ball
@ 2012-09-19 10:34 ` Tomasz Figa
2012-09-19 10:47 ` Chris Ball
0 siblings, 1 reply; 11+ messages in thread
From: Tomasz Figa @ 2012-09-19 10:34 UTC (permalink / raw)
To: Chris Ball
Cc: kgene.kim, jy0922.shim, linux-mmc, kyungmin.park,
linux-samsung-soc, thomas.abraham, Ben Dooks, linux-arm-kernel
Hi Chris,
On Wednesday 19 of September 2012 06:24:46 Chris Ball wrote:
> Hi Tomasz,
>
> On Wed, Sep 19 2012, Tomasz Figa wrote:
> > Hi Chris,
> >
> > On Wednesday 19 of September 2012 01:42:01 Chris Ball wrote:
> >> On Tue, Sep 04 2012, Tomasz Figa wrote:
> >> > Some boards use fixed voltage regulator for vmmc supply (e.g. for
> >> > eMMC
> >> > memories). MMC_CAP2_BROKEN_VOLTAGE must be enabled for them to
> >> > operate
> >> > correctly.
> >>
> >> Is there a reason we can't make this a property on the regulator
> >> instead?>
> > Is there a reason we can't make this a property of the mmc subsystem?
> > ;)
> >
> > Now, seriously, could you elaborate on this a bit more? Do you mean
> > that a regulator should provide a dummy set voltage operation that
> > would accept any voltage?
>
> Sorry for the terseness.
>
> It seems like we're encoding exactly the same information twice in two
> different subsystems -- I don't see the point, so I'd like to think
> about how we could do better.
>
> For example, if we're only concerned about fixed regulators, could we
> just detect a fixed regulator in the driver and avoid the failing call
> to regulator_set_voltage() directly, without needing to go via this
> capability? Seems like the capability doesn't tell us anything we
> couldn't already have known.
We could just check if the regulator provides the capability to change the
voltage.
I don't see any direct way of querying the regulator for provided
capabilities (correct me if I'm just blind), but calling
regulator_count_voltages() on the regulator and checking if the returned
value is 1 should be enough to assume that the regulator is fixed.
What do you think?
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 10:34 ` Tomasz Figa
@ 2012-09-19 10:47 ` Chris Ball
2012-09-19 10:49 ` Tomasz Figa
2012-09-19 11:02 ` Jaehoon Chung
0 siblings, 2 replies; 11+ messages in thread
From: Chris Ball @ 2012-09-19 10:47 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, linux-mmc, Jaehoon Chung,
Adrian Hunter
Hi,
On Wed, Sep 19 2012, Tomasz Figa wrote:
> We could just check if the regulator provides the capability to change the
> voltage.
>
> I don't see any direct way of querying the regulator for provided
> capabilities (correct me if I'm just blind), but calling
> regulator_count_voltages() on the regulator and checking if the returned
> value is 1 should be enough to assume that the regulator is fixed.
Sounds good, I agree. Are you able to test that the obvious patch below
works on your fixed-regulator board?
Jaehoon and Adrian, can you think of any reason why we shouldn't replace
MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
Thanks.
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044cd01..a3cc740 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1132,7 +1132,7 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
*/
voltage = regulator_get_voltage(supply);
- if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
+ if (regulator_count_voltages(supply) == 1)
min_uV = max_uV = voltage;
if (voltage < 0)
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 10:47 ` Chris Ball
@ 2012-09-19 10:49 ` Tomasz Figa
2012-09-19 11:02 ` Jaehoon Chung
1 sibling, 0 replies; 11+ messages in thread
From: Tomasz Figa @ 2012-09-19 10:49 UTC (permalink / raw)
To: Chris Ball
Cc: linux-samsung-soc, linux-arm-kernel, kyungmin.park, jy0922.shim,
kgene.kim, thomas.abraham, Ben Dooks, linux-mmc, Jaehoon Chung,
Adrian Hunter
hi,
On Wednesday 19 of September 2012 06:47:02 Chris Ball wrote:
> Hi,
>
> On Wed, Sep 19 2012, Tomasz Figa wrote:
> > We could just check if the regulator provides the capability to change
> > the voltage.
> >
> > I don't see any direct way of querying the regulator for provided
> > capabilities (correct me if I'm just blind), but calling
> > regulator_count_voltages() on the regulator and checking if the
> > returned
> > value is 1 should be enough to assume that the regulator is fixed.
>
> Sounds good, I agree. Are you able to test that the obvious patch below
> works on your fixed-regulator board?
Yes. I will report the result as soon as I test it.
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 10:47 ` Chris Ball
2012-09-19 10:49 ` Tomasz Figa
@ 2012-09-19 11:02 ` Jaehoon Chung
2012-09-19 14:39 ` Chris Ball
1 sibling, 1 reply; 11+ messages in thread
From: Jaehoon Chung @ 2012-09-19 11:02 UTC (permalink / raw)
To: Chris Ball
Cc: Tomasz Figa, linux-samsung-soc, linux-arm-kernel, kyungmin.park,
jy0922.shim, kgene.kim, thomas.abraham, Ben Dooks, linux-mmc,
Jaehoon Chung, Adrian Hunter
Hi,
On 09/19/2012 07:47 PM, Chris Ball wrote:
> Hi,
>
> On Wed, Sep 19 2012, Tomasz Figa wrote:
>> We could just check if the regulator provides the capability to change the
>> voltage.
>>
>> I don't see any direct way of querying the regulator for provided
>> capabilities (correct me if I'm just blind), but calling
>> regulator_count_voltages() on the regulator and checking if the returned
>> value is 1 should be enough to assume that the regulator is fixed.
>
> Sounds good, I agree. Are you able to test that the obvious patch below
> works on your fixed-regulator board?
>
> Jaehoon and Adrian, can you think of any reason why we shouldn't replace
> MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
> Thanks.
I think this is better than using MMC_CAP2_BROKEN_VOLTAGE.
I tested with this..and working fine.
Best Regards,
Jaehoon Chung
>
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 044cd01..a3cc740 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1132,7 +1132,7 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
> */
> voltage = regulator_get_voltage(supply);
>
> - if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
> + if (regulator_count_voltages(supply) == 1)
> min_uV = max_uV = voltage;
>
> if (voltage < 0)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 11:02 ` Jaehoon Chung
@ 2012-09-19 14:39 ` Chris Ball
2012-09-20 5:57 ` Jaehoon Chung
0 siblings, 1 reply; 11+ messages in thread
From: Chris Ball @ 2012-09-19 14:39 UTC (permalink / raw)
To: Jaehoon Chung
Cc: Tomasz Figa, linux-samsung-soc, linux-arm-kernel, kyungmin.park,
jy0922.shim, kgene.kim, thomas.abraham, Ben Dooks, linux-mmc,
Adrian Hunter
Hi,
On Wed, Sep 19 2012, Jaehoon Chung wrote:
>> On Wed, Sep 19 2012, Tomasz Figa wrote:
>>> We could just check if the regulator provides the capability to change the
>>> voltage.
>>>
>>> I don't see any direct way of querying the regulator for provided
>>> capabilities (correct me if I'm just blind), but calling
>>> regulator_count_voltages() on the regulator and checking if the returned
>>> value is 1 should be enough to assume that the regulator is fixed.
>>
>> Sounds good, I agree. Are you able to test that the obvious patch below
>> works on your fixed-regulator board?
>>
>> Jaehoon and Adrian, can you think of any reason why we shouldn't replace
>> MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
>> Thanks.
>
> I think this is better than using MMC_CAP2_BROKEN_VOLTAGE.
> I tested with this..and working fine.
Great, here's the patch. Jaehoon, once this is merged, maybe you could
help remove the uses of MMC_CAP2_BROKEN_VOLTAGE from arch/arm/mach-exynos
and arch/arm/mach-s5pv210 now that they're no longer needed?
Thanks,
- Chris.
Subject: [PATCH] mmc: core: Replace MMC_CAP2_BROKEN_VOLTAGE with test for fixed regulator
Before this patch, we were using MMC_CAP2_BROKEN_VOLTAGE as a way to
avoid calling regulator_set_voltage() on a fixed regulator, but that's
just duplicating information that already exists -- we should test
whether the regulator is fixed directly, instead of via a capability.
This patch implements that test. We can't reclaim the capability bit
just yet, since there are still boards in arch/arm/ that reference it;
those references can be removed now.
Reported-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
---
drivers/mmc/core/core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044cd01..6612163 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1113,7 +1113,8 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
int tmp;
int voltage;
- /* REVISIT mmc_vddrange_to_ocrmask() may have set some
+ /*
+ * REVISIT mmc_vddrange_to_ocrmask() may have set some
* bits this regulator doesn't quite support ... don't
* be too picky, most cards and regulators are OK with
* a 0.1V range goof (it's a small error percentage).
@@ -1127,12 +1128,13 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
max_uV = min_uV + 100 * 1000;
}
- /* avoid needless changes to this voltage; the regulator
- * might not allow this operation
+ /*
+ * If we're using a fixed/static regulator, don't call
+ * regulator_set_voltage; it would fail.
*/
voltage = regulator_get_voltage(supply);
- if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
+ if (regulator_count_voltages(supply) == 1)
min_uV = max_uV = voltage;
if (voltage < 0)
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk
2012-09-19 14:39 ` Chris Ball
@ 2012-09-20 5:57 ` Jaehoon Chung
0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2012-09-20 5:57 UTC (permalink / raw)
To: Chris Ball
Cc: Jaehoon Chung, Tomasz Figa, linux-samsung-soc, linux-arm-kernel,
kyungmin.park, jy0922.shim, kgene.kim, thomas.abraham, Ben Dooks,
linux-mmc, Adrian Hunter
On 09/19/2012 11:39 PM, Chris Ball wrote:
> Hi,
>
> On Wed, Sep 19 2012, Jaehoon Chung wrote:
>>> On Wed, Sep 19 2012, Tomasz Figa wrote:
>>>> We could just check if the regulator provides the capability to change the
>>>> voltage.
>>>>
>>>> I don't see any direct way of querying the regulator for provided
>>>> capabilities (correct me if I'm just blind), but calling
>>>> regulator_count_voltages() on the regulator and checking if the returned
>>>> value is 1 should be enough to assume that the regulator is fixed.
>>>
>>> Sounds good, I agree. Are you able to test that the obvious patch below
>>> works on your fixed-regulator board?
>>>
>>> Jaehoon and Adrian, can you think of any reason why we shouldn't replace
>>> MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
>>> Thanks.
>>
>> I think this is better than using MMC_CAP2_BROKEN_VOLTAGE.
>> I tested with this..and working fine.
>
> Great, here's the patch. Jaehoon, once this is merged, maybe you could
> help remove the uses of MMC_CAP2_BROKEN_VOLTAGE from arch/arm/mach-exynos
> and arch/arm/mach-s5pv210 now that they're no longer needed?
Right, I will remove them and send the patch.
Best Regards,
Jaehoon Chung
>
> Thanks,
>
> - Chris.
>
>
> Subject: [PATCH] mmc: core: Replace MMC_CAP2_BROKEN_VOLTAGE with test for fixed regulator
>
> Before this patch, we were using MMC_CAP2_BROKEN_VOLTAGE as a way to
> avoid calling regulator_set_voltage() on a fixed regulator, but that's
> just duplicating information that already exists -- we should test
> whether the regulator is fixed directly, instead of via a capability.
>
> This patch implements that test. We can't reclaim the capability bit
> just yet, since there are still boards in arch/arm/ that reference it;
> those references can be removed now.
>
> Reported-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Chris Ball <cjb@laptop.org>
> ---
> drivers/mmc/core/core.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 044cd01..6612163 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1113,7 +1113,8 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
> int tmp;
> int voltage;
>
> - /* REVISIT mmc_vddrange_to_ocrmask() may have set some
> + /*
> + * REVISIT mmc_vddrange_to_ocrmask() may have set some
> * bits this regulator doesn't quite support ... don't
> * be too picky, most cards and regulators are OK with
> * a 0.1V range goof (it's a small error percentage).
> @@ -1127,12 +1128,13 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
> max_uV = min_uV + 100 * 1000;
> }
>
> - /* avoid needless changes to this voltage; the regulator
> - * might not allow this operation
> + /*
> + * If we're using a fixed/static regulator, don't call
> + * regulator_set_voltage; it would fail.
> */
> voltage = regulator_get_voltage(supply);
>
> - if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
> + if (regulator_count_voltages(supply) == 1)
> min_uV = max_uV = voltage;
>
> if (voltage < 0)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-09-20 5:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1346748609-11115-1-git-send-email-t.figa@samsung.com>
2012-09-04 8:50 ` [PATCH v2 1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk Tomasz Figa
2012-09-05 8:36 ` Jaehoon Chung
2012-09-19 5:42 ` Chris Ball
2012-09-19 10:13 ` Tomasz Figa
2012-09-19 10:24 ` Chris Ball
2012-09-19 10:34 ` Tomasz Figa
2012-09-19 10:47 ` Chris Ball
2012-09-19 10:49 ` Tomasz Figa
2012-09-19 11:02 ` Jaehoon Chung
2012-09-19 14:39 ` Chris Ball
2012-09-20 5:57 ` Jaehoon Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox