lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28e88d54f6503cf1be577eb1872cdf2c50d7dfa3.camel@nxp.com>
Date:   Tue, 2 Oct 2018 13:42:38 +0000
From:   Leonard Crestez <leonard.crestez@....com>
To:     "festevam@...il.com" <festevam@...il.com>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        Andy Duan <fugang.duan@....com>
CC:     "anders.roxell@...aro.org" <anders.roxell@...aro.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "john.stultz@...aro.org" <john.stultz@...aro.org>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "broonie@...nel.org" <broonie@...nel.org>,
        dl-linux-imx <linux-imx@....com>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>
Subject: Re: [PATCH] regulator: fixed: Default enable high on DT regulators

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@....com>
> Reported-by: Fabio Estevam <festevam@...il.com>
> Reported-by: John Stultz <john.stultz@...aro.org>
> Reported-by: Anders Roxell <anders.roxell@...aro.org>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