From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Ray Liu <ray.liu@airoha.com>, Mark Brown <broonie@kernel.org>,
linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Frieder Schrempf <frieder.schrempf@kontron.de>
Subject: Re: [PATCH v3 00/14] spi: airoha: driver fixes & improvements
Date: Fri, 22 Aug 2025 14:27:35 +0300 [thread overview]
Message-ID: <616a6567-e69d-4c66-a64a-ab0fae17568b@iopsys.eu> (raw)
In-Reply-To: <aKgSY7bOrC8-qZE3@lore-rh-laptop>
On 22.08.2025 09:46, Lorenzo Bianconi wrote:
>> On 21.08.2025 14:34, Lorenzo Bianconi wrote:
>>>> On 21.08.2025 09:58, Lorenzo Bianconi wrote:
>>>>>> This patch series greatly improve airoha snfi driver and fix a
>>>>>> number of serious bug.
>>>>>>
>>>>>> Fixed bugs:
>>>>>> * Fix reading/writing of flashes with more than one plane per lun
>>>>>> * Fix inability to read/write oob area
>>>>>> * Fill the buffer with 0xff before writing
>>>>>> * Fix reading of flashes supporting continuous reading mode
>>>>>> * Fix error paths
>>>>>>
>>>>>> Improvements:
>>>>>> * Add support of dual/quad wires spi modes in exec_op().
>>>>>> * Support of dualio/quadio flash reading commands
>>>>>> * Remove dirty hack that reads flash page settings from SNFI registers
>>>>>> during driver startup
>>>>>>
>>>>>> Unfortunately I am unable to test the driver with linux at the moment,
>>>>>> so only the following testing was done:
>>>>> It seems to me this is quite an important rework of the driver. I would prefer
>>>>> to have some test results for this series. Are you able to run mtd_test kernel
>>>>> module for testing?
>>>> I'll try to build latest openwrt with this patches and mtd_test kernel
>>>> module and try it on one of our boards.
>>> what board are you using for testing? If it is based on Airoha-7581 you could
>>> use the following repo for testing.
>>>
>>> https://github.com/Ansuel/openwrt/tree/openwrt-24.10-airoha-an7581-stable
>>>
>>> Regards,
>>> Lorenzo
>> What tests do you suggest to run?
> IIRC I run all of them. Can you please report even if there are some
> improvements (or penalties) in read/write speed?
>
>> I have a single flash I boot from. It have only 2 mtd partitions:
>>
>> [ 2.980849] spi-nand spi0.0: Micron SPI NAND was found.
>> [ 2.986102] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size:
>> 2048, OOB size: 128
>> [ 2.994493] 2 fixed-partitions partitions found on MTD device spi0.0
>> [ 3.000856] Creating 2 MTD partitions on "spi0.0":
>> [ 3.005651] 0x000000000000-0x000000020000 : "bl2"
>> [ 3.011247] 0x000000020000-0x000010000000 : "ubi"
>>
>> Most of tests are destructive. So If I use "bl2" or "ubi" partition for
>> test, next time I will be unable to boot :-(
> yes, I flashed the device after carrying out the test.
>
> Regards,
> Lorenzo
Is it enough to try tests on bl2 partition or it's better the whole flash?
By the way the current partitioning is bad -- there are flashes with 256
Mb erase block size.
So ubi will not start on the erase block boundary for such flashes.
Mikhail
>
>> Do you suggest to patch u-boot & linux to have more mtd partitions?
>>
>> This is the results of the only read-only test I found.
>>
>> root@OpenWrt:/lib/modules/6.6.79# insmod mtd_test.ko
>> root@OpenWrt:/lib/modules/6.6.79# insmod mtd_readtest.ko dev=1
>> [ 159.121706]
>> [ 159.123220] =================================================
>> [ 159.129053] mtd_readtest: MTD device: 1
>> [ 159.132898] mtd_readtest: MTD device size 268304384, eraseblock size
>> 131072, page size 2048, count of eraseblocks 2047, pages per eraseblock
>> 64, OOB size 128
>> [ 159.147008] mtd_test: scanning for bad eraseblocks
>> [ 159.152141] mtd_test: scanned 2047 eraseblocks, 0 are bad
>> [ 159.157549] mtd_readtest: testing page read
>>
>> Mikhail
>>
>>>> Actually patches can be divided on to parts:
>>>> * fixes of current driver (patches 1-10)
>>>> * change of behavior to avoid reading flash page settings from SNFI
>>>> registers during driver startup (patches 11-14)
>>>>
>>>> The changes are based on the code we are using for more than 3 years. I
>>>> adapt it to latest linux/u-boot code.
>>>>
>>>> Up to now the only known issue appears on en7523 chips only. Here a
>>>> corresponding patch description (not added to this series)
>>>> ====================================================== spi: airoha:
>>>> en7523: workaround flash damaging if UART_TXD was short to GND We found
>>>> that some serial console may pull TX line to GROUND during board boot
>>>> time. Airoha uses TX line as one of it's BOOT pins. This will lead to
>>>> booting in RESERVED boot mode. It was found that some flashes operates
>>>> incorrectly in RESERVED mode. Micron and Skyhigh flashes are definitely
>>>> affected by the issue, Winbond flashes are NOT affected. Details:
>>>> -------- DMA reading of odd pages on affected flashes operates
>>>> incorrectly. Page reading offset (start of the page) on hardware level
>>>> is replaced by 0x10. Thus results in incorrect data reading. Usage of
>>>> UBI make things even worse. Any attempt to access UBI leads to ubi
>>>> damaging. As result OS loading becomes impossible. Non-DMA reading is
>>>> OK. =======================================================
>>>>
>>>> Regards,
>>>> Mikhail
>>>>
>>>>
>>>>> Regards,
>>>>> Lorenzo
>>>>>
>>>>>> * Driver compiles without error.
>>>>>> * All changes were tested with corresponding u-boot driver. U-Boot
>>>>>> SpiNAND driver was modified as well to match linux-6.17-rc2 with
>>>>>> additional fixes for continuous mode.
>>>>>>
>>>>>> Changes v2:
>>>>>> * minor fix
>>>>>> * add comments to code
>>>>>>
>>>>>> Changes v3:
>>>>>> * add patch to prevent continuous reading
>>>>>>
>>>>>> Mikhail Kshevetskiy (14):
>>>>>> spi: airoha: return an error for continuous mode dirmap creation cases
>>>>>> spi: airoha: remove unnecessary restriction length
>>>>>> spi: airoha: add support of dual/quad wires spi modes
>>>>>> spi: airoha: remove unnecessary switch to non-dma mode
>>>>>> spi: airoha: unify dirmap read/write code
>>>>>> spi: airoha: switch back to non-dma mode in the case of error
>>>>>> spi: airoha: fix reading/writing of flashes with more than one plane
>>>>>> per lun
>>>>>> spi: airoha: support of dualio/quadio flash reading commands
>>>>>> spi: airoha: allow reading/writing of oob area
>>>>>> spi: airoha: buffer must be 0xff-ed before writing
>>>>>> 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 reading flash page settings from SNFI registers
>>>>>> during driver startup
>>>>>>
>>>>>> drivers/spi/spi-airoha-snfi.c | 508 +++++++++++++++++-----------------
>>>>>> 1 file changed, 260 insertions(+), 248 deletions(-)
>>>>>>
>>>>>> --
>>>>>> 2.50.1
>>>>>>
next prev parent reply other threads:[~2025-08-22 11:27 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 12:33 Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 01/14] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 02/14] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 03/14] spi: airoha: add support of dual/quad wires spi modes Mikhail Kshevetskiy
2025-08-20 12:48 ` Jyothi Kumar Seerapu
2025-08-20 12:33 ` [PATCH v3 04/14] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 05/14] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 06/14] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 07/14] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 08/14] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 09/14] spi: airoha: allow reading/writing of oob area Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 10/14] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 11/14] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 12/14] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 13/14] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 14/14] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-21 6:58 ` [PATCH v3 00/14] spi: airoha: driver fixes & improvements Lorenzo Bianconi
2025-08-21 11:13 ` Mikhail Kshevetskiy
2025-08-21 11:34 ` Lorenzo Bianconi
2025-08-21 12:24 ` Mikhail Kshevetskiy
2025-08-22 3:31 ` Mikhail Kshevetskiy
2025-08-22 6:46 ` Lorenzo Bianconi
2025-08-22 11:22 ` Mikhail Kshevetskiy
2025-08-22 13:14 ` Lorenzo Bianconi
2025-08-22 14:36 ` Mikhail Kshevetskiy
2025-08-22 20:00 ` Mikhail Kshevetskiy
2025-08-22 11:27 ` Mikhail Kshevetskiy [this message]
2025-08-23 0:16 ` [PATCH v4 00/13] " Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 01/13] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-23 8:04 ` Lorenzo Bianconi
2025-08-23 13:52 ` Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 02/13] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 03/13] spi: airoha: add support of dual/quad wires spi modes Mikhail Kshevetskiy
2025-08-23 8:16 ` Lorenzo Bianconi
2025-08-23 13:54 ` Mikhail Kshevetskiy
2025-08-23 14:42 ` Lorenzo Bianconi
2025-08-23 0:16 ` [PATCH v4 04/13] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-23 8:29 ` Lorenzo Bianconi
2025-08-23 0:16 ` [PATCH v4 05/13] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 06/13] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-23 8:34 ` Lorenzo Bianconi
2025-08-23 0:16 ` [PATCH v4 07/13] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-23 8:36 ` Lorenzo Bianconi
2025-08-23 0:16 ` [PATCH v4 08/13] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 09/13] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 10/13] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 11/13] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 12/13] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-23 0:16 ` [PATCH v4 13/13] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 00/13] spi: airoha: driver fixes & improvements Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 01/13] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 02/13] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 03/13] spi: airoha: add support of dual/quad wires spi modes to exec_op() handler Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 04/13] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 05/13] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 06/13] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 07/13] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 08/13] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 09/13] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 10/13] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 11/13] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 12/13] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-23 16:01 ` [PATCH v5 13/13] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-29 7:14 ` [PATCH v5 00/13] spi: airoha: driver fixes & improvements Mikhail Kshevetskiy
2025-08-29 8:45 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=616a6567-e69d-4c66-a64a-ab0fae17568b@iopsys.eu \
--to=mikhail.kshevetskiy@iopsys.eu \
--cc=broonie@kernel.org \
--cc=frieder.schrempf@kontron.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=ray.liu@airoha.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®