Updating nand flash driver from linux kernel 4.14 to 4.19

From ElphelWiki
Revision as of 10:28, 26 September 2019 by Oleg (talk | contribs) (Created page with "==About== Below are the changes had to be made to update our nand flash driver code from kernel 4.14 to 4.19. The kernel versions mentioned are the rebases from the mainline k...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

About

Below are the changes had to be made to update our nand flash driver code from kernel 4.14 to 4.19. The kernel versions mentioned are the rebases from the mainline kernel in linux-xlnx repo with xilinx's code:

xlnx_rebase_v4.14
xlnx_rebase_v4.19  

NAND FLASH chip

Micron MT29F8G08ADBDAH4:

  • ON-DIE ECC feature supported - they call it internal ECC in the datasheet:
Internal ECC enables 5-bit detection and 4-bit error correction in 512 bytes
  • Subpage (or partial) writes are not supported.

Linux Kernel 4.14 and older

Until 4.14 (including) our driver code additions worked unchanged. We basically needed a couple of things:

  • LOCK/UNLOCK functions (which were removed in 4.14). The code existed in up to 4.13 release - so it was just taken from there.
  • Function to work with the chip's (MT29F8G08ADBDAH4) OTP area. The original code was taken from here

Updating to 4.19

Notes

  • A lot has changed since 4.14
    • new ->exec_op hook vs old ->cmdfunc
  • OTP function are not supported yet, and need a minor change to make them more universal
  • Old LOCK/UNLOCK function need to be updated to the new codebase
  • Set nand-ecc-mode = "on-die"; in the device tree.
  • Add NAND_NO_SUBPAGE_WRITE to chip->options for MT29F8G08ADBDAH4

Results

See the code here:

Those arm,nand-cycle-t0-6 can be removed
Didn't make a patch - the changes are for a specific MT29F8G08ADBDAH4. Although they might work for others as well we have only tested the chip we use.