Skip to content

board/adi/ev-sc598-som: support SPI NAND#18

Draft
pamolloy wants to merge 4 commits intomainfrom
philip/test-spi-nand
Draft

board/adi/ev-sc598-som: support SPI NAND#18
pamolloy wants to merge 4 commits intomainfrom
philip/test-spi-nand

Conversation

@pamolloy
Copy link
Copy Markdown
Contributor

@pamolloy pamolloy commented Mar 30, 2026

  • SPI Chip Select Mismatch Between U-Boot and Linux linux#3244
  • Load Linux from NAND in U-Boot
  • Document raw read, write and erase performance using mtd_speedtest
  • Document filesystem performance using ubifs
  • Document potential performance gains from using the OSPI controller instead of the normal SPI controllers
    • Currently in development
  • Use hardware specific driver instead of generic spi-nand driver and review part-specific support
    • There are no part specific compatible strings parsed by the driver. All configuration is read from the NAND part at runtime
  • Test the built-in ECC correction in the NAND
    • ECC is enabled by default. Since it is recommended to use the ECC on the NAND we won't test without it
  • Setup long-term testing in automated hardware test bed

Early tests using time and nanddump add significant overhead and do not accurately reflect performance.

@pamolloy pamolloy self-assigned this Mar 30, 2026
@pamolloy pamolloy added this to ADSP Mar 30, 2026
@pamolloy
Copy link
Copy Markdown
Contributor Author

=> mtd erase spi-nand0 0x3FF00000 0x40000
Erasing 0x3ff00000 ... 0x3ff3ffff (1 eraseblock(s))
=> mw.b 0x90000000 0xAA 0x40000
=> mtd write spi-nand0 0x90000000 0x3FF00000 0x40000
Writing 262144 byte(s) (64 page(s)) at offset 0x3ff00000
=> mw.b 0x91000000 0x00 0x40000
=> mtd read spi-nand0 0x91000000 0x3FF00000 0x40000
Reading 262144 byte(s) (64 page(s)) at offset 0x3ff00000
=> cmp.b 0x90000000 0x91000000 0x40000
Total of 262144 byte(s) were the same

@pamolloy pamolloy requested a review from a team March 30, 2026 15:58
@pamolloy pamolloy force-pushed the philip/test-spi-nand branch from f1f9c7a to 658be7a Compare April 2, 2026 16:27
The long-term availability of eMMC is in question. Support a modified
EV-SC598-SOM where the SPI flash has been replaced with a NAND part that
is pin compatible to evaluate performance on the EV-SC598-SOM.

Define two devicetree overlays, for Linux and U-Boot, because the
register values are off by one. This will eventually get cleaned up as
part of a bigger effort to clean-up Linux and remove the U-Boot
devicetrees.

Signed-off-by: Philip Molloy <philip.molloy@analog.com>
@pamolloy
Copy link
Copy Markdown
Contributor Author

pamolloy commented Apr 10, 2026

# nandtest -k /dev/mtd4
ECC corrections: 6
ECC failures   : 0
Bad blocks     : 0
BBT blocks     : 0
00600000: reading (1 of 4)...
 3 bit(s) ECC corrected at 00600000
00700000: reading (1 of 4)...
...
 3 bit(s) ECC corrected at 3af00000
3af00000: reading (4 of 4)...
 3 bit(s) ECC corrected at 3af00000
3de80000: checking...of 1)...
Finished pass 1 successfully

Reconfigure the clock tree to improve SPI NAND performance by 25%
(4.4 MB/s to 5.5 MB/s).

Increase CGU0_ODIV output (oclk_0) from 62.5 MHz to 250 MHz, configure
the SPI controller to use oclk_0 as parent, and set spi-max-frequency
to 83 MHz (actual: 83.3 MHz). This avoids modifying sclk0_0 which is
shared by UARTs, I2C, timers, watchdog, and Ethernet.

Since eMMC defaults to oclk_0 and cannot handle 250 MHz, reconfigure it
to use dclk_0_half (167 MHz). Also disable eMMC as it is not used in
this NAND-only configuration.

Tested with: time nanddump /dev/mtd4 -l 1048576 -f /dev/null

Signed-off-by: Philip Molloy <philip@philipmolloy.com>
Signed-off-by: Philip Molloy <philip@philipmolloy.com>
@pamolloy pamolloy force-pushed the philip/test-spi-nand branch from 8429df3 to 16c7fd9 Compare April 10, 2026 14:08
Signed-off-by: Philip Molloy <philip.molloy@analog.com>
@pamolloy
Copy link
Copy Markdown
Contributor Author

# modprobe mtd_speedtest dev=4
[   93.362161] 
[   93.363503] =================================================
[   93.369753] mtd_speedtest: MTD device: 4
[   93.373781] mtd_speedtest: MTD device size 1038876672, eraseblock size 262144, page size 4096, count 6
[   93.391230] mtd_test: scanning for bad eraseblocks
[   93.398253] mtd_test: scanned 3963 eraseblocks, 0 are bad
[   96.705496] mtd_speedtest: testing eraseblock write speed
[  521.508698] mtd_speedtest: eraseblock write speed is 2388 KiB/s
[  521.514484] mtd_speedtest: testing eraseblock read speed
[  711.576882] mtd_speedtest: eraseblock read speed is 5338 KiB/s
[  717.520648] mtd_speedtest: testing page write speed
[ 1142.512683] mtd_speedtest: page write speed is 2387 KiB/s
[ 1142.517987] mtd_speedtest: testing page read speed
[ 1332.888226] mtd_speedtest: page read speed is 5329 KiB/s
[ 1338.840168] mtd_speedtest: testing 2 page write speed
[ 1763.660605] mtd_speedtest: 2 page write speed is 2388 KiB/s
[ 1763.666038] mtd_speedtest: testing 2 page read speed
[ 1953.896947] mtd_speedtest: 2 page read speed is 5333 KiB/s
[ 1953.902335] mtd_speedtest: Testing erase speed
[ 1959.880748] mtd_speedtest: erase speed is 169836 KiB/s
[ 1959.885762] mtd_speedtest: Testing 2x multi-block erase speed
[ 1963.147631] mtd_speedtest: 2x multi-block erase speed is 311597 KiB/s
[ 1963.153925] mtd_speedtest: Testing 4x multi-block erase speed
[ 1966.415147] mtd_speedtest: 4x multi-block erase speed is 311657 KiB/s
[ 1966.421439] mtd_speedtest: Testing 8x multi-block erase speed
[ 1969.682438] mtd_speedtest: 8x multi-block erase speed is 311678 KiB/s
[ 1969.688735] mtd_speedtest: Testing 16x multi-block erase speed
[ 1972.949868] mtd_speedtest: 16x multi-block erase speed is 311676 KiB/s
[ 1972.956249] mtd_speedtest: Testing 32x multi-block erase speed
[ 1976.217398] mtd_speedtest: 32x multi-block erase speed is 311672 KiB/s
[ 1976.223779] mtd_speedtest: Testing 64x multi-block erase speed
[ 1979.484643] mtd_speedtest: 64x multi-block erase speed is 311699 KiB/s
[ 1979.491023] mtd_speedtest: finished
[ 1979.494752] =================================================

@pamolloy
Copy link
Copy Markdown
Contributor Author

The SPI controller driver includes an unused adi,enable-dma devicetree attribute (see spi-adi.c. It is only referenced in a commented block in the SC594 devicetree (see sc594-som.dtsi).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant