[PATCH v4 00/12] spi: airoha: driver improvements
Mikhail Kshevetskiy
mikhail.kshevetskiy at iopsys.eu
Sun Nov 9 08:06:46 CET 2025
Features:
* driver fixes & improvements
* dma support was implemented (will speedup flash reading/writing)
* spinand flash page size dirty hack required for old linux kernel was
removed, corresponding fixes were accepted to linux-next and openwrt
main
* en7523 specific workaround to prevent flash data damaging if UART_TXD
was short to GND
[General notes]
The patch series can be split on 3 parts:
* fixes + DMA acceleration (patches 1--7)
* removing of spinand flash page size dirty hack (patches 8--11)
* en7523 specific hack to avoid flash damaging (patch 12)
[Benchmark]
With DMA:
=> mtd read.benchmark spi-nand0 $loadaddr 0 0x8000000
Reading 134217728 byte(s) (65536 page(s)) at offset 0x00000000
Read speed: 8131kiB/s
Without DMA:
mtd read.benchmark spi-nand0 $loadaddr 0 0x8000000
Reading 134217728 byte(s) (65536 page(s)) at offset 0x00000000
Read speed: 2062kiB/s
[BIG FAT WARNING]
There is a dirty hack within linux airoha-snfi driver (linux < 6.19).
The driver needs to know an actual value of spinand page size. The driver
can't obtain it from either the spinand request or the spinand driver
itself. So on start linux driver reads SNFI registers to get spinand
page size value used by the bootloader (u-boot airoha-snfi driver).
Luckilly there is a better way to resolve an issue. It has been proven
that spinand flash page size is actually unnecessary for driver operations.
We can get all required data from dirmap requests.
The Linux side of an issue was fixed in
* linux-next (will appear in linux-6.19,
see: https://lore.kernel.org/lkml/20251012121707.2296160-1-mikhail.kshevetskiy@iopsys.eu/)
* openwrt main (will appear in the next release of OpenWRT,
see: https://github.com/openwrt/openwrt/pull/20295)
The patches 7--10 removes U-Boot side of the above hack. Unfortunately old
or unpatched linux < 6.19 may be unable to read/write flash properly if
patched bootloader was used to boot a device. This should not be a real
issue as most users will use openwrt main (already fixed).
Changes v2:
* use 'airoha,en7523-snand' compatible check to activate reserved mode boot hack
Changes v3:
* reorder patches, so fixes and DMA changes goes first
* write a better cover letter
Changes v4:
* update description of dirty hack used by linux airoha-snfi driver
* enable double speed reading of the flash on EN7523 SoC
Mikhail Kshevetskiy (12):
spi: airoha: remove unnecessary operation adjust_op_size
spi: airoha: add support of dual/quad wires spi modes to exec_op()
handler
spi: airoha: add dma support
spi: airoha: return an error for continuous mode dirmap creation cases
spi: airoha: support of dualio/quadio flash reading commands
spi: airoha: buffer must be 0xff-ed before writing
dts: airoha: en7523: enable double speed flash reading
spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT
spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and
REG_SPI_NFI_SECCUS_SIZE registers
spi: airoha: set custom sector size equal to flash page size
spi: airoha: avoid usage of flash specific parameters
spi: airoha: en7523: workaround flash damaging if UART_TXD was short
to GND
arch/arm/dts/en7523-u-boot.dtsi | 2 +-
drivers/spi/airoha_snfi_spi.c | 688 +++++++++++++++++++++++++-------
2 files changed, 547 insertions(+), 143 deletions(-)
--
2.51.0
More information about the U-Boot
mailing list