[OpenWrt-Devel] [PATCH 1/2] kernel: mtd: spinand: backport-4.19: Chip support through 5.1

Jeff Kletsky lede at allycomm.com
Wed Jun 5 19:34:48 EDT 2019

On 6/5/19 1:54 PM, Petr Štetiar wrote:

> Jeff Kletsky <lede at allycomm.com> [2019-06-05 13:17:05]:
> Hi,
> I'll put aside, that it's 4.19 (we should still focus on 4.14), can you please
> explain in more detail, why we would need all this bacported patches?
>>   * macronix: Fix ECC Status Read
> I can understand this one.
>>   * winbond: Add support for W25N01GV
> This one as well, but then you need to remove existing one in the ipq40xx
> patches or you're going to introduce build failure.
>>   * Add support for GigaDevice GD5F1GQ4UExxG
>>   * Add support for all Toshiba Memory products
>>   * add support for GigaDevice GD5FxGQ4xA
>>   * Add initial support for Toshiba TC58CVG2S0H
> What devices currently in the tree need (or want) this? I mean, the more
> patches, the more work during kernel bumps, so we should avoid it if the
> patches are not necessary.
> -- ynezz

Thanks for your time in review, insight, and comments.

The "focus" on 4.19 is for the ath79 target to be able to use SPI NAND
with the upstream support that became available to OpenWrt with 4.19

This will also help OEM/ODMs who have both been told to move off
the ar71xx platform, yet are stymied by the lack of "OpenWrt-approved"
SPI NAND support.

As one example:

     mkresin commented on Nov 26, 2018

     But [SPI-NAND support] requires 4.19 to not have to backport
     pretty much the whole MTD and SPI subsystems

     Please re-spin the patch as soon as we have kernel 4.19 support.
     The approach was already NAK'ed upstream and I don't see much gain
     in adding the hack if the next major kernel in OpenWrt
     will provide a suitable solution.

That direction is embodied in complete and tested local work,
easily extensible to other boards, once accepted by OpenWRT.
However, it requires support of the chips employed in the boards.

The GL.iNet GL-AR300M and GL-AR750S units have been shipped with:

   Paragon    PN26G01Axxxxx
   GigaDevice GD5F1GQ4UExxx
   GigaDevice GD5F1GQ4UFxxx

Both of these units have now been successfully ported to OpenWrt with
full NAND support on the ath79/nand target (4.19), including sysupgrade
and, on the AR300M, dual-firmware boot with automated fall-back.
(The GL-AR750S U-Boot only loads the kernel NOR at this time.)

The GigaDevice "F" chips are being used in currently available units.
I understand that Marty (cc-ed), who has worked on the AR300M as well,
has a Paragon-based device, so these chips exist "in the wild" as well.
These widely available units also address the similar question about[1]
[OpenWrt-Devel,2/2] kernel: mtd: spinand: Backport GigaDevice "F" from linux/next

The Paragon driver is complete, tested, and literally just submitted
to Linux MTD for review[2].

As this driver has not yet undergone upstream review and that there are
Paragon-based units that would otherwise not boot, I am holding the
patch series for these units until the Paragon driver is "cleared" upstream.

The main reason for including the Toshiba devices is to *simplify* bumps.
They all "intermingle" in spinand.h and core.c. Establishing a list consistent
with upstream Linux means that any potential patches should apply smoothly.
By "filling out" the supported devices, the upstream patches in this patch set
apply without significant changes.

   git log --pretty='%h %s'stable/linux-5.1.y ^v4.19.74 -- \
     drivers/mtd/nand/spi/ include/linux/mtd/spinand.h

indicates that there are no further patches that impact these files prior to 5.2
Of that list, as called out in the cover to this series and the related commit,
two have already been backported to 4.19.74.

Also, as these patches reflect the state of upstream Linux, they would be removed
in their entirely when the next LTS kernel is available, sometime after 5.2.

These drivers are only compiled when CONFIG_MTD_SPI_NAND=y is set by the target.

These targets are only pistachio and ipq4019, with ath79/nand (not /generic) WIP.

As a result, they do not impact "tiny" boards, or the often "value-focused"
and low-resource ar71xx, ath79/generic, and ramips boards.

A quick check of removing support of the Toshiba SPI NAND from a local build here
shows a change in kernel size in the image of only 366 bytes. This is consistent
with the changes being a set of structs defining the device, and two, brief bits
of code, one for decoding the return status of ECC, the other to check the MID/DID.

The run-time impact is effectively zero; if the MID doesn't match, the s/r returns.
It is only invoked only during driver-attachment probes, not during "run time".

Thank you for pointing out

It appears to be the same patch as present as part of this commit.

I did not find "winbond" elsewhere under target/linux in the context of SPI NAND.

If deemed appropriate, that patch could be removed from the ipq40x target
and the "generic" one be used, minimizing the number of patches managed by OpenWrt.


[1] [OpenWrt-Devel,2/2] kernel: mtd: spinand: Backport GigaDevice "F" from linux/next

[2] [Linux-MTD] mtd: spinand: Support Paragon PN26G01A and PN26G02A

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list