[U-Boot Patch v1 0/7] Fix currently available support for flash on HiFive Unleashed

Sagar Shrikant Kadam sagar.kadam at sifive.com
Thu Jan 23 21:15:59 CET 2020


Currently device ID for flash mounted on HiFive Unleashed is added to
U-Boot. Also there are few patches to go mainline (Thanks to Jagan Tekki
and Bin Meng).

This series addresses few issues discussed there:
Patch 1: Includes hifive-unleashed-a00-u-boot.dts for building DTB
Patch 2: Prints fdt base address which can be used for debugging purpose.
Patch 3,4: Number of chip select's for the spi nodes and adds method to
claim and release the bus Earlier it was observed that sf probe 0:2/4/6/8
etc.. used to detect the flash device even though it is only connected to
chip select 0, with these patches flash is now probed only CS0.
Patch 5,7: A workaround is added to make flash device accessible in single
bit mode & is tagged with TODO.
Patch 6: Introduce spi_nor_fixups method similar to linux to fix wrongly
read parameters from SFDP.
	      	 
This series is based on commit 052170c6a043 ("configs: Resync with
savedefconfig") with two below mentioned patches from [1]
[U-Boot,v2,4/5] riscv: dts: hifive-unleashed-a00: Add -u-boot.dtsi
[U-Boot,v2,5/5] sifive: fu540: Enable spi-nor flash support
 
[1] https://patchwork.ozlabs.org/patch/1177979/

The above series is available for testing here[2]
[2] https://github.com/sagsifive/u-boot/tree/dev/sagark/test_spi-nor

================Log for reference=====================
=> bdinfo
boot_params = 0x0000000000000000
DRAM bank   = 0x0000000000000000
-> start    = 0x0000000080000000
-> size     = 0x0000000200000000
relocaddr   = 0x00000000fff8c000
reloc off   = 0x000000007fd8c000
fdt_blob    = 0x00000000ff768530	->FDT base address
ethaddr     = 70:b3:d5:92:f2:c8
IP addr     = <NULL>
baudrate    = 115200 bps
=> fdt addr 0x00000000ff768530
=> fdt print /aliases
aliases {
        serial0 = "/soc/serial at 10010000";
        serial1 = "/soc/serial at 10011000";
        ethernet0 = "/soc/ethernet at 10090000";
        spi0 = "/soc/spi at 10040000";	-> Alias nodes from patch1 
        spi2 = "/soc/spi at 10050000";
};
=>----------------------------------------------------------------
Full flash memory erase/write/read/validate

=> sf probe 0:0
SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
=> mw 0x80600000 0x12348765 0x800000
=> sf erase 0x0 0x2000000
SF: 33554432 bytes @ 0x0 Erased: OK
=> sf write 0x80600000 0x0 0x2000000
device 0 whole chip
SF: 33554432 bytes @ 0x0 Written: OK
=> sf read  0x82600000 0x0 0x2000000
device 0 whole chip
SF: 33554432 bytes @ 0x0 Read: OK
=> cmp.b 0x80600000 0x82600000 0x2000000
Total of 33554432 byte(s) were the same
=>----------------------------------------------------------------
Flash detection only at valid Chip select 
=> sf probe 0:0
SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
=> sf probe 0:1
Invalid cs number = 1
Failed to initialize SPI flash at 0:1 (error -22)
=> sf probe 0:2
Invalid cs number = 2
Failed to initialize SPI flash at 0:2 (error -22)
=> sf probe 0:4
Invalid cs number = 4
Failed to initialize SPI flash at 0:4 (error -22)
=> sf probe 0:8
Invalid cs number = 8
Failed to initialize SPI flash at 0:8 (error -22)
=>----------------------------------------------------------------


Sagar Shrikant Kadam (7):
  riscv: dts: include -u-boot for dtb
  bdinfo: fu540: print fdt descriptor base for debug
  fu540: dtsi: spi: add num-cs info to dt
  spi: fu540: add claim and release method to spi-sifive.c
  spi: fu540: fix: use spi xfer bitlen for spi transfer
  nor: add post bfpt fix handler for is25wp256 device
  fu540: spi-nor: modify the flash read and program opcodes

 arch/riscv/dts/fu540-c000.dtsi          |  3 ++
 arch/riscv/dts/hifive-unleashed-a00.dts |  1 +
 board/sifive/fu540/Kconfig              |  1 +
 cmd/bdinfo.c                            |  1 +
 drivers/mtd/spi/sf_internal.h           | 16 +++++++
 drivers/mtd/spi/spi-nor-core.c          | 76 ++++++++++++++++++++++++++++++++-
 drivers/mtd/spi/spi-nor-ids.c           |  7 ++-
 drivers/spi/spi-sifive.c                | 55 +++++++++++++++++++++---
 include/linux/mtd/spi-nor.h             |  1 +
 9 files changed, 153 insertions(+), 8 deletions(-)

-- 
2.7.4



More information about the U-Boot mailing list