u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux
@ 2021-09-16 14:53 Rasmus Villemoes
  2021-09-16 16:52 ` Fabio Estevam
  2021-09-28 18:45 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2021-09-16 14:53 UTC (permalink / raw)
  To: u-boot, Stefano Babic, Fabio Estevam
  Cc: uboot-imx, Rasmus Villemoes, Joris Offouga,
	Christian Bräuner Sørensen

Commit 0d52bab46 (mx7dsabre: Enable DM_ETH) changed these flags from 0
(aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
device tree with v5.5-rc1", but in the linux tree, these gpios have
always been GPIO_ACTIVE_HIGH ever since this node was introduced
around v4.13 (linux commit 184f39b5).

I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
around the behaviour of the soft-spi driver back then, which
effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
in the soft-spi driver, which then got fixed in 0e146993bb3 (spi: add
support for all spi modes with soft spi), but that commit then broke
ethernet on this board.

Fix it by setting the gpios as active high, which as a bonus actually
brings us in sync with the .dts in the linux source tree.

Without this, one gets

    Net:   Could not get PHY for FEC0: addr 0
    No ethernet found.

With this, ethernet (at least ping and tftp) works as expected from
the U-Boot shell.

Cc: Fabio Estevam <festevam@gmail.com>
Cc: Joris Offouga <offougajoris@gmail.com>
Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 arch/arm/dts/imx7d-sdb.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/imx7d-sdb.dts b/arch/arm/dts/imx7d-sdb.dts
index 8191ac7c33..ea2e58dd5a 100644
--- a/arch/arm/dts/imx7d-sdb.dts
+++ b/arch/arm/dts/imx7d-sdb.dts
@@ -44,9 +44,9 @@
 		compatible = "spi-gpio";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_spi4>;
-		gpio-sck = <&gpio1 13 GPIO_ACTIVE_LOW>;
-		gpio-mosi = <&gpio1 9 GPIO_ACTIVE_LOW>;
-		cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+		gpio-sck = <&gpio1 13 GPIO_ACTIVE_HIGH>;
+		gpio-mosi = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+		cs-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
 		num-chipselects = <1>;
 		#address-cells = <1>;
 		#size-cells = <0>;
-- 
2.31.1


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

* Re: [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux
  2021-09-16 14:53 [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux Rasmus Villemoes
@ 2021-09-16 16:52 ` Fabio Estevam
  2021-09-28 10:18   ` Rasmus Villemoes
  2021-09-28 18:45 ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2021-09-16 16:52 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: U-Boot-Denx, Stefano Babic, dl-uboot-imx, Joris Offouga,
	Christian Bräuner Sørensen

Hi Rasmus,

On Thu, Sep 16, 2021 at 11:53 AM Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> Commit 0d52bab46 (mx7dsabre: Enable DM_ETH) changed these flags from 0
> (aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
> device tree with v5.5-rc1", but in the linux tree, these gpios have
> always been GPIO_ACTIVE_HIGH ever since this node was introduced
> around v4.13 (linux commit 184f39b5).
>
> I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
> around the behaviour of the soft-spi driver back then, which
> effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
> in the soft-spi driver, which then got fixed in 0e146993bb3 (spi: add
> support for all spi modes with soft spi), but that commit then broke
> ethernet on this board.
>
> Fix it by setting the gpios as active high, which as a bonus actually
> brings us in sync with the .dts in the linux source tree.
>
> Without this, one gets
>
>     Net:   Could not get PHY for FEC0: addr 0
>     No ethernet found.
>
> With this, ethernet (at least ping and tftp) works as expected from
> the U-Boot shell.
>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Joris Offouga <offougajoris@gmail.com>
> Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Thanks for the fix:

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

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

* Re: [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux
  2021-09-16 16:52 ` Fabio Estevam
@ 2021-09-28 10:18   ` Rasmus Villemoes
  2021-09-28 12:34     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Rasmus Villemoes @ 2021-09-28 10:18 UTC (permalink / raw)
  To: Fabio Estevam, Tom Rini
  Cc: U-Boot-Denx, Stefano Babic, dl-uboot-imx, Joris Offouga,
	Christian Bräuner Sørensen

On 16/09/2021 18.52, Fabio Estevam wrote:
> Hi Rasmus,
> 
> On Thu, Sep 16, 2021 at 11:53 AM Rasmus Villemoes
> <rasmus.villemoes@prevas.dk> wrote:
>>
>> Commit 0d52bab46 (mx7dsabre: Enable DM_ETH) changed these flags from 0
>> (aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
>> device tree with v5.5-rc1", but in the linux tree, these gpios have
>> always been GPIO_ACTIVE_HIGH ever since this node was introduced
>> around v4.13 (linux commit 184f39b5).
>>
>> I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
>> around the behaviour of the soft-spi driver back then, which
>> effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
>> in the soft-spi driver, which then got fixed in 0e146993bb3 (spi: add
>> support for all spi modes with soft spi), but that commit then broke
>> ethernet on this board.
>>
>> Fix it by setting the gpios as active high, which as a bonus actually
>> brings us in sync with the .dts in the linux source tree.
>>
>> Without this, one gets
>>
>>     Net:   Could not get PHY for FEC0: addr 0
>>     No ethernet found.
>>
>> With this, ethernet (at least ping and tftp) works as expected from
>> the U-Boot shell.
>>
>> Cc: Fabio Estevam <festevam@gmail.com>
>> Cc: Joris Offouga <offougajoris@gmail.com>
>> Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
>> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> 
> Thanks for the fix:
> 
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> 

Any chance this can make it in before v2021.10 is released?

Rasmus

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

* Re: [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux
  2021-09-28 10:18   ` Rasmus Villemoes
