OSDN Git Service

mtd: nand: raw: qcom_nandc: add support for unprotected spare data pages
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 16 Jun 2022 00:18:34 +0000 (02:18 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 17 Jun 2022 06:30:19 +0000 (08:30 +0200)
commit862bdedd7f4b8aebf00fdb422062e64896e97809
treef6e436eb2d3d4707bddb7616d9a91c69d9266f6e
parentb360514edb4743cbf86fc377699c75e98b1264c7
mtd: nand: raw: qcom_nandc: add support for unprotected spare data pages

IPQ8064 nand have special pages where a different layout scheme is used.
These special page are used by boot partition and on reading them
lots of warning are reported about wrong ECC data and if written to
results in broken data and not bootable device.

The layout scheme used by these special page consist in using 512 bytes
as the codeword size (even for the last codeword) while writing to CFG0
register. This forces the NAND controller to unprotect the 4 bytes of
spare data.

Since the kernel is unaware of this different layout for these special
page, it does try to protect the spare data too during read/write and
warn about CRC errors.

Add support for this by permitting the user to declare these special
pages in dts by declaring offset and size of the partition. The driver
internally will convert these value to nand pages.

On user read/write the page is checked and if it's a boot page the
correct layout is used.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220616001835.24393-3-ansuelsmth@gmail.com
drivers/mtd/nand/raw/qcom_nandc.c