[PATCH 0/3] RISC-V SiFive FU540 support SPL

Pragnesh Patel pragnesh.patel at sifive.com
Tue Dec 31 07:30:52 CET 2019


This series add support for SPL to FU540. This series depends on
https://patchwork.ozlabs.org/patch/1196703/
(riscv: dts: Add hifive-unleashed-a00 dts from Linux)

U-Boot SPL can boot from L2 LIM (0x0800_0000) and jump to
OpenSBI(FW_DYNAMIC firmware) and U-Boot proper from MMC devices.

How to test this patch:
1) Go to OpenSBI-dir : make PLATFORM=sifive/fu540 O=build_dir I=install_dir FW_DYNAMIC=y install
2) cp install_dir/platform/sifive/fu540/firmware/fw_dynamic.bin <u-boot-dir>/
3) Change to u-boot-dir
4) make sifive_fu540_spl_defconfig
5) make all
6) SD card partition which contains "fw_payload.bin" previously
        /dev/sdc1 - SiFive bare-metal (or s     ->5202)
   should be now of
        /dev/sdc1 - 8300  Linux filesystem.
6) sudo dd if=spl/u-boot-spl.bin of=/dev/sdc4 bs=1M
7) sudo dd if=u-boot.itb of=/dev/sdc1 bs=1M

Following are the boot messages on FU540 five cores SMP platform:

HiFive-U serial #: 05374581

U-Boot SPL 2020.01-rc5-00007-g4a96c4e4ac-dirty (Dec 23 2019 - 16:49:18 +0530)
Trying to boot from MMC1


U-Boot 2020.01-rc5-00007-g4a96c4e4ac-dirty (Dec 23 2019 - 16:49:18 +0530)

CPU:   rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM:  8 GiB
MMC:   spi at 10050000:mmc at 0: 0
In:    serial at 10010000
Out:   serial at 10010000
Err:   serial at 10010000
Net:   eth0: ethernet at 10090000
Hit any key to stop autoboot:  0 
=> 
=> setenv serverip 172.16.35.74;setenv ipaddr 172.16.35.40;tftpboot 0x83000000 fit.itb;bootm 0x83000000
ethernet at 10090000: PHY present at 0
ethernet at 10090000: Starting autonegotiation...
ethernet at 10090000: Autonegotiation complete
ethernet at 10090000: link up, 100Mbps full-duplex (lpa: 0x41e1)
Using ethernet at 10090000 device
TFTP from server 172.16.35.74; our IP address is 172.16.35.40
Filename 'fit.itb'.
Load address: 0x83000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###################################
         876 KiB/s
done
Bytes transferred = 13823823 (d2ef4f hex)
## Loading kernel from FIT Image at 83000000 ...
   Using 'config-1' configuration
   Trying 'kernel at 1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x830000d8
     Data Size:    9247260 Bytes = 8.8 MiB
     Architecture: RISC-V
     OS:           Linux
     Load Address: 0x80200000
     Entry Point:  0x80200000
   Verifying Hash Integrity ... OK
## Loading ramdisk from FIT Image at 83000000 ...
   Using 'config-1' configuration
   Trying 'ramdisk at 1' ramdisk subimage
     Description:  ramdisk
     Type:         RAMDisk Image
     Compression:  gzip compressed
     Data Start:   0x838d3378
     Data Size:    4568674 Bytes = 4.4 MiB
     Architecture: RISC-V
     OS:           Linux
     Load Address: 0x82000000
     Entry Point:  unavailable
   Verifying Hash Integrity ... OK
   Loading ramdisk from 0x838d3378 to 0x82000000
WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file!
## Loading fdt from FIT Image at 83000000 ...
   Using 'config-1' configuration
   Trying 'fdt at 1' fdt subimage
     Description:  unavailable
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x838d1b80
     Data Size:    6023 Bytes = 5.9 KiB
     Architecture: RISC-V
   Verifying Hash Integrity ... OK
   Booting using the fdt blob at 0x838d1b80
   Loading Kernel Image
   Using Device Tree in place at 00000000838d1b80, end 00000000838d6306

Starting kernel ...

