Booting kernel through tftp (u-boot)

Hi,

I try for a few days to use Ethernet to download to my kernel image through tftp.
Unfortunately, I can’t really start the connection.
It seems the MAC configuration is okay, my BeagleV-Fire board uses mac1: ethernet@20112000
However, PHY part doesn’t want to start. I always end up with:

ethernet@20112000: PHY present at 9
Could not get PHY for ethernet@20112000: addr 9
phy_connect failed
ping failed; host 192.168.0.100 is not alive

I’m using BeagleV-Fire / BeagleV-Fire-ubuntu · GitLab
to build u-boot, kernel, etc. The repository points to:
commit 8d3dc5ed9dc96348071e5e2cb370581a24013fa0 (HEAD, tag: 2023-11-21)

The dts looks fine:

            mac1: ethernet@20112000 {
                    compatible = "cdns,macb";
                    reg = <0x0 0x20112000 0x0 0x2000>;
                    clocks = <&clkcfg CLK_MAC1>, <&clkcfg CLK_AHB>;
                    clock-names = "pclk", "hclk";
                    interrupt-parent = <&plic>;
                    interrupts = <PLIC_INT_MAC1_INT
                            PLIC_INT_MAC1_QUEUE1
                            PLIC_INT_MAC1_QUEUE2
                            PLIC_INT_MAC1_QUEUE3
                            PLIC_INT_MAC1_EMAC
                            PLIC_INT_MAC1_MMSL>;
                    local-mac-address = [00 00 00 00 00 00];
                    status = "disabled";
                    #address-cells = <1>;
                    #size-cells = <0>;
            };

The board specific dts comes from patch:

  &mac1 {
          status = "okay";
          phy-mode = "sgmii";
          phy-handle = <&phy1>;
          phy1: ethernet-phy@9 {
                  reg = <9>;
          };
  };

U-Boot is at commit b356a897b11ef19dcbe7870530f23f3a978c1714 (HEAD, tag: linux4microchip+fpga-2023.02).

I have tried newer tags. However, without the luck. U-boot build with tag linux4microchip+fpga-2023.09 just hangs with no messages after HSS.

I went through code, but here I have little experience with mac/phy drivers.
So, it’s hard to judge the code flow.

I have noticed one thing, the Realtek PHY support is not even compiled-in for standard u-boot build.
I have added it to the standard config.

woba@fedora:~/work/beaglev-fire/BeagleV-Fire-ubuntu/u-boot$ cat .config | grep PHY
CONFIG_PHYS_64BIT=y
CONFIG_PHYLIB=y
# CONFIG_PHY_ADDR_ENABLE is not set
# CONFIG_PHYLIB_10G is not set
# CONFIG_PHY_AQUANTIA is not set
# CONFIG_PHY_ATHEROS is not set
# CONFIG_PHY_BROADCOM is not set
# CONFIG_PHY_CORTINA is not set
# CONFIG_PHY_DAVICOM is not set
# CONFIG_PHY_ET1011C is not set
# CONFIG_PHY_LXT is not set
# CONFIG_PHY_MARVELL is not set
# CONFIG_PHY_MESON_GXL is not set
# CONFIG_PHY_MICREL is not set
# CONFIG_PHY_MSCC is not set
# CONFIG_PHY_NATSEMI is not set
# CONFIG_PHY_NXP_C45_TJA11XX is not set
CONFIG_PHY_REALTEK=y
# CONFIG_RTL8211X_PHY_FORCE_MASTER is not set
# CONFIG_RTL8211F_PHY_FORCE_EEE_RXC_ON is not set
# CONFIG_RTL8201F_PHY_S700_RMII_TIMINGS is not set
# CONFIG_PHY_SMSC is not set
# CONFIG_PHY_TERANETICS is not set
# CONFIG_PHY_TI is not set
# CONFIG_PHY_TI_DP83867 is not set
# CONFIG_PHY_TI_GENERIC is not set
CONFIG_PHY_VITESSE=y
# CONFIG_PHY_XILINX is not set
# CONFIG_PHY_XILINX_GMII2RGMII is not set
# CONFIG_PHY_FIXED is not set
# CONFIG_PHY_NCSI is not set
# CONFIG_DM_ETH_PHY is not set
# CONFIG_PHY_GIGE is not set
# PHY Subsystem
# CONFIG_PHY is not set
# CONFIG_MIPI_DPHY_HELPERS is not set

But, this didn’t help.

I have seen a few reports regarding the same message for other platforms.
Usually, they mention to fix reset part in device tree. Would that help?
I haven’t noticed any reset line nor reset controller set in the device tree.

Kind regards,
Wojciech Bartczak.

The u-boot on the Fire is a mod of that for the icicle board. Unfortunately, the ethernet configuration was not changed to reflect the configuration of the Fire, and as a result u-boot is trying to use the wrong interface.
This can be fixed by rebuilding u-boot. You need to make changes to the device tree source and add in support for the Realtec PHY used on the Fire. I did this and was able to get tftboot to start.

I have attached the git diff for the changes I made to the dts file. Note you need change the file in the patches directory. I got fooled multiple times modifying the one in the u-boot directory and not realizing it was being wacked by the build script (03_build_u-boot.sh). The mods enable both interfaces since it was easier to figure out how to get things to work that way.

dtsmods.txt (1 KB)

2 Likes

Hi keck9939!

Thanks for the answer :smiley: It’s golden. I almost already forget about this issue. I mean it still is here. I just hadn’t time to experiment more. I’ve tried something similar you did in the patch. So, I come up with reg = <0>; by inspecting other files and reading documentation. Unfortunately, I haven’t touched aliases. So, my board remained dead. I’ll check the patch and back with the results.

As promissed I get back with feedback.
It works like a charm :smiley:

  ethernet@20110000: PHY present at 0
  ethernet@20110000: Starting autonegotiation...
  ethernet@20110000: Autonegotiation complete
  ethernet@20110000: link up, 1000Mbps full-duplex (lpa: 0x2800)
  Using ethernet@20110000 device