mtd: nand: raw: rockchip_nfc: copy hwecc PA data to oob_poi buffer
authorJohan Jonker <jbx6244@gmail.com>
Thu, 22 Jun 2023 13:59:24 +0000 (15:59 +0200)
committerKever Yang <kever.yang@rock-chips.com>
Fri, 28 Jul 2023 10:45:03 +0000 (18:45 +0800)
commit3d17ee453348f49a975ea9a0c399258c01a160ed
tree0d65830d71f3e1de96a08d4e0fe55a90d2c32696
parent9010c43b038f81d5282e51c723a673a25a0fb6b3
mtd: nand: raw: rockchip_nfc: copy hwecc PA data to oob_poi buffer

Rockchip boot blocks are written per 4 x 512 byte sectors per page.
Each page 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.
This logic used to build a page pattern table is not fully disclosed and
is not easy to fit in the MTD framework.
The formula in rk_nfc_write_page_hwecc() function is not correct.
Make hwecc and raw behavior identical.
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 EEC
in the chip->oob_poi data layout.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
drivers/mtd/nand/raw/rockchip_nfc.c