Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30466 )
Change subject: soc/sifive/fu540: add code to initialize flash ......................................................................
Patch Set 29:
(4 comments)
I've got a Unleashed to test your code and found it useful after working with it less than 5 minutes. Some more comments as I finally understand what's going on.
https://review.coreboot.org/#/c/30466/29/src/mainboard/sifive/hifive-unleash... File src/mainboard/sifive/hifive-unleashed/flash.c:
https://review.coreboot.org/#/c/30466/29/src/mainboard/sifive/hifive-unleash... PS29, Line 35: .data_proto = SPI_PROTO_Q, That should read MSEL and determine the boot mode. If running in single bit mode use SPI_PROTO_S.
https://review.coreboot.org/#/c/30466/29/src/mainboard/sifive/hifive-unleash... PS29, Line 42: initialize_spi_flash_mmap( That should read MSEL and determine the boot mode. User can select between FU540_QSPI0, FU540_QSPI1, FU540_QSPI2 ?
https://review.coreboot.org/#/c/30466/29/src/soc/sifive/fu540/spi.c File src/soc/sifive/fu540/spi.c:
https://review.coreboot.org/#/c/30466/29/src/soc/sifive/fu540/spi.c@59 PS29, Line 59: } That should implement "const struct spi_ctrlr_buses spi_ctrlr_bus_map" and "const size_t spi_ctrlr_bus_map_count" in order to use the generic src/drivers/spi/spi-generic.c and existing SPI drivers.
https://review.coreboot.org/#/c/30466/29/src/soc/sifive/fu540/spi_flash.c File src/soc/sifive/fu540/spi_flash.c:
https://review.coreboot.org/#/c/30466/29/src/soc/sifive/fu540/spi_flash.c@52 PS29, Line 52: spi_txrx(spictrl, command_enable); Should use generic spi_xfer()