aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79
diff options
context:
space:
mode:
authorRoger Pueyo Centelles <roger.pueyo@guifi.net>2021-04-09 17:12:31 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-04-17 21:56:05 +0200
commitf724a583dcf70bc02bca1750bfb4a5195130b141 (patch)
tree72222934f3b45eca09af27fabeab3452b51d4c8a /target/linux/ath79
parent07e5e03711d55f94db738446ef9eddc8163b53a6 (diff)
downloadupstream-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')
-rw-r--r--target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c25
-rw-r--r--target/linux/ath79/patches-5.10/0052-mtd-spi-nor-use-4-bit-locking-for-MX25L12805D.patch7
-rw-r--r--target/linux/ath79/patches-5.10/410-spi-ath79-Implement-the-spi_mem-interface.patch2
-rw-r--r--target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch76
4 files changed, 98 insertions, 12 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;
}
diff --git a/target/linux/ath79/patches-5.10/0052-mtd-spi-nor-use-4-bit-locking-for-MX25L12805D.patch b/target/linux/ath79/patches-5.10/0052-mtd-spi-nor-use-4-bit-locking-for-MX25L12805D.patch
index e27a95d9e9..317bef2201 100644
--- a/target/linux/ath79/patches-5.10/0052-mtd-spi-nor-use-4-bit-locking-for-MX25L12805D.patch
+++ b/target/linux/ath79/patches-5.10/0052-mtd-spi-nor-use-4-bit-locking-for-MX25L12805D.patch
@@ -19,11 +19,9 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
drivers/mtd/spi-nor/macronix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
-diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
-index 2d39dd32a64e..ed8b56a0102f 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
-@@ -50,7 +50,8 @@ static const struct flash_info macronix_parts[] = {
+@@ -50,7 +50,8 @@ static const struct flash_info macronix_
{ "mx25u4035", INFO(0xc22533, 0, 64 * 1024, 8, SECT_4K) },
{ "mx25u8035", INFO(0xc22534, 0, 64 * 1024, 16, SECT_4K) },
{ "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
@@ -33,6 +31,3 @@ index 2d39dd32a64e..ed8b56a0102f 100644
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
{ "mx25r1635f", INFO(0xc22815, 0, 64 * 1024, 32,
SECT_4K | SPI_NOR_DUAL_READ |
---
-2.31.1
-
diff --git a/target/linux/ath79/patches-5.10/410-spi-ath79-Implement-the-spi_mem-interface.patch b/target/linux/ath79/patches-5.10/410-spi-ath79-Implement-the-spi_mem-interface.patch
index 51a71c6ef2..2a6b9857fb 100644
--- a/target/linux/ath79/patches-5.10/410-spi-ath79-Implement-the-spi_mem-interface.patch
+++ b/target/linux/ath79/patches-5.10/410-spi-ath79-Implement-the-spi_mem-interface.patch
@@ -58,7 +58,7 @@ Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
static int ath79_spi_probe(struct platform_device *pdev)
{
struct spi_master *master;
-@@ -164,6 +198,7 @@ static int ath79_spi_probe(struct platfo
+@@ -163,6 +197,7 @@ static int ath79_spi_probe(struct platfo
ret = PTR_ERR(sp->base);
goto err_put_master;
}
diff --git a/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch
new file mode 100644
index 0000000000..25ea1abe56
--- /dev/null
+++ b/target/linux/ath79/patches-5.10/920-mikrotik-rb4xx.patch
@@ -0,0 +1,76 @@
+--- a/drivers/mfd/Kconfig
++++ b/drivers/mfd/Kconfig
+@@ -2141,6 +2141,14 @@ config RAVE_SP_CORE
+ Select this to get support for the Supervisory Processor
+ device found on several devices in RAVE line of hardware.
+
++config MFD_RB4XX_CPLD
++ tristate "CPLD driver for Mikrotik RB4xx series boards
++ select MFD_CORE
++ depends on ATH79 || COMPILE_TEST
++ help
++ Enables support for the CPLD chip (NAND & GPIO) on Mikrotik
++ Routerboard RB4xx series.
++
+ config SGI_MFD_IOC3
+ tristate "SGI IOC3 core driver"
+ depends on PCI && MIPS && 64BIT
+--- a/drivers/mfd/Makefile
++++ b/drivers/mfd/Makefile
+@@ -264,6 +264,7 @@ obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-b
+ obj-$(CONFIG_MFD_STMFX) += stmfx.o
+ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o
+
++obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o
+ obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o
+ obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o
+ obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -1518,6 +1518,12 @@ config GPIO_SODAVILLE
+ help
+ Say Y here to support Intel Sodaville GPIO.
+
++config GPIO_RB4XX
++ tristate "GPIO expander for Mikrotik RB4xx series boards"
++ depends on MFD_RB4XX_CPLD
++ help
++ GPIO driver for Mikrotik Routerboard RB4xx series.
++
+ endmenu
+
+ menu "SPI GPIO expanders"
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -120,6 +120,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.
+ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o
+ obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
+ obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
++obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o
+ obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
+ obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
+ obj-$(CONFIG_GPIO_RDA) += gpio-rda.o
+--- a/drivers/mtd/nand/raw/Kconfig
++++ b/drivers/mtd/nand/raw/Kconfig
+@@ -564,4 +564,11 @@ config MTD_NAND_AR934X
+ Enables support for NAND controller on Qualcomm Atheros SoCs.
+ This controller is found on AR934x and QCA955x SoCs.
+
++config MTD_NAND_RB4XX
++ tristate "Support for NAND driver for Mikrotik RB4xx series boards"
++ depends on MFD_RB4XX_CPLD
++ help
++ Enables support for the NAND flash chip on Mikrotik Routerboard
++ RB4xx series.
++
+ endif # MTD_RAW_NAND
+--- a/drivers/mtd/nand/raw/Makefile
++++ b/drivers/mtd/nand/raw/Makefile
+@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_MESON) += meson_n
+ obj-$(CONFIG_MTD_NAND_CADENCE) += cadence-nand-controller.o
+ obj-$(CONFIG_MTD_NAND_ARASAN) += arasan-nand-controller.o
+ obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o
++obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o
+
+ nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o
+ nand-objs += nand_onfi.o