diff mbox series

U-Boot atheros PHY support and cubox ethernet

Message ID CAOMZO5Dxjod3jcN8t2tjMVWoGJufT9PfVj4_no3y_+ODS+fFHQ@mail.gmail.com
State New
Headers show
Series U-Boot atheros PHY support and cubox ethernet | expand

Commit Message

Fabio Estevam June 24, 2020, 7:39 p.m. UTC
Hi Soeren,

On Wed, Jun 24, 2020 at 4:20 PM Soeren Moch <smoch at web.de> wrote:

> I tested current master (v2020.07-rc5 + imx fixes) on tbs2910 (imx6q +
> atheros PHY).
> Unfortunately ethernet is broken now, while it used to work well on
> u-boot version v2020.04. Ethernet support was copied from imx6q-sabresd,
> the recently for sabresd fixed phy-mode already is rgmii-id for tbs2910.
>
> Any ideas what could be wrong?

I just tested mainline U-Boot and Ethernet works fine on a imx6qp sabresd board:

U-Boot SPL 2020.07-rc5-00052-g922c6d5d00 (Jun 24 2020 - 16:21:27 -0300)
Trying to boot from MMC1


U-Boot 2020.07-rc5-00052-g922c6d5d00 (Jun 24 2020 - 16:21:27 -0300)

CPU:   Freescale i.MX6QP rev1.0 996 MHz (running at 792 MHz)
CPU:   Automotive temperature grade (-40C to 125C) at 30C
Reset cause: POR
Model: Freescale i.MX6 Quad Plus SABRE Smart Device Board
Board: MX6-SabreSD
I2C:   ready
DRAM:  1 GiB
PMIC:  PFUZE100 ID=0x10
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 3
Loading Environment from MMC... OK
No panel detected: default to Hannstar-XGA
Display: Hannstar-XGA (1024x768)
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet at 2188000
Hit any key to stop autoboot:  0
=> dhcp zImage
BOOTP broadcast 1
DHCP client bound to address 192.168.0.24 (50 ms)
Using ethernet at 2188000 device
TFTP from server 192.168.0.12; our IP address is 192.168.0.24
Filename 'zImage'.
Load address: 0x12000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #############################################################
         1.3 MiB/s
done
Bytes transferred = 9468928 (907c00 hex)
=> mdio list
FEC0:
1 - AR8031/AR8033 <--> ethernet at 2188000
=>

What is the exact failure you see? Is the Ethernet PHY found at the
correct address and probed?

On tbs2910 does the AR8031 generate a 125MHz clock to the i.MX6Q Ethernet?

If so, does the change below help (I am assuming the PHY is located at
address 1, if not, please adjust the @ and reg accordingly)?

with me offline so I can try to understand the failure.

Comments

Soeren Moch June 24, 2020, 8:13 p.m. UTC | #1
Hi Fabio

On 24.06.20 21:39, Fabio Estevam wrote:
> Hi Soeren,
>
> On Wed, Jun 24, 2020 at 4:20 PM Soeren Moch <smoch at web.de> wrote:
>
>> I tested current master (v2020.07-rc5 + imx fixes) on tbs2910 (imx6q +
>> atheros PHY).
>> Unfortunately ethernet is broken now, while it used to work well on
>> u-boot version v2020.04. Ethernet support was copied from imx6q-sabresd,
>> the recently for sabresd fixed phy-mode already is rgmii-id for tbs2910.
>>
>> Any ideas what could be wrong?
> I just tested mainline U-Boot and Ethernet works fine on a imx6qp sabresd board:
>
> U-Boot SPL 2020.07-rc5-00052-g922c6d5d00 (Jun 24 2020 - 16:21:27 -0300)
> Trying to boot from MMC1
>
>
> U-Boot 2020.07-rc5-00052-g922c6d5d00 (Jun 24 2020 - 16:21:27 -0300)
>
> CPU:   Freescale i.MX6QP rev1.0 996 MHz (running at 792 MHz)
> CPU:   Automotive temperature grade (-40C to 125C) at 30C
> Reset cause: POR
> Model: Freescale i.MX6 Quad Plus SABRE Smart Device Board
> Board: MX6-SabreSD
> I2C:   ready
> DRAM:  1 GiB
> PMIC:  PFUZE100 ID=0x10
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 3
> Loading Environment from MMC... OK
> No panel detected: default to Hannstar-XGA
> Display: Hannstar-XGA (1024x768)
> In:    serial
> Out:   serial
> Err:   serial
> Net:   eth0: ethernet at 2188000
> Hit any key to stop autoboot:  0
> => dhcp zImage
> BOOTP broadcast 1
> DHCP client bound to address 192.168.0.24 (50 ms)
> Using ethernet at 2188000 device
> TFTP from server 192.168.0.12; our IP address is 192.168.0.24
> Filename 'zImage'.
> Load address: 0x12000000
> Loading: #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #############################################################
>          1.3 MiB/s
> done
> Bytes transferred = 9468928 (907c00 hex)
> => mdio list
> FEC0:
> 1 - AR8031/AR8033 <--> ethernet at 2188000
> =>
>
> What is the exact failure you see? Is the Ethernet PHY found at the
> correct address and probed?
Fabio Estevam June 24, 2020, 8:29 p.m. UTC | #2
Hi Soeren,

