All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator
@ 2018-10-02 18:37 Leonard Crestez
  2018-10-02 19:56 ` Linus Walleij
  2018-10-03  2:25 ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Leonard Crestez @ 2018-10-02 18:37 UTC (permalink / raw)
  To: Fabio Estevam, Andy Duan, Shawn Guo
  Cc: Linus Walleij, Mark Brown, Liam Girdwood, linux-gpio,
	linux-kernel, dl-linux-imx, kernel

Bindings for "fixed-regulator" only explicitly support "gpio" property,
not "gpios". Fix by correcting the property name.

The enet PHYs on imx6sx-sdb needs to be explicitly reset after a power
cycle, handle this by adding the phy-reset-gpios property.

Both phys share a single reset, a scenario similar to imx7d-sdb.

This issue was exposed by commit efdfeb079cc3 ("regulator: fixed:
Convert to use GPIO descriptor only") which causes the "gpios" property
to also be parsed. Before that commit the "gpios" property had no
effect and PHY reset was only handled in the bootloader.

This fixes linux-next netboot failures previously reported here:
 https://lore.kernel.org/patchwork/patch/982437/#1177900
 https://lore.kernel.org/patchwork/patch/994091/#1178304

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/boot/dts/imx6sx-sdb.dtsi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

I'm not entirely certain sharing the phy reset is OK, maybe somebody
with more familiarity with the FEC driver can confirm? This design seems
to be similar between multiple imx boards with dual ethernet ports.

This took a surprising amount of digging.

diff --git a/arch/arm/boot/dts/imx6sx-sdb.dtsi b/arch/arm/boot/dts/imx6sx-sdb.dtsi
index 53b3408b5fab..1ed7a081c420 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dtsi
+++ b/arch/arm/boot/dts/imx6sx-sdb.dtsi
@@ -115,11 +115,11 @@
 		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>;
 	};
 
 	reg_pcie_gpio: regulator-pcie-gpio {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -178,10 +178,11 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_enet1>;
 	phy-supply = <&reg_enet_3v3>;
 	phy-mode = "rgmii";
 	phy-handle = <&ethphy1>;
+	phy-reset-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
 	status = "okay";
 
 	mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -371,10 +372,12 @@
 				MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1	0x3081
 				MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2	0x3081
 				MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3	0x3081
 				MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN	0x3081
 				MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M	0x91
+				/* phy reset */
+				MX6SX_PAD_ENET2_CRS__GPIO2_IO_7		0x80000000
 			>;
 		};
 
 		pinctrl_enet_3v3: enet3v3grp {
 			fsl,pins = <
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator
  2018-10-02 18:37 [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator Leonard Crestez
@ 2018-10-02 19:56 ` Linus Walleij
  2018-10-03 11:49   ` Leonard Crestez
  2018-10-03  2:25 ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2018-10-02 19:56 UTC (permalink / raw)
  To: Leonard Crestez, Rob Herring
  Cc: Fabio Estevam, Andy Duan, Shawn Guo, Mark Brown, Liam Girdwood,
	open list:GPIO SUBSYSTEM, linux-kernel, NXP Linux Team,
	Sascha Hauer

On Tue, Oct 2, 2018 at 8:37 PM Leonard Crestez <leonard.crestez@nxp.com> wrote:

> This issue was exposed by commit efdfeb079cc3 ("regulator: fixed:
> Convert to use GPIO descriptor only") which causes the "gpios" property
> to also be parsed. Before that commit the "gpios" property had no
> effect and PHY reset was only handled in the bootloader.

Wow that was a very interesting one.
Turning over these stones sometimes expose the weirdest
things.

This is one of the reasons why we need formal validation of
DTS files: things look OK to the human eye and get merged
but they are just syntactically wrong.

I guess I could hack to make "gpios" be ignored by the
regulator GPIO quirks in gpiolib, but I take it you probably
prefer to fix up the real issue like this.

Anyways, good job!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator
  2018-10-02 18:37 [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator Leonard Crestez
  2018-10-02 19:56 ` Linus Walleij