[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.3.0-13236-g97f9a3c4eee5 (pragneshp at sachinj2-OptiPlex-7010) (gcc version 8.2.0 (Buildroot 2018.11-rc2-00003-ga0787e9
[    0.000000] earlycon: sifive0 at MMIO 0x0000000010010000 (options '')
[    0.000000] printk: bootconsole [sifive0] enabled
[    0.000000] Initial ramdisk at: 0x(____ptrval____) (4568674 bytes)
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000027fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB)
[    0.000000] CPU with hartid=0 is not available
[    0.000000] CPU with hartid=0 is not available
[    0.000000] elf_hwcap is 0x112d
[    0.000000] percpu: Embedded 17 pages/cpu s30680 r8192 d30760 u69632
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2067975
[    0.000000] Kernel command line: earlycon=sifive,0x10010000 console=ttySIF0,115200
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 8179828K/8386560K available (6081K kernel code, 388K rwdata, 2025K rodata, 209K init, 307K bss, 206732K reserved, 0K cma-r)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] plic: mapped 53 interrupts with 4 handlers for 9 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns
[    0.000007] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
[    0.008475] Console: colour dummy device 80x25
[    0.012817] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000)
[    0.022843] pid_max: default: 32768 minimum: 301
[    0.027914] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.035329] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.044790] rcu: Hierarchical SRCU implementation.
[    0.049254] smp: Bringing up secondary CPUs ...
[    0.055029] smp: Brought up 1 node, 4 CPUs
[    0.059661] devtmpfs: initialized
[    0.063822] random: get_random_u32 called from bucket_table_alloc.isra.29+0x4e/0x160 with crng_init=0
[    0.072594] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.082004] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.089515] NET: Registered protocol family 16
[    0.105942] vgaarb: loaded
[    0.108197] SCSI subsystem initialized
[    0.111980] usbcore: registered new interface driver usbfs
[    0.117135] usbcore: registered new interface driver hub
[    0.122519] usbcore: registered new device driver usb
[    0.128108] clocksource: Switched to clocksource riscv_clocksource
[    0.140305] NET: Registered protocol family 2
[    0.144473] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.152647] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.162267] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.172183] TCP: Hash tables configured (established 65536 bind 65536)
[    0.178366] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.185164] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.192575] NET: Registered protocol family 1
[    0.196784] RPC: Registered named UNIX socket transport module.
[    0.202175] RPC: Registered udp transport module.
[    0.206857] RPC: Registered tcp transport module.
[    0.211533] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.217963] PCI: CLS 0 bytes, default 64
[    0.222163] Unpacking initramfs...
[    0.578809] Freeing initrd memory: 4460K
[    0.582984] workingset: timestamp_bits=62 max_order=21 bucket_order=0
[    0.596653] NFS: Registering the id_resolver key type
[    0.600998] Key type id_resolver registered
[    0.605099] Key type id_legacy registered
[    0.609098] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.615937] 9p: Installing v9fs 9p2000 file system support
[    0.621588] NET: Registered protocol family 38
[    0.625709] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    0.633058] io scheduler mq-deadline registered
[    0.637568] io scheduler kyber registered
[    0.685647] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.692241] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 4, base_baud = 0) is a SiFive UART v0
[    0.700625] printk: console [ttySIF0] enabled
[    0.700625] printk: console [ttySIF0] enabled
[    0.709285] printk: bootconsole [sifive0] disabled
[    0.709285] printk: bootconsole [sifive0] disabled
[    0.719077] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 1, base_baud = 0) is a SiFive UART v0
[    0.728423] [drm] radeon kernel modesetting enabled.
[    0.745353] loop: module loaded
[    0.748269] sifive_spi 10040000.spi: mapped; irq=3, cs=1
[    0.753551] sifive_spi 10050000.spi: mapped; irq=5, cs=1
[    0.758874] libphy: Fixed MDIO Bus: probed
[    0.762947] macb 10090000.ethernet: Registered clk switch 'sifive-gemgxl-mgmt'
[    0.769704] macb: GEM doesn't support hardware ptp.
[    0.774587] libphy: MACB_mii_bus: probed
[    0.940397] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.et)
[    0.954941] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 6 (70:b3:d5:b7:f5:81)
[    0.964744] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.970464] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.976458] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.982880] ehci-pci: EHCI PCI platform driver
[    0.987336] ehci-platform: EHCI generic platform driver
[    0.992593] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.998695] ohci-pci: OHCI PCI platform driver
[    1.003140] ohci-platform: OHCI generic platform driver
[    1.008604] usbcore: registered new interface driver uas
[    1.013666] usbcore: registered new interface driver usb-storage
[    1.019742] mousedev: PS/2 mouse device common for all mice
[    1.050616] mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling
[    1.057762] usbcore: registered new interface driver usbhid
[    1.063145] usbhid: USB HID core driver
[    1.067858] NET: Registered protocol family 10
[    1.072475] Segment Routing with IPv6
[    1.075421] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.081800] NET: Registered protocol family 17
[    1.085918] 9pnet: Installing 9P2000 support
[    1.090013] Key type dns_resolver registered
[    1.096438] Freeing unused kernel memory: 208K
[    1.100122] This architecture does not have kernel memory protection.
[    1.106536] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Starting mdev...
/etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: nonexistent directory
[    1.167972] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.175230] mmc0: new SDHC card on SPI
[    1.180257] mmcblk0: mmc0:0000 SC16G 14.8 GiB 
[    1.214677]  mmcblk0: p1 p2 p4
modprobe: can't change directory to '/lib/modules': No such file or directory
Initializing random number generator... [    1.666442] random: dd: uninitialized urandom read (512 bytes read)
done.
Starting network: udhcpc: started, v1.29.3
udhcpc: sending discover
[    3.756777] macb 10090000.ethernet eth0: link up (100/Full)
[    3.761593] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
udhcpc: sending discover
udhcpc: sending select for 172.16.35.21
udhcpc: lease of 172.16.35.21 obtained, lease time 28800
deleting routers
adding dns 172.16.34.150
adding dns 172.16.24.25
OK
Starting dropbear sshd: [    4.457029] random: dropbear: uninitialized urandom read (32 bytes read)
OK