@ 2021-09-28 12:34     ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-09-28 12:34 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: Fabio Estevam, U-Boot-Denx, Stefano Babic, dl-uboot-imx,
	Joris Offouga, Christian Bräuner Sørensen

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

On Tue, Sep 28, 2021 at 12:18:10PM +0200, Rasmus Villemoes wrote:

> On 16/09/2021 18.52, Fabio Estevam wrote:
> > Hi Rasmus,
> > 
> > On Thu, Sep 16, 2021 at 11:53 AM Rasmus Villemoes
> > <rasmus.villemoes@prevas.dk> wrote:
> >>
> >> Commit 0d52bab46 (mx7dsabre: Enable DM_ETH) changed these flags from 0
> >> (aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
> >> device tree with v5.5-rc1", but in the linux tree, these gpios have
> >> always been GPIO_ACTIVE_HIGH ever since this node was introduced
> >> around v4.13 (linux commit 184f39b5).
> >>
> >> I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
> >> around the behaviour of the soft-spi driver back then, which
> >> effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
> >> in the soft-spi driver, which then got fixed in 0e146993bb3 (spi: add
> >> support for all spi modes with soft spi), but that commit then broke
> >> ethernet on this board.
> >>
> >> Fix it by setting the gpios as active high, which as a bonus actually
> >> brings us in sync with the .dts in the linux source tree.
> >>
> >> Without this, one gets
> >>
> >>     Net:   Could not get PHY for FEC0: addr 0
> >>     No ethernet found.
> >>
> >> With this, ethernet (at least ping and tftp) works as expected from
> >> the U-Boot shell.
> >>
> >> Cc: Fabio Estevam <festevam@gmail.com>
> >> Cc: Joris Offouga <offougajoris@gmail.com>
> >> Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
> >> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> > 
> > Thanks for the fix:
> > 
> > Reviewed-by: Fabio Estevam <festevam@gmail.com>
> > 
> 
> Any chance this can make it in before v2021.10 is released?

Yes, I'll pick it up.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux
  2021-09-16 14:53 [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux Rasmus Villemoes
  2021-09-16 16:52 ` Fabio Estevam
@ 2021-09-28 18:45 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-09-28 18:45 UTC (permalink / raw)
  To: Rasmus Villemoes
  Cc: u-boot, Stefano Babic, Fabio Estevam, uboot-imx, Joris Offouga,
	Christian Bräuner Sørensen

[-- Attachment #1: Type: text/plain, Size: 1382 bytes --]

On Thu, Sep 16, 2021 at 04:53:14PM +0200, Rasmus Villemoes wrote:

> Commit 0d52bab46 (mx7dsabre: Enable DM_ETH) changed these flags from 0
> (aka GPIO_ACTIVE_HIGH) to GPIO_ACTIVE_LOW. It claimed to "Also sync
> device tree with v5.5-rc1", but in the linux tree, these gpios have
> always been GPIO_ACTIVE_HIGH ever since this node was introduced
> around v4.13 (linux commit 184f39b5).
> 
> I'm guessing that the reason for the GPIO_ACTIVE_LOW was to work
> around the behaviour of the soft-spi driver back then, which
> effectively defaulted to spi-mode 3 and not 0. That was arguably a bug
> in the soft-spi driver, which then got fixed in 0e146993bb3 (spi: add
> support for all spi modes with soft spi), but that commit then broke
> ethernet on this board.
> 
> Fix it by setting the gpios as active high, which as a bonus actually
> brings us in sync with the .dts in the linux source tree.
> 
> Without this, one gets
> 
>     Net:   Could not get PHY for FEC0: addr 0
>     No ethernet found.
> 
> With this, ethernet (at least ping and tftp) works as expected from
> the U-Boot shell.
> 
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Joris Offouga <offougajoris@gmail.com>
> Cc: "Christian Bräuner Sørensen" <yocto@bsorensen.net>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-09-28 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 14:53 [PATCH] imx: imx7d-sdb: fix ethernet, sync .dts with linux Rasmus Villemoes
2021-09-16 16:52 ` Fabio Estevam
2021-09-28 10:18   ` Rasmus Villemoes
2021-09-28 12:34     ` Tom Rini
2021-09-28 18:45 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).