On Wed, Jun 24, 2020 at 5:13 PM Soeren Moch <smoch at web.de> wrote:

> Schematics are at
> https://www.tbsdtv.com/download/document/tbs2910/TBS2910-Matrix-ARM-mini-PC-SCH_rev2.1.pdf

Here is another patch for you to try:
https://pastebin.com/raw/Dkipgq1n
Soeren Moch June 24, 2020, 8:45 p.m. UTC | #3
Hi Fabio,

On 24.06.20 22:29, Fabio Estevam wrote:
> Hi Soeren,
>
> On Wed, Jun 24, 2020 at 5:13 PM Soeren Moch <smoch at web.de> wrote:
>
>> Schematics are at
>> https://www.tbsdtv.com/download/document/tbs2910/TBS2910-Matrix-ARM-mini-PC-SCH_rev2.1.pdf
> Here is another patch for you to try:
> https://pastebin.com/raw/Dkipgq1n
Still no luck:


U-Boot 2020.07-rc5-00039-g4ff63383e3-dirty (Jun 24 2020 - 22:36:43 +0200)

CPU:?? Freescale i.MX6Q rev1.2 at 792MHz
CPU:?? Commercial temperature grade (0C to 95C) at 47C
Reset cause: POR
Model: TBS2910 Matrix ARM mini PC
DRAM:? 2 GiB
MMC:?? FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
No panel detected: default to HDMI
Display: HDMI (1024x768)
In:??? serial
Out:?? vga
Err:?? vga
Net:?? eth0: ethernet at 2188000
PCI:
PCI:?? pcie phy link never came up
No such bus
starting USB...
Bus usb at 2184000: usb dr_mode not found
Bus usb at 2184200: USB EHCI 1.00
scanning bus usb at 2184000 for devices... 1 USB Device(s) found
scanning bus usb at 2184200 for devices... 4 USB Device(s) found
?????? scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:? 0
Matrix U-Boot> dhcp
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17

Retry time exceeded; starting again
Matrix U-Boot> mdio list
FEC0:
4 - AR8035 <--> ethernet at 2188000
Matrix U-Boot>
Fabio Estevam June 24, 2020, 9:35 p.m. UTC | #4
Hi Soeren,

On Wed, Jun 24, 2020 at 5:45 PM S?ren Moch <smoch at web.de> wrote:

> Still no luck:

mx6cuboxi has an AR8035 too and it is working fine in U-Boot mainline.

I am not sure why tbs2910 is failing. Could you try to bisect?
Soeren Moch June 24, 2020, 10:29 p.m. UTC | #5
Hi Fabio,

On 24.06.20 23:35, Fabio Estevam wrote:
> Hi Soeren,
>
> On Wed, Jun 24, 2020 at 5:45 PM S?ren Moch <smoch at web.de> wrote:
>
>> Still no luck:
>
> mx6cuboxi has an AR8035 too and it is working fine in U-Boot mainline.
>
> I am not sure why tbs2910 is failing. Could you try to bisect?
>

