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

Anup Patel anup at brainfault.org
Mon Jan 20 05:22:25 CET 2020


On Fri, Jan 17, 2020 at 6:16 PM Pragnesh Patel
<pragnesh.patel at sifive.com> wrote:
>
> 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.

The ZSBL loads next stage (i.e. FSBL or U-Boot SPL) from a
partition with GUID type 2e54b353-1271-4842-806f-e436d6af6985

You need to document how U-Boot SPL will detect a partition
containtaining u-boot.itb image.

I have same comment in your documentation patch as well.

Regards,
Anup

> 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:
>
> U-Boot SPL 2020.01-00177-ga3fabe50f9 (Jan 17 2020 - 14:20:12 +0530)
> Trying to boot from MMC1
>
>
> U-Boot 2020.01-00177-ga3fabe50f9 (Jan 17 2020 - 14:20:12 +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
> Board serial number should not be 0 !!
> Net:
> Warning: ethernet at 10090000 (eth0) using random MAC address - c6:3a:5b:53:64:8b
> 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: #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          #################################################################
>          ###################################
>          879.9 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.008473] Console: colour dummy device 80x25
> [    0.012818] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000)
> [    0.022844] pid_max: default: 32768 minimum: 301
> [    0.027915] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
> [    0.035331] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
> [    0.044785] rcu: Hierarchical SRCU implementation.
> [    0.049251] smp: Bringing up secondary CPUs ...
> [    0.055022] smp: Brought up 1 node, 4 CPUs
> [    0.059654] devtmpfs: initialized
> [    0.063816] random: get_random_u32 called from bucket_table_alloc.isra.29+0x4e/0x160 with crng_init=0
> [    0.072584] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
> [    0.081998] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
> [    0.089509] NET: Registered protocol family 16
> [    0.105911] vgaarb: loaded
> [    0.108162] SCSI subsystem initialized
> [    0.111945] usbcore: registered new interface driver usbfs
> [    0.117105] usbcore: registered new interface driver hub
> [    0.122485] usbcore: registered new device driver usb
> [    0.128077] clocksource: Switched to clocksource riscv_clocksource
> [    0.140269] NET: Registered protocol family 2
> [    0.144444] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
> [    0.152613] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
> [    0.162232] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
> [    0.172151] TCP: Hash tables configured (established 65536 bind 65536)
> [    0.178334] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
> [    0.185134] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
> [    0.192547] NET: Registered protocol family 1
> [    0.196747] RPC: Registered named UNIX socket transport module.
> [    0.202143] RPC: Registered udp transport module.
> [    0.206826] RPC: Registered tcp transport module.
> [    0.211502] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [    0.217932] PCI: CLS 0 bytes, default 64
> [    0.222136] Unpacking initramfs...
> [    0.578833] Freeing initrd memory: 4460K
> [    0.583009] workingset: timestamp_bits=62 max_order=21 bucket_order=0
> [    0.596701] NFS: Registering the id_resolver key type
> [    0.601051] Key type id_resolver registered
> [    0.605147] Key type id_legacy registered
> [    0.609146] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
> [    0.615983] 9p: Installing v9fs 9p2000 file system support
> [    0.621637] NET: Registered protocol family 38
> [    0.625757] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
> [    0.633107] io scheduler mq-deadline registered
> [    0.637615] io scheduler kyber registered
> [    0.685677] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> [    0.692265] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 4, base_baud = 0) is a SiFive UART v0
> [    0.700647] printk: console [ttySIF0] enabled
> [    0.700647] printk: console [ttySIF0] enabled
> [    0.709309] printk: bootconsole [sifive0] disabled
> [    0.709309] printk: bootconsole [sifive0] disabled
> [    0.719109] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 1, base_baud = 0) is a SiFive UART v0
> [    0.728428] [drm] radeon kernel modesetting enabled.
> [    0.745378] loop: module loaded
> [    0.748292] sifive_spi 10040000.spi: mapped; irq=3, cs=1
> [    0.753581] sifive_spi 10050000.spi: mapped; irq=5, cs=1
> [    0.758896] libphy: Fixed MDIO Bus: probed
> [    0.762973] macb 10090000.ethernet: Registered clk switch 'sifive-gemgxl-mgmt'
> [    0.769730] macb: GEM doesn't support hardware ptp.
> [    0.774619] libphy: MACB_mii_bus: probed
> [    0.940367] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.et)
> [    0.954911] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 6 (c6:3a:5b:53:64:8b)
> [    0.964713] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
> [    0.970434] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
> [    0.976426] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [    0.982850] ehci-pci: EHCI PCI platform driver
> [    0.987307] ehci-platform: EHCI generic platform driver
> [    0.992565] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> [    0.998665] ohci-pci: OHCI PCI platform driver
> [    1.003110] ohci-platform: OHCI generic platform driver
> [    1.008574] usbcore: registered new interface driver uas
> [    1.013636] usbcore: registered new interface driver usb-storage
> [    1.019712] mousedev: PS/2 mouse device common for all mice
> [    1.050585] mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling
> [    1.057730] usbcore: registered new interface driver usbhid
> [    1.063114] usbhid: USB HID core driver
> [    1.067825] NET: Registered protocol family 10
> [    1.072447] Segment Routing with IPv6
> [    1.075393] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> [    1.081772] NET: Registered protocol family 17
> [    1.085893] 9pnet: Installing 9P2000 support
> [    1.089981] Key type dns_resolver registered
> [    1.096414] Freeing unused kernel memory: 208K
> [    1.100095] This architecture does not have kernel memory protection.
> [    1.106509] 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.167986] mmc0: host does not support reading read-only switch, assuming write-enable
> [    1.175239] mmc0: new SDHC card on SPI
> [    1.180374] mmcblk0: mmc0:0000 SC16G 14.8 GiB
> [    1.214920]  mmcblk0: p1 p2 p4
> modprobe: can't change directory to '/lib/modules': No such file or directory
> Initializing random number generator... [    1.654626] random: dd: uninitialized urandom read (512 bytes read)
> done.
> Starting network: udhcpc: started, v1.29.3
> udhcpc: sending discover
> [    3.724743] macb 10090000.ethernet eth0: link up (100/Full)
> [    3.729562] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> udhcpc: sending discover
> udhcpc: sending select for 172.16.35.82
> udhcpc: lease of 172.16.35.82 obtained, lease time 28800
> deleting routers
> adding dns 172.16.34.150
> adding dns 172.16.24.25
> OK
> Starting dropbear sshd: [    4.885211] random: dropbear: uninitialized urandom read (32 bytes read)
> OK
>
> Welcome to Buildroot
> buildroot login: [   10.336594] random: fast init done
> [  220.332040] random: crng init done
>
> Welcome to Buildroot
> buildroot login: root
> Password:
> #
>
>
> Pragnesh Patel (9):
>   misc: add driver for the Sifive otp controller
>   Sifive: FU540: Add place-holder for FU540 clk
>   Sifive: FU540: Add header files for SoC
>   riscv: Add _image_binary_end for SPL
>   lib: Makefile: build crc7.c when CONFIG_MMC_SPI
>   riscv: sifive: dts: fu540: Add board -u-boot.dtsi files
>   riscv: sifive: fu540: Add U-boot SPL header files
>   riscv: sifive: fu540: add SPL configuration
>   doc: update FU540 RISC-V documentation
>
>  arch/riscv/cpu/u-boot-spl.lds                 |    1 +
>  arch/riscv/dts/fu540-c000-u-boot.dtsi         |   56 +
>  .../dts/hifive-unleashed-a00-u-boot.dtsi      |   24 +
>  arch/riscv/include/asm/arch-fu540/cache.h     |   42 +
>  arch/riscv/include/asm/arch-fu540/clk.h       |   14 +
>  arch/riscv/include/asm/arch-fu540/gpio.h      |   14 +
>  arch/riscv/include/asm/arch-fu540/otp.h       |   80 ++
>  arch/riscv/include/asm/arch-fu540/spi.h       |   15 +
>  arch/riscv/include/asm/arch-fu540/uart.h      |   14 +
>  arch/riscv/include/asm/arch-generic/gpio.h    |   32 +-
>  arch/riscv/include/asm/arch-sifive/gpio.h     |   42 +
>  arch/riscv/include/asm/arch-sifive/spi.h      |   93 ++
>  arch/riscv/include/asm/arch-sifive/uart.h     |   35 +
>  arch/riscv/include/asm/csr.h                  |    2 +
>  board/sifive/fu540/Kconfig                    |   11 +
>  board/sifive/fu540/MAINTAINERS                |    1 +
>  board/sifive/fu540/Makefile                   |    5 +
>  board/sifive/fu540/ccache.h                   |   43 +
>  board/sifive/fu540/ddrregs.c                  |  625 +++++++++
>  board/sifive/fu540/fu540-memory-map.h         |   59 +
>  board/sifive/fu540/fu540.c                    |  140 +-
>  board/sifive/fu540/regconfig-ctl.h            |  274 ++++
>  board/sifive/fu540/regconfig-phy.h            | 1224 +++++++++++++++++
>  board/sifive/fu540/spl.c                      |  307 +++++
>  board/sifive/fu540/ux00ddr.h                  |  276 ++++
>  board/sifive/fu540/ux00prci.h                 |   69 +
>  configs/sifive_fu540_defconfig                |    2 +
>  configs/sifive_fu540_spl_defconfig            |   26 +
>  doc/board/sifive/fu540.rst                    |  370 +++++
>  drivers/misc/Kconfig                          |    7 +
>  drivers/misc/Makefile                         |    1 +
>  drivers/misc/ememory-otp.c                    |  206 +++
>  drivers/spi/spi-sifive.c                      |   81 +-
>  include/configs/sifive-fu540.h                |   18 +
>  lib/Makefile                                  |    1 +
>  35 files changed, 4027 insertions(+), 183 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/clk.h
>  create mode 100644 arch/riscv/include/asm/arch-fu540/gpio.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 arch/riscv/include/asm/arch-sifive/gpio.h
>  create mode 100644 arch/riscv/include/asm/arch-sifive/spi.h
>  create mode 100644 arch/riscv/include/asm/arch-sifive/uart.h
>  create mode 100644 board/sifive/fu540/ccache.h
>  create mode 100644 board/sifive/fu540/ddrregs.c
>  create mode 100644 board/sifive/fu540/fu540-memory-map.h
>  create mode 100644 board/sifive/fu540/regconfig-ctl.h
>  create mode 100644 board/sifive/fu540/regconfig-phy.h
>  create mode 100644 board/sifive/fu540/spl.c
>  create mode 100644 board/sifive/fu540/ux00ddr.h
>  create mode 100644 board/sifive/fu540/ux00prci.h
>  create mode 100644 configs/sifive_fu540_spl_defconfig
>  create mode 100644 drivers/misc/ememory-otp.c
>
> --
> 2.17.1
>


More information about the U-Boot mailing list