]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: rockchip: Align hwecc vs. raw page helper layouts
authorJohan Jonker <jbx6244@gmail.com>
Fri, 14 Jul 2023 15:21:21 +0000 (17:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 10:08:25 +0000 (12:08 +0200)
commitb71c00256da4e1d2f7f9bed31038a152bc40dbf9
tree549a3962b79bcd11dbe1d7dd1f2a177fbeff593c
parent5a8a35b71bd34570983505bcdc16c9456e8970d0
mtd: rawnand: rockchip: Align hwecc vs. raw page helper layouts

[ Upstream commit ea690ad78dd611e3906df5b948a516000b05c1cb ]

Currently, read/write_page_hwecc() and read/write_page_raw() are not
aligned: there is a mismatch in the OOB bytes which are not
read/written at the same offset in both cases (raw vs. hwecc).

This is a real problem when relying on the presence of the Page
Addresses (PA) when using the NAND chip as a boot device, as the
BootROM expects additional data in the OOB area at specific locations.

Rockchip boot blocks are written per 4 x 512 byte sectors per page.
Each page with boot blocks must have a page address (PA) pointer in OOB
to the next page. Pages are written in a pattern depending on the NAND chip ID.

Generate boot block page address and pattern for hwecc in user space
and copy PA data to/from the already reserved last 4 bytes before ECC
in the chip->oob_poi data layout.

Align the different helpers. This change breaks existing jffs2 users.

Fixes: 058e0e847d54 ("mtd: rawnand: rockchip: NFC driver for RK3308, RK2928 and others")
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/5e782c08-862b-51ae-47ff-3299940928ca@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/nand/raw/rockchip-nand-controller.c