Unfortunately I have no access to my usual development board (and will
not have until the v2020.07 release). I only can use an old board
without working USB-OTG, limited to eMMC boot. So I tried to avoid
bisecting, because a bad commit could completely brick this board.

Is there a reliable way to start a new u-boot directly from a running
u-boot?

Soeren
Fabio Estevam June 24, 2020, 11:19 p.m. UTC | #6
Hi Soeren,

On Wed, Jun 24, 2020 at 7:29 PM Soeren Moch <smoch at web.de> wrote:

> Unfortunately I have no access to my usual development board (and will
> not have until the v2020.07 release). I only can use an old board
> without working USB-OTG, limited to eMMC boot. So I tried to avoid
> bisecting, because a bad commit could completely brick this board.

Ok, understood.

We could check if the issue on your board is due to:

commit 6333cbb3817ed551cd7d4e92f7359c73ccc567fc
Author: Michael Walle <michael at walle.cc>
Date:   Thu May 7 00:11:58 2020 +0200

    phy: atheros: ar8035: remove static clock config

    We can configure the clock output in the device tree. Disable the
    hardcoded one in here. This is highly board-specific and should have
    never been enabled in the PHY driver.

    If bisecting shows that this commit breaks your board it probably
    depends on the clock output of your Atheros AR8035 PHY. Please have a
    look at doc/device-tree-bindings/net/phy/atheros.txt. You need to set
    "clk-out-frequency = <125000000>" because that value was the hardcoded
    value until this commit.

    Signed-off-by: Michael Walle <michael at walle.cc>
    Acked-by: Joe Hershberger <joe.hershberger at ni.com>

On your board, are you able to measure with a scope the AR8035 CLK_25M pin?

Prior to this commit the CLK_25M was hardcoded to output a 125MHz clock.

Now that this setting from the ar8035 phy driver is gone we should
pass this information in some form:

- We tried via devicetree with the "qca,clk-out-frequency" property,
but it did not work. This is an area where you could add some debug
prints inside drivers/net/phy/atheros.c and see if if
qca,clk-out-frequency is being parsed correctly to configure a 125MHz
clock output. This is the method I used on mx6cuboxi last week and it
works.

- Other way to configure the AR803x is via board code. Please try to
copy the ar8031_phy_fixup() and board_phy_config() from
board/freescale/mx6sabresd/mx6sabresd.c into your board file.

(I plan to remove this board PHY code in mx6sabresd after 2020.07 and
use "qca,clk-out-frequency" to do the job).
Fabio Estevam June 24, 2020, 11:44 p.m. UTC | #7
On Wed, Jun 24, 2020 at 8:19 PM Fabio Estevam <festevam at gmail.com> wrote:

> - We tried via devicetree with the "qca,clk-out-frequency" property,
> but it did not work. This is an area where you could add some debug
> prints inside drivers/net/phy/atheros.c and see if if
> qca,clk-out-frequency is being parsed correctly to configure a 125MHz
> clock output. This is the method I used on mx6cuboxi last week and it
> works.

To help debugging why "qca,clk-out-frequency"  is not taking effect
you could try this debug patch:
https://pastebin.com/raw/RKG63JGJ

This is the result on a imx6 hummingboard:
....
Net:   ar803x_of_init: found PHY node: ethernet-phy at 0
********** clk out frequency is 125000000
ar803x_of_init: flags=0 clk_25m_reg=0018 clk_25m_mask=0018
******** PHY mode is 8
Warning: ethernet at 2188000 using MAC address from ROM
eth0: ethernet at 2188000
Hit any key to stop autoboot:  0
=>
diff mbox series

Patch

--- a/arch/arm/dts/imx6q-tbs2910.dts
+++ b/arch/arm/dts/imx6q-tbs2910.dts
@@ -108,6 +108,16 @@ 
        phy-mode = "rgmii-id";
        phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
        status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy: ethernet-phy at 1 {
+                       reg = <1>;
+                       qca,clk-out-frequency = <125000000>;
+               };
+       };
 };

In case you still have issues, please share the tbs2910 schematics