diff options
author | Roger Pueyo Centelles <roger.pueyo@guifi.net> | 2021-04-09 17:12:31 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2021-04-17 21:56:05 +0200 |
commit | f724a583dcf70bc02bca1750bfb4a5195130b141 (patch) | |
tree | 72222934f3b45eca09af27fabeab3452b51d4c8a /target/linux/ath79/files | |
parent | 07e5e03711d55f94db738446ef9eddc8163b53a6 (diff) | |
download | upstream-f724a583dcf70bc02bca1750bfb4a5195130b141.tar.gz upstream-f724a583dcf70bc02bca1750bfb4a5195130b141.tar.bz2 upstream-f724a583dcf70bc02bca1750bfb4a5195130b141.zip |
ath79: mikrotik: update nand-rb4xx driver
This updates the NAND driver for MikroTik RB4XX series to work with
kernel 5.10, similarly to the ar934x-nand driver (fb64e2c3).
Support for kernel 5.10 was added to all ath79 subtargets except for the
mikrotik one by commit d6b785d, since patch 920-mikrotik-rb4xx.patch
needed to be reworked. Later, commit f8512661 enabled kernel 5.10 for
the mikrotik subtarget with the nand-rb4xx driver still pending, which
is updated and added back by this patch.
Compile-tested only.
Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Diffstat (limited to 'target/linux/ath79/files')
-rw-r--r-- | target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c b/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c index 50bd69f6a4..22e2660b38 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c @@ -188,10 +188,15 @@ static int rb4xx_nand_probe(struct platform_device *pdev) if (mtd->writesize == 512) mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops); - nand->chip.ecc.mode = NAND_ECC_SOFT; - nand->chip.ecc.algo = NAND_ECC_HAMMING; - nand->chip.options = NAND_NO_SUBPAGE_WRITE; - nand->chip.priv = nand; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) + nand->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; + nand->chip.ecc.algo = NAND_ECC_ALGO_HAMMING; +#else + nand->chip.ecc.mode = NAND_ECC_SOFT; + nand->chip.ecc.algo = NAND_ECC_HAMMING; +#endif + nand->chip.options = NAND_NO_SUBPAGE_WRITE; + nand->chip.priv = nand; nand->chip.legacy.read_byte = rb4xx_nand_read_byte; nand->chip.legacy.write_buf = rb4xx_nand_write_buf; @@ -206,7 +211,12 @@ static int rb4xx_nand_probe(struct platform_device *pdev) ret = mtd_device_register(mtd, NULL, 0); if (ret) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) + mtd_device_unregister(nand_to_mtd(&nand->chip)); + nand_cleanup(&nand->chip); +#else nand_release(&nand->chip); +#endif return ret; } @@ -217,7 +227,12 @@ static int rb4xx_nand_remove(struct platform_device *pdev) { struct rb4xx_nand *nand = platform_get_drvdata(pdev); - nand_release(&nand->chip); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) + mtd_device_unregister(nand_to_mtd(&nand->chip)); + nand_cleanup(&nand->chip); +#else + nand_release(&nand->chip); +#endif return 0; } |