From patchwork Fri Jan 24 05:50:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pragnesh Patel X-Patchwork-Id: 240033 List-Id: U-Boot discussion From: pragnesh.patel at sifive.com (Pragnesh Patel) Date: Fri, 24 Jan 2020 11:20:13 +0530 Subject: [PATCH v3 00/10] RISC-V SiFive FU540 support SPL Message-ID: <20200124055026.30787-1-pragnesh.patel@sifive.com> This series add support for SPL to FU540.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 / 3) Change to u-boot-dir 4) make sifive_fu540_spl_defconfig 5) make all 6) ZSBL loads the U-boot SPL(u-boot-spl.bin) from a partition with GUID type 2e54b353-1271-4842-806f-e436d6af6985 sudo dd if=spl/u-boot-spl.bin of=/dev/sdc4 bs=1M 7) U-boot SPL expects a u-boot FIT image(u-boot.itb) from 1st partition(/dev/sdc1) of SD card irrespective of GUID 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-00178-g30592e8819 (Jan 22 2020 - 14:37:24 +0530) Trying to boot from MMC1 U-Boot 2020.01-00178-g30592e8819 (Jan 22 2020 - 14:37:24 +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 - e6:40:50:48:0d: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: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################### 940.4 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) .... .... Welcome to Buildroot buildroot login: root Password: # Changes in v3: - Remove arch-fu540 and arch-sifive from arch/riscv/include/asm/ - Split SPL patches into DDR and SPL and spl defconfig - Update fu540/MAINTAINERS file - Update fu540.rst on how to build and flash U-boot SPL Changes in v2: - Add DM driver Sifive OTP - Split SPL patches into multiple patches - Add a seprate patch for _image_binary_end and crc7.c - Add a seprate patch to add board -u-boot.dtsi files - Update FU540 RISC-V documentation Pragnesh Patel (10): misc: add driver for the Sifive otp controller 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 DDR4 info riscv: sifive: fu540: add SPL configuration configs: fu540: Add config file for U-boot SPL riscv: sifive: fu540: enable all cache ways from u-boot proper sifive: fix palmer's email address and add sifive_fu540_spl_defconfig doc: update FU540 RISC-V documentation arch/riscv/cpu/u-boot-spl.lds | 1 + arch/riscv/dts/fu540-c000-u-boot.dtsi | 55 + .../dts/hifive-unleashed-a00-u-boot.dtsi | 22 + board/sifive/fu540/Kconfig | 8 + board/sifive/fu540/MAINTAINERS | 3 +- board/sifive/fu540/Makefile | 6 + board/sifive/fu540/cache.c | 30 + board/sifive/fu540/cache.h | 13 + board/sifive/fu540/ddr.c | 868 ++++++++++++ board/sifive/fu540/fu540-memory-map.h | 33 + board/sifive/fu540/fu540.c | 139 +- board/sifive/fu540/regconfig-ctl.h | 270 ++++ board/sifive/fu540/regconfig-phy.h | 1220 +++++++++++++++++ board/sifive/fu540/spl.c | 252 ++++ board/sifive/fu540/ux00ddr.h | 45 + board/sifive/fu540/ux00prci.h | 56 + configs/sifive_fu540_defconfig | 2 + configs/sifive_fu540_spl_defconfig | 26 + doc/board/sifive/fu540.rst | 376 +++++ drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/ememory-otp.c | 207 +++ include/configs/sifive-fu540.h | 18 + lib/Makefile | 1 + 24 files changed, 3585 insertions(+), 74 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 board/sifive/fu540/cache.c create mode 100644 board/sifive/fu540/cache.h create mode 100644 board/sifive/fu540/ddr.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