mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: "festevam@gmail.com" <festevam@gmail.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	Andy Duan <fugang.duan@nxp.com>
Cc: "anders.roxell@linaro.org" <anders.roxell@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"john.stultz@linaro.org" <john.stultz@linaro.org>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>
Subject: Re: [PATCH] regulator: fixed: Default enable high on DT regulators
Date: Tue, 2 Oct 2018 13:42:38 +0000	[thread overview]
Message-ID: <28e88d54f6503cf1be577eb1872cdf2c50d7dfa3.camel@nxp.com> (raw)
In-Reply-To: <20181001204346.4655-1-linus.walleij@linaro.org>

On Mon, 2018-10-01 at 22:43 +0200, Linus Walleij wrote:
> commit efdfeb079cc3
> ("regulator: fixed: Convert to use GPIO descriptor only")
> switched to use gpiod_get() to look up the regulator from the
> gpiolib core whether that is device tree or boardfile.
> 
> This meant that we activate the code in
> a603a2b8d86e ("gpio: of: Add special quirk to parse regulator flags")
> which means the descriptors coming from the device tree already
> have the right inversion and open drain semantics set up from
> the gpiolib core.
> 
> As the fixed regulator was inspected again we got the
> inverted inversion and things broke.
> 
> Fix it by ignoring the config in the device tree for now: the
> later patches in the series will push all inversion handling
> over to the gpiolib core and set it up properly in the
> boardfiles for legacy devices, but I did not finish that
> for this kernel cycle.
> 
> Fixes: commit efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only")
> Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reported-by: Fabio Estevam <festevam@gmail.com>
> Reported-by: John Stultz <john.stultz@linaro.org>
> Reported-by: Anders Roxell <anders.roxell@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

This doesn't work for imx6sx-sdb but I suspect an imx issue. Log:

[    0.150198] regulator-enet-3v3 GPIO handle specifies active low - ignored
[    0.150258] gpio_value: 38 set 1
[    0.150283] gpio_direction: 38 out (0)
...
[    1.962493] regulator_enable: name=enet_3v3
[    1.966709] gpio_value: 38 set 0
[    1.970005] regulator_enable_delay: name=enet_3v3
[    1.974730] regulator_enable_complete: name=enet_3v3
...
[    4.097077] fec 2188000.ethernet eth0: Unable to connect to phy
[    4.109219] IP-Config: Failed to open eth0
[    4.115557] fec 21b4000.ethernet eth1: Unable to connect to phy
[    4.123690] IP-Config: Failed to open eth1

This turns the phy off and on again instead of leaving it up from uboot
and it doesn't work for some reason. However looking at
reg_fixed_voltage_probe introducing an edge seems to be intentional for
regulators which are not marked with "enabled-at-boot". Right?

It's possible that you exposed an imx board-specific bug: maybe power
cycling the phy after uboot needs some missing fixup?

Apparently if I revert your patch the old behavior is to never touch
this GPIO. I spent a while debugging this and the cause seems to be
that this regulator has the "gpios" property instead of "gpio".

The "gpios" property is not actually handled by old regulator-fixed
of_get_named_gpio(np, "gpio", 0) call but only by the new path going
through of_find_gpio.

I can also break boot by fixing the gpios property on stable 4.18:

        reg_enet_3v3: regulator-enet-3v3 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_enet_3v3>;
                regulator-name = "enet_3v3";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
-               gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
+               gpio = <&gpio2 6 GPIO_ACTIVE_LOW>;
        };

Any suggestions? This turned out to be quite messy.

--
Regards,
Leonard

  parent reply	other threads:[~2018-10-02 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 20:43 Linus Walleij
2018-10-01 21:56 ` John Stultz
2018-10-02 13:42 ` Leonard Crestez [this message]
2018-10-03 12:10   ` Mark Brown
2018-10-03 18:08     ` Leonard Crestez
2018-10-04  7:19       ` Linus Walleij
2018-10-04 10:20       ` Mark Brown

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=28e88d54f6503cf1be577eb1872cdf2c50d7dfa3.camel@nxp.com \
    --to=leonard.crestez@nxp.com \
    --cc=anders.roxell@linaro.org \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=john.stultz@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawnguo@kernel.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

all inboxes | Powered by JetHome®