@ 2018-10-03  2:25 ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2018-10-03  2:25 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Fabio Estevam, Fugang Duan, Shawn Guo, Linus Walleij, Mark Brown,
	Liam Girdwood, open list:GPIO SUBSYSTEM, linux-kernel,
	NXP Linux Team, Sascha Hauer

Hi Leonard,

On Tue, Oct 2, 2018 at 3:42 PM Leonard Crestez <leonard.crestez@nxp.com> wrote:

> @@ -371,10 +372,12 @@
>                                 MX6SX_PAD_RGMII1_RD1__ENET1_RX_DATA_1   0x3081
>                                 MX6SX_PAD_RGMII1_RD2__ENET1_RX_DATA_2   0x3081
>                                 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3   0x3081
>                                 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN    0x3081
>                                 MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M       0x91
> +                               /* phy reset */
> +                               MX6SX_PAD_ENET2_CRS__GPIO2_IO_7         0x80000000

We should avoid using 0x80000000 as this relies on the bootloader
setting the IOMUX.

Please do like this insted:

MX6SX_PAD_ENET2_CRS__GPIO2_IO_7         0x10b0

Then you can add:

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator
  2018-10-02 19:56 ` Linus Walleij
@ 2018-10-03 11:49   ` Leonard Crestez
  2018-10-04  9:02     ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Leonard Crestez @ 2018-10-03 11:49 UTC (permalink / raw)
  To: linus.walleij, robh+dt
  Cc: dl-linux-imx, linux-kernel, Andy Duan, Fabio Estevam, linux-gpio,
	broonie, lgirdwood, shawnguo, kernel

On Tue, 2018-10-02 at 21:56 +0200, Linus Walleij wrote:
> On Tue, Oct 2, 2018 at 8:37 PM Leonard Crestez <
> leonard.crestez@nxp.com> wrote:
> 
> > This issue was exposed by commit efdfeb079cc3 ("regulator: fixed:
> > Convert to use GPIO descriptor only") which causes the "gpios"
> > property
> > to also be parsed. Before that commit the "gpios" property had no
> > effect and PHY reset was only handled in the bootloader.
> 
> Wow that was a very interesting one.
> Turning over these stones sometimes expose the weirdest
> things.
> 
> This is one of the reasons why we need formal validation of
> DTS files: things look OK to the human eye and get merged
> but they are just syntactically wrong.
> 
> I guess I could hack to make "gpios" be ignored by the
> regulator GPIO quirks in gpiolib, but I take it you probably
> prefer to fix up the real issue like this.

Maybe you could document in fixed-regulator bindings that it now
supports the standard "gpios" property as well? There still seems to be
a restriction that the list must contain a single element.

Anyway, what my patch fixes is a board-specific issue which exists even
outside your patch: the enet phy regulator never worked as expected.

--
Regards,
Leonard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator
  2018-10-03 11:49   ` Leonard Crestez
@ 2018-10-04  9:02     ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2018-10-04  9:02 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Rob Herring, NXP Linux Team, linux-kernel, Andy Duan,
	Fabio Estevam, open list:GPIO SUBSYSTEM, Mark Brown,
	Liam Girdwood, Shawn Guo, Sascha Hauer

On Wed, Oct 3, 2018 at 1:49 PM Leonard Crestez <leonard.crestez@nxp.com> wrote:
> On Tue, 2018-10-02 at 21:56 +0200, Linus Walleij wrote:

> > I guess I could hack to make "gpios" be ignored by the
> > regulator GPIO quirks in gpiolib, but I take it you probably
> > prefer to fix up the real issue like this.
>
> Maybe you could document in fixed-regulator bindings that it now
> supports the standard "gpios" property as well? There still seems to be
> a restriction that the list must contain a single element.

OK you're right, fixing the docs to be more standards compliant
is indeed better.

> Anyway, what my patch fixes is a board-specific issue which exists even
> outside your patch: the enet phy regulator never worked as expected.

Indeed.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-04  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 18:37 [PATCH] ARM: dts: imx6sx-sdb: Fix enet phy regulator Leonard Crestez
2018-10-02 19:56 ` Linus Walleij
2018-10-03 11:49   ` Leonard Crestez
2018-10-04  9:02     ` Linus Walleij
2018-10-03  2:25 ` Fabio Estevam

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.