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

I am getting the same results are you did @wbartczak.
Looks like this didn’t make it’s way into the Issue queue for the repository.
Did you open an issue there?

I wonder if @RobertCNelson could tell us how to proceed here?

I posted an issue a while back. There has been no action.
u-boot does not support tftpboot (#1) · Issues · BeagleV-Fire / BeagleV-Fire-u-boot · GitLab (openbeagle.org)
Until it is officially addressed, you can follow the instructions I posted in this thread on Apr 10 to get it to work.

1 Like

You’re right; I see it now.

Might I suggest you decorate it with your solution or a link back to here,
so whoever gets assigned to the issue can find your solution and give it a closer look?
I haven’t been on the forums long enough to know how PRs/MRs are handled,
but perhaps that could be of some use also?

Hi Iranders,

Sorry for late answer, I’ve been traveling a lot recently hence no answer before.
No I didn’t, but from previous post I see it has been noted.
That said, solution above works. I’ve been using it since the publication date.

I took the liberty to post an MR against the BeagleV-Fire-u-boot repository.

Once @RobertCNelson has time to look at it, we might even see it work out-of-the-box…

Oh you need to be careful there, Seeed has a test adapter that goes thru the backside connector for ethx

Edit, this is just u-boot, merged! :wink:

Shouldn't we change the name to beaglev-fire.dts instead?

Yeah, once the dts hits mainline linux, then we will use that name, in the case of this board it won’t be an issue…

Regards,

Wow! That was lightning fast! Kudos! :smiling_face: :+1:

Test build is up: deploy · Artifacts · build (#29654) · Jobs · BeagleV-Fire / BeagleV-Fire-ubuntu · GitLab

dhcp works…

U-Boot 2022.01-linux4microchip+fpga-2023.02-00003-g7ecfadec (May 30 2024 - 18:30:15 +0000)

CPU:   rv64imafdc
Model: Microchip PolarFire-SoC Icicle Kit
DRAM:  1.8 GiB
MMC:   mmc@20008000: 0
Loading Environment from nowhere... OK
In:    serial@20000000
Out:   serial@20000000
Err:   serial@20000000
Net:   eth0: ethernet@20110000
Hit any key to stop autoboot:  0 
RISC-V # dhcp 
ethernet@20110000: PHY present at 0
ethernet@20110000: Starting autonegotiation...
ethernet@20110000: Autonegotiation complete
ethernet@20110000: link up, 1000Mbps full-duplex (lpa: 0x2800)
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.3.209 (1319 ms)
*** Warning: no boot file name; using 'C0A803D1.img'
Using ethernet@20110000 device
TFTP from server 192.168.1.1; our IP address is 192.168.3.209
Filename 'C0A803D1.img'.
Load address: 0x80200000
Loading: T

Beat me to it, you did… :grinning:

U-Boot 2022.01-linux4microchip+fpga-2023.02-00003-g7ecfadec (May 30 2024 - 18:30:15 +0000)

CPU:   rv64imafdc
Model: Microchip PolarFire-SoC Icicle Kit
DRAM:  1.8 GiB
MMC:   mmc@20008000: 0
Loading Environment from nowhere... OK
In:    serial@20000000
Out:   serial@20000000
Err:   serial@20000000
Net:   eth0: ethernet@20110000
Hit any key to stop autoboot:  0
RISC-V # dhcp
ethernet@20110000: PHY present at 0
ethernet@20110000: Starting autonegotiation...
ethernet@20110000: Autonegotiation complete
ethernet@20110000: link up, 1000Mbps full-duplex (lpa: 0x3800)
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.36.69 (1267 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET
RISC-V # ping 192.168.36.1
ethernet@20110000: PHY present at 0
ethernet@20110000: Starting autonegotiation...
ethernet@20110000: Autonegotiation complete
ethernet@20110000: link up, 1000Mbps full-duplex (lpa: 0x3800)
Using ethernet@20110000 device
host 192.168.36.1 is alive
RISC-V #

Sorry for intruding but my problem is a follow-up to the topic.
This is the error I encounter, can anyone give me a suggestion?

RISC-V # ping 192.168.5.1
ethernet@20110000: PHY present at 0
ethernet@20110000: Starting autonegotiation…
ethernet@20110000: Autonegotiation complete
ethernet@20110000: link up, 1000Mbps full-duplex (lpa: 0x7800)
Using ethernet@20110000 device
host 192.168.5.1 is alive
RISC-V # setenv kernel_addr_r 0x80000000
RISC-V # tftpboot ${kernel_addr_r} rtems-app.img
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
TFTP from server 192.168.5.1; our IP address is 192.168.5.2
Filename ‘rtems-app.img’.
Load address: 0x80000000
Loading: #################################################################
####
9.2 MiB/s
done
Bytes transferred = 1006590 (f5bfe hex)
RISC-V # bootm ${kernel_addr_r}

Booting kernel from Legacy Image at 80000000 …

Image Name: RTEMS
Image Type: RISC-V Linux Kernel Image (gzip compressed)
Data Size: 1006526 Bytes = 982.9 KiB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum … OK
Uncompressing Kernel Image
Error: inflate() returned -3
gzip compressed: uncompress error -1
Must RESET board to recover
resetting …
reset not supported yet

ERROR ### Please RESET the board

Please, is there some more instructions how to upgrade u-boot on BeagleV-Fire safe way?

I have compiled last release of u-boot

U-Boot 2024.10-dirty (Nov 12 2024 - 19:38:56 +0100)

with next changes attached changes u-boot-2024.10-beaglev-fire.diff. The config command was

make CROSS_COMPILE=riscv64-linux-gnu- microchip_mpfs_icicle_defconfig all

I can test that new u-boot seems to be correct when loaded, chained from flashed u-boot

loadaddr=0x80200000
load mmc 0:2 ${loadaddr} u-boot.bin
go ${loadaddr}

The new u-boot connect by DHCP so it gives chance to test RTEMS and as well as allows Linux kernel development when test one is loaded over TFTP.

I have tried to build hart-software-services but I am missing tools at this moment and I would prefer to use known to work basic firmware for gradual update.

Does somebody have hart-software-services binary which can be combined with new u-boot somehow or does somebody have updated image which can be directly flashed and provides networking support?

You could start here and play around with building a newer u-boot that way…

1 Like