diff mbox

[6/6] regulator: anatop: set default voltage selector for pcie

Message ID 1491962327-12477-6-git-send-email-aisheng.dong@nxp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aisheng Dong April 12, 2017, 1:58 a.m. UTC
Set the initial voltage selector for vddpcie in case it's disabled
by default.

This fixes the below warning:
20c8000.anatop:regulator-vddpcie: Failed to read a valid default voltage selector.
anatop_regulator: probe of 20c8000.anatop:regulator-vddpcie failed with error -22

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Robin Gong <yibin.gong@nxp.com>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/regulator/anatop-regulator.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Mark Brown April 11, 2017, 8:40 p.m. UTC | #1
On Wed, Apr 12, 2017 at 09:58:47AM +0800, Dong Aisheng wrote:
> Set the initial voltage selector for vddpcie in case it's disabled
> by default.

Why is this the only anatop regulator which can have this problem and
how do we know this is a good value?
Mark Brown April 12, 2017, 3:49 p.m. UTC | #2
On Thu, Apr 13, 2017 at 03:41:03PM +0800, Dong Aisheng wrote:
> On Tue, Apr 11, 2017 at 09:40:03PM +0100, Mark Brown wrote:

> > Why is this the only anatop regulator which can have this problem and
> > how do we know this is a good value?

> Anatop regulator has no separate gate bit.
> e.g.
> 00000 Power gated off
> 00001 Target core voltage = 0.725V
> ...
> So it may have no valid default voltage in case it's disabled in
> bootloader.
> e.g. regulator_enable() may not work.

That doesn't answer my question.  What I'm asking is why another anatop
regulator might not end up disabled like this one.

> The default voltage 1.100v this patch sets is defined in reference
> manual.

For the SoC you're currently looking at...  might another have a
different value?
Dong Aisheng April 12, 2017, 4:11 p.m. UTC | #3
On Wed, Apr 12, 2017 at 11:49 PM, Mark Brown <broonie@kernel.org> wrote:
> On Thu, Apr 13, 2017 at 03:41:03PM +0800, Dong Aisheng wrote:
>> On Tue, Apr 11, 2017 at 09:40:03PM +0100, Mark Brown wrote:
>
>> > Why is this the only anatop regulator which can have this problem and
>> > how do we know this is a good value?
>
>> Anatop regulator has no separate gate bit.
>> e.g.
>> 00000 Power gated off
>> 00001 Target core voltage = 0.725V
>> ...
>> So it may have no valid default voltage in case it's disabled in
>> bootloader.
>> e.g. regulator_enable() may not work.
>
> That doesn't answer my question.  What I'm asking is why another anatop
> regulator might not end up disabled like this one.
>

Well, that's true and i once thought of it.
Currently it is probably a quick fix and we did not see any others up till now
for all MX6&7 platforms based on NXP internal tree.

If we do see it in the future, then probably a better solution is constructing
a staticly defined default voltage table in anatop driver and do dynamically
check.

>> The default voltage 1.100v this patch sets is defined in reference
>> manual.
>
> For the SoC you're currently looking at...  might another have a
> different value?

No, only MX6SX has it currently.

Regards
Dong Aisheng
Lucas Stach April 12, 2017, 4:11 p.m. UTC | #4
Am Donnerstag, den 13.04.2017, 15:41 +0800 schrieb Dong Aisheng:
> On Tue, Apr 11, 2017 at 09:40:03PM +0100, Mark Brown wrote:
> > On Wed, Apr 12, 2017 at 09:58:47AM +0800, Dong Aisheng wrote:
> > > Set the initial voltage selector for vddpcie in case it's disabled
> > > by default.
> > 
> > Why is this the only anatop regulator which can have this problem and
> > how do we know this is a good value?
> 
> Anatop regulator has no separate gate bit.
> e.g.
> 00000 Power gated off
> 00001 Target core voltage = 0.725V
> ...
> So it may have no valid default voltage in case it's disabled in
> bootloader.
> e.g. regulator_enable() may not work.
> 
> The default voltage 1.100v this patch sets is defined in reference
> manual.

Huh? Shouldn't regulator_enable bring the voltage in a range defined by
the constraints in the DT?

Regards,
Lucas
Mark Brown April 12, 2017, 4:16 p.m. UTC | #5
On Wed, Apr 12, 2017 at 06:11:54PM +0200, Lucas Stach wrote:
> Am Donnerstag, den 13.04.2017, 15:41 +0800 schrieb Dong Aisheng:

> > The default voltage 1.100v this patch sets is defined in reference
> > manual.

> Huh? Shouldn't regulator_enable bring the voltage in a range defined by
> the constraints in the DT?

As part of that process it checks what the current voltage is but with
this regulator you can't read the voltage if the regulator is powered
off and we don't just ignore that error.
Dong Aisheng April 13, 2017, 7:41 a.m. UTC | #6
On Tue, Apr 11, 2017 at 09:40:03PM +0100, Mark Brown wrote:
> On Wed, Apr 12, 2017 at 09:58:47AM +0800, Dong Aisheng wrote:
> > Set the initial voltage selector for vddpcie in case it's disabled
> > by default.
> 
> Why is this the only anatop regulator which can have this problem and
> how do we know this is a good value?

Anatop regulator has no separate gate bit.
e.g.
00000 Power gated off
00001 Target core voltage = 0.725V
...
So it may have no valid default voltage in case it's disabled in
bootloader.
e.g. regulator_enable() may not work.

The default voltage 1.100v this patch sets is defined in reference
manual.

Regards
Dong Aisheng
diff mbox

Patch

diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 6da0b20..910adfd 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -301,6 +301,11 @@  static int anatop_regulator_probe(struct platform_device *pdev)
 		if (!sreg->sel && rdesc->name && !strcmp(rdesc->name, "vddpu"))
 			sreg->sel = 22;
 
+		/* set the default voltage of the pcie phy to be 1.100v */
+		if (!sreg->sel && rdesc->name &&
+		    !strcmp(rdesc->name, "vddpcie"))
+			sreg->sel = 0x10;
+
 		if (!sreg->bypass && !sreg->sel) {
 			dev_err(&pdev->dev, "Failed to read a valid default voltage selector.\n");
 			return -EINVAL;