[U-Boot] [PATCH 0/3] Ethernet support for QEMU sifive_u machine

Anup Patel anup at brainfault.org
Wed Dec 19 04:40:55 UTC 2018


On Tue, Dec 18, 2018 at 4:06 PM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> Hi Anup,
>
> On Tue, Dec 18, 2018 at 6:33 PM Anup Patel <anup at brainfault.org> wrote:
> >
> > On Tue, Dec 18, 2018 at 3:21 PM Bin Meng <bmeng.cn at gmail.com> wrote:
> > >
> > > Hi Anup,
> > >
> > > On Mon, Dec 17, 2018 at 7:51 PM Anup Patel <anup at brainfault.org> wrote:
> > > >
> > > > This patchset enables Cadance MACB ethernet driver for
> > > > QEMU sifive_u machine. The Cadance MACB ethernet driver
> > > > works fine for QEMU sifive_u machince in both M-mode and
> > > > S-mode with some minor fixes.
> > > >
> > > > The patches are based upon latest RISC-V U-Boot tree
> > > > (git://git.denx.de/u-boot-riscv.git) at commit id
> > > > 9deb8d2fcd13d4a40a4e63c396fe4376af46efac
> > > >
> > > > To try on QEMU, please ensure following patches are
> > > > applied to QEMU sources:
> > > > https://patchwork.kernel.org/patch/10729579/
> > > > https://patchwork.kernel.org/patch/10729581/
> > > >
> > >
> > > What "-device " parameter should I tell QEMU to instantiate the MACB?
> > > "-device ?" does not give me anything that looks like MACB. Without a
> > > proper "-device " parameter, I can boot U-Boot on QEMU sifive_u and
> > > see U-Boot driver is probed, but a simple 'ping' test does not work.
> >
> > Try the following:
> > # setenv ipaddr 10.0.2.1
> > # ping 10.0.2.2
> >
>
> Yes, I have set up all the required network parameters.
>
> > The above works for me on QEMU.
>
> My understanding is that we need enable QEMU network via "-netdev "
> (either usr, or tap), with a corresponding "-device". I don't know how
> to set it up. What's your command line to test this?
>

"-netdev" or "-device" parameters are not mandatory. By default, virtual
NICs are in NAT mode. The QEMU NAT gateway is at IP address
10.0.2.2. We can always ping the NAT gateway when virtual NIC is in
NAT mode.

Here's how I compile for M-mode:
# ARCH=riscv
# CROSS_COMPILE=riscv64-unknown-linux-gnu-
# make qemu-riscv64_defconfig
# make

My U-boot log is as follows:

anup at anup-ubuntu64:~/Work/riscv-test/u-boot$ qemu-system-riscv64 -M
sifive_u -m 256M -display none -serial stdio -kernel ./u-boot


U-Boot 2019.01-rc1-00948-ge6b3cdafd0 (Dec 19 2018 - 10:05:50 +0530)

CPU:   rv64imafdcsu
Model: ucbbar,spike-bare,qemu
DRAM:  256 MiB
In:    uart at 10013000
Out:   uart at 10013000
Err:   uart at 10013000
Net:
Warning: ethernet at 100900fc (eth0) using random MAC address - f6:1f:8c:13:83:c0
eth0: ethernet at 100900fc
Hit any key to stop autoboot:  0

Device 0: unknown device
ethernet at 100900fc: PHY present at 0
ethernet at 100900fc: link up, 100Mbps full-duplex (lpa: 0xcde1)
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (2 ms)
Using ethernet at 100900fc device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x82100000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
ethernet at 100900fc: PHY present at 0
ethernet at 100900fc: link up, 100Mbps full-duplex (lpa: 0xcde1)
BOOTP broadcast 1
DHCP client bound to address 10.0.2.15 (1 ms)
Using ethernet at 100900fc device
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x81000000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
=> ping 10.0.2.2
ethernet at 100900fc: PHY present at 0
ethernet at 100900fc: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using ethernet at 100900fc device
host 10.0.2.2 is alive
=>
ethernet at 100900fc: PHY present at 0
ethernet at 100900fc: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using ethernet at 100900fc device
host 10.0.2.2 is alive
=> qemu-system-riscv64: terminating on signal 2


Regards,
Anup


More information about the U-Boot mailing list