Welcome to Buildroot
buildroot login: root
Password: 
# 


Pragnesh Patel (3):
  riscv: Add place-holder for FU540 clk and gpio
  riscv: Add FU540 specific includes
  riscv: sifive: fu540: add SPL configuration

 arch/riscv/cpu/u-boot-spl.lds                 |    1 +
 arch/riscv/dts/fu540-c000-u-boot.dtsi         |   65 +
 .../dts/hifive-unleashed-a00-u-boot.dtsi      |   24 +
 arch/riscv/include/asm/arch-fu540/cache.h     |   43 +
 arch/riscv/include/asm/arch-fu540/clint.h     |   20 +
 arch/riscv/include/asm/arch-fu540/clk.h       |   14 +
 arch/riscv/include/asm/arch-fu540/gpio.h      |   42 +
 arch/riscv/include/asm/arch-fu540/i2c.h       |   48 +
 arch/riscv/include/asm/arch-fu540/otp.h       |   80 ++
 arch/riscv/include/asm/arch-fu540/spi.h       |   86 ++
 arch/riscv/include/asm/arch-fu540/uart.h      |   35 +
 arch/riscv/include/asm/arch-generic/gpio.h    |   32 +-
 arch/riscv/include/asm/csr.h                  |    2 +
 board/sifive/fu540/Kconfig                    |   11 +
 board/sifive/fu540/MAINTAINERS                |    1 +
 board/sifive/fu540/Makefile                   |    6 +
 board/sifive/fu540/ememoryotp.c               |  143 ++
 board/sifive/fu540/fu540.c                    |   31 +-
 board/sifive/fu540/include/ccache.h           |   47 +
 board/sifive/fu540/include/clkutils.h         |   75 +
 board/sifive/fu540/include/ddrregs.h          |  622 +++++++++
 board/sifive/fu540/include/ememoryotp.h       |   24 +
 board/sifive/fu540/include/fu540-memory-map.h |  427 ++++++
 board/sifive/fu540/include/i2c.h              |   49 +
 board/sifive/fu540/include/regconfig-ctl.h    |  274 ++++
 board/sifive/fu540/include/regconfig-phy.h    | 1224 +++++++++++++++++
 board/sifive/fu540/include/spi.h              |  233 ++++
 board/sifive/fu540/include/uart.h             |   54 +
 board/sifive/fu540/include/ux00ddr.h          |  268 ++++
 board/sifive/fu540/include/ux00prci.h         |  206 +++
 board/sifive/fu540/spl.c                      |  321 +++++
 board/sifive/fu540/uart.c                     |   64 +
 configs/sifive_fu540_spl_defconfig            |   23 +
 include/configs/sifive-fu540.h                |   17 +
 lib/Makefile                                  |    1 +
 35 files changed, 4583 insertions(+), 30 deletions(-)
 create mode 100644 arch/riscv/dts/fu540-c000-u-boot.dtsi
 create mode 100644 arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
 create mode 100644 arch/riscv/include/asm/arch-fu540/cache.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/clint.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/clk.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/gpio.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/i2c.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/otp.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/spi.h
 create mode 100644 arch/riscv/include/asm/arch-fu540/uart.h
 create mode 100644 board/sifive/fu540/ememoryotp.c
 create mode 100644 board/sifive/fu540/include/ccache.h
 create mode 100644 board/sifive/fu540/include/clkutils.h
 create mode 100644 board/sifive/fu540/include/ddrregs.h
 create mode 100644 board/sifive/fu540/include/ememoryotp.h
 create mode 100644 board/sifive/fu540/include/fu540-memory-map.h
 create mode 100644 board/sifive/fu540/include/i2c.h
 create mode 100644 board/sifive/fu540/include/regconfig-ctl.h
 create mode 100644 board/sifive/fu540/include/regconfig-phy.h
 create mode 100644 board/sifive/fu540/include/spi.h
 create mode 100644 board/sifive/fu540/include/uart.h
 create mode 100644 board/sifive/fu540/include/ux00ddr.h
 create mode 100644 board/sifive/fu540/include/ux00prci.h
 create mode 100644 board/sifive/fu540/spl.c
 create mode 100644 board/sifive/fu540/uart.c
 create mode 100644 configs/sifive_fu540_spl_defconfig

-- 
2.17.1



More information about the U-Boot mailing list