All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-04-29 22:31 ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

Hello,

As part of my attempt to convert all NAND drivers to exec_op() I noticed
the cmx270 board didn't really deserve a custom driver since other boards
using the same SoC (em-x270 to name one) are using the gen_nand driver.
I think the only issue with the CM-X270 is that the chip is connected
to D[16:23] (or D[16:31] if it's a 16bit bus). Adjusting the mem
resource offset should do the trick.

I hope someone still has a board to test that.

Regards,

Boris

Boris Brezillon (3):
  ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
  ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
  mtd: rawnand: Remove the cmx270 NAND controller driver

 arch/arm/configs/cm_x2xx_defconfig |   1 -
 arch/arm/configs/pxa_defconfig     |   1 -
 arch/arm/mach-pxa/cm-x270.c        | 131 ++++++++++++++++
 drivers/mtd/nand/raw/Kconfig       |   4 -
 drivers/mtd/nand/raw/Makefile      |   1 -
 drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
 6 files changed, 131 insertions(+), 243 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c

-- 
2.25.3


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-04-29 22:31 ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

Hello,

As part of my attempt to convert all NAND drivers to exec_op() I noticed
the cmx270 board didn't really deserve a custom driver since other boards
using the same SoC (em-x270 to name one) are using the gen_nand driver.
I think the only issue with the CM-X270 is that the chip is connected
to D[16:23] (or D[16:31] if it's a 16bit bus). Adjusting the mem
resource offset should do the trick.

I hope someone still has a board to test that.

Regards,

Boris

Boris Brezillon (3):
  ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
  ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
  mtd: rawnand: Remove the cmx270 NAND controller driver

 arch/arm/configs/cm_x2xx_defconfig |   1 -
 arch/arm/configs/pxa_defconfig     |   1 -
 arch/arm/mach-pxa/cm-x270.c        | 131 ++++++++++++++++
 drivers/mtd/nand/raw/Kconfig       |   4 -
 drivers/mtd/nand/raw/Makefile      |   1 -
 drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
 6 files changed, 131 insertions(+), 243 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c

-- 
2.25.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
  2020-04-29 22:31 ` Boris Brezillon
@ 2020-04-29 22:31   ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

No need to have a dedicated driver for this controller, all we need to
do is adjust the memory range offset to account for the fact that the
chip is connected to D[16:23] and not D[0:7].

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 arch/arm/mach-pxa/cm-x270.c | 131 ++++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 9baad11314f2..63bd3be60322 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -23,6 +23,8 @@
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mmc-pxamci.h>
 
+#include <linux/mtd/platnand.h>
+
 #include "generic.h"
 
 /* physical address if local-bus attached devices */
@@ -36,6 +38,10 @@
 /* MMC power enable */
 #define GPIO105_MMC_POWER	(105)
 
+/* NAND GPIOs */
+#define GPIO11_NAND_CS		(11)
+#define GPIO89_NAND_RB		(89)
+
 /* WLAN GPIOS */
 #define GPIO19_WLAN_STRAP	(19)
 #define GPIO102_WLAN_RST	(102)
@@ -309,6 +315,130 @@ static void __init cmx270_init_mmc(void)
 static inline void cmx270_init_mmc(void) {}
 #endif
 
+/* NAND flash */
+#if IS_ENABLED(CONFIG_MTD_NAND_PLATFORM)
+static inline void nand_cs_on(void)
+{
+	gpio_set_value(GPIO11_NAND_CS, 0);
+}
+
+static void nand_cs_off(void)
+{
+	dsb();
+
+	gpio_set_value(GPIO11_NAND_CS, 1);
+}
+
+/* hardware specific access to control-lines */
+static void cmx270_nand_cmd_ctl(struct nand_chip *this, int dat,
+				unsigned int ctrl)
+{
+	unsigned long nandaddr = (unsigned long)this->legacy.IO_ADDR_W;
+
+	dsb();
+
+	if (ctrl & NAND_CTRL_CHANGE) {
+		if (ctrl & NAND_ALE)
+			nandaddr |=  (1 << 3);
+		else
+			nandaddr &= ~(1 << 3);
+		if (ctrl & NAND_CLE)
+			nandaddr |=  (1 << 2);
+		else
+			nandaddr &= ~(1 << 2);
+		if (ctrl & NAND_NCE)
+			nand_cs_on();
+		else
+			nand_cs_off();
+	}
+
+	dsb();
+	this->legacy.IO_ADDR_W = (void __iomem *)nandaddr;
+	if (dat != NAND_CMD_NONE)
+		writeb(dat, this->legacy.IO_ADDR_W);
+
+	dsb();
+}
+
+/* read device ready pin */
+static int cmx270_nand_device_ready(struct nand_chip *this)
+{
+	dsb();
+
+	return gpio_get_value(GPIO89_NAND_RB);
+}
+
+static struct mtd_partition cmx270_partition_info[] = {
+	[0] = {
+		.name	= "cmx270-0",
+		.offset	= 0,
+		.size	= MTDPART_SIZ_FULL
+	},
+};
+
+struct platform_nand_data cmx270_nand_platdata = {
+	.chip = {
+		.nr_chips = 1,
+		.chip_offset = 0,
+		.nr_partitions = ARRAY_SIZE(cmx270_partition_info),
+		.partitions = cmx270_partition_info,
+		.chip_delay = 20,
+	},
+	.ctrl = {
+		.dev_ready = cmx270_nand_device_ready,
+		.cmd_ctrl = cmx270_nand_cmd_ctl,
+	},
+};
+
+static struct resource cmx270_nand_resource[] = {
+	[0] = {
+		/*
+		 * The NAND is connected to D[16:23], hence the 2 byte offset
+		 * here.
+		 */
+		.start = PXA_CS1_PHYS + 2,
+		.end   = PXA_CS1_PHYS + 2 + 12,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device cmx270_nand = {
+	.name		= "gen_nand",
+	.num_resources	= ARRAY_SIZE(cmx270_nand_resource),
+	.resource	= cmx270_nand_resource,
+	.id		= -1,
+	.dev		= {
+		.platform_data = &cmx270_nand_platdata,
+	}
+};
+
+static void __init cmx270_init_nand(void)
+{
+	int err;
+
+	err = gpio_request(GPIO11_NAND_CS, "NAND CS");
+	if (err) {
+		pr_warn("CMX270: failed to request NAND CS gpio\n");
+		return;
+	}
+
+	gpio_direction_output(GPIO11_NAND_CS, 1);
+
+	err = gpio_request(GPIO89_NAND_RB, "NAND R/B");
+	if (err) {
+		pr_warn("CMX270: failed to request NAND R/B gpio\n");
+		gpio_free(GPIO11_NAND_CS);
+		return;
+	}
+
+	gpio_direction_input(GPIO89_NAND_RB);
+
+	platform_device_register(&cmx270_nand);
+}
+#else
+static inline void cmx270_init_nand(void) {}
+#endif
+
 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
 static struct pxa2xx_spi_controller cm_x270_spi_info = {
 	.num_chipselect	= 1,
@@ -413,6 +543,7 @@ void __init cmx270_init(void)
 
 	cmx270_init_rtc();
 	cmx270_init_mmc();
+	cmx270_init_nand();
 	cmx270_init_ohci();
 	cmx270_init_2700G();
 	cmx270_init_spi();
-- 
2.25.3


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 1/3] ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
@ 2020-04-29 22:31   ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

No need to have a dedicated driver for this controller, all we need to
do is adjust the memory range offset to account for the fact that the
chip is connected to D[16:23] and not D[0:7].

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 arch/arm/mach-pxa/cm-x270.c | 131 ++++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 9baad11314f2..63bd3be60322 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -23,6 +23,8 @@
 #include <linux/platform_data/usb-ohci-pxa27x.h>
 #include <linux/platform_data/mmc-pxamci.h>
 
+#include <linux/mtd/platnand.h>
+
 #include "generic.h"
 
 /* physical address if local-bus attached devices */
@@ -36,6 +38,10 @@
 /* MMC power enable */
 #define GPIO105_MMC_POWER	(105)
 
+/* NAND GPIOs */
+#define GPIO11_NAND_CS		(11)
+#define GPIO89_NAND_RB		(89)
+
 /* WLAN GPIOS */
 #define GPIO19_WLAN_STRAP	(19)
 #define GPIO102_WLAN_RST	(102)
@@ -309,6 +315,130 @@ static void __init cmx270_init_mmc(void)
 static inline void cmx270_init_mmc(void) {}
 #endif
 
+/* NAND flash */
+#if IS_ENABLED(CONFIG_MTD_NAND_PLATFORM)
+static inline void nand_cs_on(void)
+{
+	gpio_set_value(GPIO11_NAND_CS, 0);
+}
+
+static void nand_cs_off(void)
+{
+	dsb();
+
+	gpio_set_value(GPIO11_NAND_CS, 1);
+}
+
+/* hardware specific access to control-lines */
+static void cmx270_nand_cmd_ctl(struct nand_chip *this, int dat,
+				unsigned int ctrl)
+{
+	unsigned long nandaddr = (unsigned long)this->legacy.IO_ADDR_W;
+
+	dsb();
+
+	if (ctrl & NAND_CTRL_CHANGE) {
+		if (ctrl & NAND_ALE)
+			nandaddr |=  (1 << 3);
+		else
+			nandaddr &= ~(1 << 3);
+		if (ctrl & NAND_CLE)
+			nandaddr |=  (1 << 2);
+		else
+			nandaddr &= ~(1 << 2);
+		if (ctrl & NAND_NCE)
+			nand_cs_on();
+		else
+			nand_cs_off();
+	}
+
+	dsb();
+	this->legacy.IO_ADDR_W = (void __iomem *)nandaddr;
+	if (dat != NAND_CMD_NONE)
+		writeb(dat, this->legacy.IO_ADDR_W);
+
+	dsb();
+}
+
+/* read device ready pin */
+static int cmx270_nand_device_ready(struct nand_chip *this)
+{
+	dsb();
+
+	return gpio_get_value(GPIO89_NAND_RB);
+}
+
+static struct mtd_partition cmx270_partition_info[] = {
+	[0] = {
+		.name	= "cmx270-0",
+		.offset	= 0,
+		.size	= MTDPART_SIZ_FULL
+	},
+};
+
+struct platform_nand_data cmx270_nand_platdata = {
+	.chip = {
+		.nr_chips = 1,
+		.chip_offset = 0,
+		.nr_partitions = ARRAY_SIZE(cmx270_partition_info),
+		.partitions = cmx270_partition_info,
+		.chip_delay = 20,
+	},
+	.ctrl = {
+		.dev_ready = cmx270_nand_device_ready,
+		.cmd_ctrl = cmx270_nand_cmd_ctl,
+	},
+};
+
+static struct resource cmx270_nand_resource[] = {
+	[0] = {
+		/*
+		 * The NAND is connected to D[16:23], hence the 2 byte offset
+		 * here.
+		 */
+		.start = PXA_CS1_PHYS + 2,
+		.end   = PXA_CS1_PHYS + 2 + 12,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device cmx270_nand = {
+	.name		= "gen_nand",
+	.num_resources	= ARRAY_SIZE(cmx270_nand_resource),
+	.resource	= cmx270_nand_resource,
+	.id		= -1,
+	.dev		= {
+		.platform_data = &cmx270_nand_platdata,
+	}
+};
+
+static void __init cmx270_init_nand(void)
+{
+	int err;
+
+	err = gpio_request(GPIO11_NAND_CS, "NAND CS");
+	if (err) {
+		pr_warn("CMX270: failed to request NAND CS gpio\n");
+		return;
+	}
+
+	gpio_direction_output(GPIO11_NAND_CS, 1);
+
+	err = gpio_request(GPIO89_NAND_RB, "NAND R/B");
+	if (err) {
+		pr_warn("CMX270: failed to request NAND R/B gpio\n");
+		gpio_free(GPIO11_NAND_CS);
+		return;
+	}
+
+	gpio_direction_input(GPIO89_NAND_RB);
+
+	platform_device_register(&cmx270_nand);
+}
+#else
+static inline void cmx270_init_nand(void) {}
+#endif
+
 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
 static struct pxa2xx_spi_controller cm_x270_spi_info = {
 	.num_chipselect	= 1,
@@ -413,6 +543,7 @@ void __init cmx270_init(void)
 
 	cmx270_init_rtc();
 	cmx270_init_mmc();
+	cmx270_init_nand();
 	cmx270_init_ohci();
 	cmx270_init_2700G();
 	cmx270_init_spi();
-- 
2.25.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
  2020-04-29 22:31 ` Boris Brezillon
@ 2020-04-29 22:31   ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

Now that the NAND is handled through the gen_nand driver we can stop
selecting CONFIG_MTD_NAND_CM_X270.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 arch/arm/configs/cm_x2xx_defconfig | 1 -
 arch/arm/configs/pxa_defconfig     | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/configs/cm_x2xx_defconfig b/arch/arm/configs/cm_x2xx_defconfig
index fa997ae2673e..08ebb993d34a 100644
--- a/arch/arm/configs/cm_x2xx_defconfig
+++ b/arch/arm/configs/cm_x2xx_defconfig
@@ -59,7 +59,6 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_PXA2XX=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_GPIO=m
-CONFIG_MTD_NAND_CM_X270=y
 CONFIG_MTD_NAND_PLATFORM=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
index b817c57f05f1..f829b0b7866d 100644
--- a/arch/arm/configs/pxa_defconfig
+++ b/arch/arm/configs/pxa_defconfig
@@ -194,7 +194,6 @@ CONFIG_MTD_NAND_DISKONCHIP_PROBE_HIGH=y
 CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
 CONFIG_MTD_NAND_SHARPSL=m
 CONFIG_MTD_NAND_MARVELL=m
-CONFIG_MTD_NAND_CM_X270=m
 CONFIG_MTD_NAND_TMIO=m
 CONFIG_MTD_NAND_BRCMNAND=m
 CONFIG_MTD_NAND_PLATFORM=m
-- 
2.25.3


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
@ 2020-04-29 22:31   ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

Now that the NAND is handled through the gen_nand driver we can stop
selecting CONFIG_MTD_NAND_CM_X270.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 arch/arm/configs/cm_x2xx_defconfig | 1 -
 arch/arm/configs/pxa_defconfig     | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/configs/cm_x2xx_defconfig b/arch/arm/configs/cm_x2xx_defconfig
index fa997ae2673e..08ebb993d34a 100644
--- a/arch/arm/configs/cm_x2xx_defconfig
+++ b/arch/arm/configs/cm_x2xx_defconfig
@@ -59,7 +59,6 @@ CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_PXA2XX=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_GPIO=m
-CONFIG_MTD_NAND_CM_X270=y
 CONFIG_MTD_NAND_PLATFORM=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
index b817c57f05f1..f829b0b7866d 100644
--- a/arch/arm/configs/pxa_defconfig
+++ b/arch/arm/configs/pxa_defconfig
@@ -194,7 +194,6 @@ CONFIG_MTD_NAND_DISKONCHIP_PROBE_HIGH=y
 CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE=y
 CONFIG_MTD_NAND_SHARPSL=m
 CONFIG_MTD_NAND_MARVELL=m
-CONFIG_MTD_NAND_CM_X270=m
 CONFIG_MTD_NAND_TMIO=m
 CONFIG_MTD_NAND_BRCMNAND=m
 CONFIG_MTD_NAND_PLATFORM=m
-- 
2.25.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] mtd: rawnand: Remove the cmx270 NAND controller driver
  2020-04-29 22:31 ` Boris Brezillon
@ 2020-04-29 22:31   ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

The CM-X270 NAND is now handled through the gen_nand driver, as done
for the EM-X270 platform.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/mtd/nand/raw/Kconfig       |   4 -
 drivers/mtd/nand/raw/Makefile      |   1 -
 drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
 3 files changed, 241 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 1f8aa353f764..5336fedc1d64 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -213,10 +213,6 @@ config MTD_NAND_MLC_LPC32XX
 	  Please check the actual NAND chip connected and its support
 	  by the MLC NAND controller.
 
-config MTD_NAND_CM_X270
-	tristate "CM-X270 modules NAND controller"
-	depends on MACH_ARMCORE
-
 config MTD_NAND_PASEMI
 	tristate "PA Semi PWRficient NAND controller"
 	depends on PPC_PASEMI
diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index 854107365774..0a893786a7a2 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_MTD_NAND_GPIO)		+= gpio.o
 omap2_nand-objs := omap2.o
 obj-$(CONFIG_MTD_NAND_OMAP2) 		+= omap2_nand.o
 obj-$(CONFIG_MTD_NAND_OMAP_BCH_BUILD)	+= omap_elm.o
-obj-$(CONFIG_MTD_NAND_CM_X270)		+= cmx270_nand.o
 obj-$(CONFIG_MTD_NAND_MARVELL)		+= marvell_nand.o
 obj-$(CONFIG_MTD_NAND_TMIO)		+= tmio_nand.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)		+= plat_nand.o
diff --git a/drivers/mtd/nand/raw/cmx270_nand.c b/drivers/mtd/nand/raw/cmx270_nand.c
deleted file mode 100644
index 045b6175ae79..000000000000
--- a/drivers/mtd/nand/raw/cmx270_nand.c
+++ /dev/null
@@ -1,236 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *  Copyright (C) 2006 Compulab, Ltd.
- *  Mike Rapoport <mike@compulab.co.il>
- *
- *  Derived from drivers/mtd/nand/h1910.c (removed in v3.10)
- *       Copyright (C) 2002 Marius Gröger (mag@sysgo.de)
- *       Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de)
- *
- *  Overview:
- *   This is a device driver for the NAND flash device found on the
- *   CM-X270 board.
- */
-
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/partitions.h>
-#include <linux/slab.h>
-#include <linux/gpio.h>
-#include <linux/module.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/pxa2xx-regs.h>
-
-#define GPIO_NAND_CS	(11)
-#define GPIO_NAND_RB	(89)
-
-/* MTD structure for CM-X270 board */
-static struct mtd_info *cmx270_nand_mtd;
-
-/* remaped IO address of the device */
-static void __iomem *cmx270_nand_io;
-
-/*
- * Define static partitions for flash device
- */
-static const struct mtd_partition partition_info[] = {
-	[0] = {
-		.name	= "cmx270-0",
-		.offset	= 0,
-		.size	= MTDPART_SIZ_FULL
-	}
-};
-#define NUM_PARTITIONS (ARRAY_SIZE(partition_info))
-
-static u_char cmx270_read_byte(struct nand_chip *this)
-{
-	return (readl(this->legacy.IO_ADDR_R) >> 16);
-}
-
-static void cmx270_write_buf(struct nand_chip *this, const u_char *buf,
-			     int len)
-{
-	int i;
-
-	for (i=0; i<len; i++)
-		writel((*buf++ << 16), this->legacy.IO_ADDR_W);
-}
-
-static void cmx270_read_buf(struct nand_chip *this, u_char *buf, int len)
-{
-	int i;
-
-	for (i=0; i<len; i++)
-		*buf++ = readl(this->legacy.IO_ADDR_R) >> 16;
-}
-
-static inline void nand_cs_on(void)
-{
-	gpio_set_value(GPIO_NAND_CS, 0);
-}
-
-static void nand_cs_off(void)
-{
-	dsb();
-
-	gpio_set_value(GPIO_NAND_CS, 1);
-}
-
-/*
- *	hardware specific access to control-lines
- */
-static void cmx270_hwcontrol(struct nand_chip *this, int dat,
-			     unsigned int ctrl)
-{
-	unsigned int nandaddr = (unsigned int)this->legacy.IO_ADDR_W;
-
-	dsb();
-
-	if (ctrl & NAND_CTRL_CHANGE) {
-		if ( ctrl & NAND_ALE )
-			nandaddr |=  (1 << 3);
-		else
-			nandaddr &= ~(1 << 3);
-		if ( ctrl & NAND_CLE )
-			nandaddr |=  (1 << 2);
-		else
-			nandaddr &= ~(1 << 2);
-		if ( ctrl & NAND_NCE )
-			nand_cs_on();
-		else
-			nand_cs_off();
-	}
-
-	dsb();
-	this->legacy.IO_ADDR_W = (void __iomem*)nandaddr;
-	if (dat != NAND_CMD_NONE)
-		writel((dat << 16), this->legacy.IO_ADDR_W);
-
-	dsb();
-}
-
-/*
- *	read device ready pin
- */
-static int cmx270_device_ready(struct nand_chip *this)
-{
-	dsb();
-
-	return (gpio_get_value(GPIO_NAND_RB));
-}
-
-/*
- * Main initialization routine
- */
-static int __init cmx270_init(void)
-{
-	struct nand_chip *this;
-	int ret;
-
-	if (!(machine_is_armcore() && cpu_is_pxa27x()))
-		return -ENODEV;
-
-	ret = gpio_request(GPIO_NAND_CS, "NAND CS");
-	if (ret) {
-		pr_warn("CM-X270: failed to request NAND CS gpio\n");
-		return ret;
-	}
-
-	gpio_direction_output(GPIO_NAND_CS, 1);
-
-	ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
-	if (ret) {
-		pr_warn("CM-X270: failed to request NAND R/B gpio\n");
-		goto err_gpio_request;
-	}
-
-	gpio_direction_input(GPIO_NAND_RB);
-
-	/* Allocate memory for MTD device structure and private data */
-	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
-	if (!this) {
-		ret = -ENOMEM;
-		goto err_kzalloc;
-	}
-
-	cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12);
-	if (!cmx270_nand_io) {
-		pr_debug("Unable to ioremap NAND device\n");
-		ret = -EINVAL;
-		goto err_ioremap;
-	}
-
-	cmx270_nand_mtd = nand_to_mtd(this);
-
-	/* Link the private data with the MTD structure */
-	cmx270_nand_mtd->owner = THIS_MODULE;
-
-	/* insert callbacks */
-	this->legacy.IO_ADDR_R = cmx270_nand_io;
-	this->legacy.IO_ADDR_W = cmx270_nand_io;
-	this->legacy.cmd_ctrl = cmx270_hwcontrol;
-	this->legacy.dev_ready = cmx270_device_ready;
-
-	/* 15 us command delay time */
-	this->legacy.chip_delay = 20;
-	this->ecc.mode = NAND_ECC_SOFT;
-	this->ecc.algo = NAND_ECC_HAMMING;
-
-	/* read/write functions */
-	this->legacy.read_byte = cmx270_read_byte;
-	this->legacy.read_buf = cmx270_read_buf;
-	this->legacy.write_buf = cmx270_write_buf;
-
-	/* Scan to find existence of the device */
-	ret = nand_scan(this, 1);
-	if (ret) {
-		pr_notice("No NAND device\n");
-		goto err_scan;
-	}
-
-	/* Register the partitions */
-	ret = mtd_device_register(cmx270_nand_mtd, partition_info,
-				  NUM_PARTITIONS);
-	if (ret)
-		goto err_scan;
-
-	/* Return happy */
-	return 0;
-
-err_scan:
-	iounmap(cmx270_nand_io);
-err_ioremap:
-	kfree(this);
-err_kzalloc:
-	gpio_free(GPIO_NAND_RB);
-err_gpio_request:
-	gpio_free(GPIO_NAND_CS);
-
-	return ret;
-
-}
-module_init(cmx270_init);
-
-/*
- * Clean up routine
- */
-static void __exit cmx270_cleanup(void)
-{
-	/* Release resources, unregister device */
-	nand_release(mtd_to_nand(cmx270_nand_mtd));
-
-	gpio_free(GPIO_NAND_RB);
-	gpio_free(GPIO_NAND_CS);
-
-	iounmap(cmx270_nand_io);
-
-	kfree(mtd_to_nand(cmx270_nand_mtd));
-}
-module_exit(cmx270_cleanup);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
-MODULE_DESCRIPTION("NAND flash driver for Compulab CM-X270 Module");
-- 
2.25.3


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] mtd: rawnand: Remove the cmx270 NAND controller driver
@ 2020-04-29 22:31   ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-04-29 22:31 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Miquel Raynal, linux-mtd
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Boris Brezillon, Mike Rapoport,
	linux-arm-kernel

The CM-X270 NAND is now handled through the gen_nand driver, as done
for the EM-X270 platform.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/mtd/nand/raw/Kconfig       |   4 -
 drivers/mtd/nand/raw/Makefile      |   1 -
 drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
 3 files changed, 241 deletions(-)
 delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index 1f8aa353f764..5336fedc1d64 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -213,10 +213,6 @@ config MTD_NAND_MLC_LPC32XX
 	  Please check the actual NAND chip connected and its support
 	  by the MLC NAND controller.
 
-config MTD_NAND_CM_X270
-	tristate "CM-X270 modules NAND controller"
-	depends on MACH_ARMCORE
-
 config MTD_NAND_PASEMI
 	tristate "PA Semi PWRficient NAND controller"
 	depends on PPC_PASEMI
diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile
index 854107365774..0a893786a7a2 100644
--- a/drivers/mtd/nand/raw/Makefile
+++ b/drivers/mtd/nand/raw/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_MTD_NAND_GPIO)		+= gpio.o
 omap2_nand-objs := omap2.o
 obj-$(CONFIG_MTD_NAND_OMAP2) 		+= omap2_nand.o
 obj-$(CONFIG_MTD_NAND_OMAP_BCH_BUILD)	+= omap_elm.o
-obj-$(CONFIG_MTD_NAND_CM_X270)		+= cmx270_nand.o
 obj-$(CONFIG_MTD_NAND_MARVELL)		+= marvell_nand.o
 obj-$(CONFIG_MTD_NAND_TMIO)		+= tmio_nand.o
 obj-$(CONFIG_MTD_NAND_PLATFORM)		+= plat_nand.o
diff --git a/drivers/mtd/nand/raw/cmx270_nand.c b/drivers/mtd/nand/raw/cmx270_nand.c
deleted file mode 100644
index 045b6175ae79..000000000000
--- a/drivers/mtd/nand/raw/cmx270_nand.c
+++ /dev/null
@@ -1,236 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *  Copyright (C) 2006 Compulab, Ltd.
- *  Mike Rapoport <mike@compulab.co.il>
- *
- *  Derived from drivers/mtd/nand/h1910.c (removed in v3.10)
- *       Copyright (C) 2002 Marius Gröger (mag@sysgo.de)
- *       Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de)
- *
- *  Overview:
- *   This is a device driver for the NAND flash device found on the
- *   CM-X270 board.
- */
-
-#include <linux/mtd/rawnand.h>
-#include <linux/mtd/partitions.h>
-#include <linux/slab.h>
-#include <linux/gpio.h>
-#include <linux/module.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-#include <mach/pxa2xx-regs.h>
-
-#define GPIO_NAND_CS	(11)
-#define GPIO_NAND_RB	(89)
-
-/* MTD structure for CM-X270 board */
-static struct mtd_info *cmx270_nand_mtd;
-
-/* remaped IO address of the device */
-static void __iomem *cmx270_nand_io;
-
-/*
- * Define static partitions for flash device
- */
-static const struct mtd_partition partition_info[] = {
-	[0] = {
-		.name	= "cmx270-0",
-		.offset	= 0,
-		.size	= MTDPART_SIZ_FULL
-	}
-};
-#define NUM_PARTITIONS (ARRAY_SIZE(partition_info))
-
-static u_char cmx270_read_byte(struct nand_chip *this)
-{
-	return (readl(this->legacy.IO_ADDR_R) >> 16);
-}
-
-static void cmx270_write_buf(struct nand_chip *this, const u_char *buf,
-			     int len)
-{
-	int i;
-
-	for (i=0; i<len; i++)
-		writel((*buf++ << 16), this->legacy.IO_ADDR_W);
-}
-
-static void cmx270_read_buf(struct nand_chip *this, u_char *buf, int len)
-{
-	int i;
-
-	for (i=0; i<len; i++)
-		*buf++ = readl(this->legacy.IO_ADDR_R) >> 16;
-}
-
-static inline void nand_cs_on(void)
-{
-	gpio_set_value(GPIO_NAND_CS, 0);
-}
-
-static void nand_cs_off(void)
-{
-	dsb();
-
-	gpio_set_value(GPIO_NAND_CS, 1);
-}
-
-/*
- *	hardware specific access to control-lines
- */
-static void cmx270_hwcontrol(struct nand_chip *this, int dat,
-			     unsigned int ctrl)
-{
-	unsigned int nandaddr = (unsigned int)this->legacy.IO_ADDR_W;
-
-	dsb();
-
-	if (ctrl & NAND_CTRL_CHANGE) {
-		if ( ctrl & NAND_ALE )
-			nandaddr |=  (1 << 3);
-		else
-			nandaddr &= ~(1 << 3);
-		if ( ctrl & NAND_CLE )
-			nandaddr |=  (1 << 2);
-		else
-			nandaddr &= ~(1 << 2);
-		if ( ctrl & NAND_NCE )
-			nand_cs_on();
-		else
-			nand_cs_off();
-	}
-
-	dsb();
-	this->legacy.IO_ADDR_W = (void __iomem*)nandaddr;
-	if (dat != NAND_CMD_NONE)
-		writel((dat << 16), this->legacy.IO_ADDR_W);
-
-	dsb();
-}
-
-/*
- *	read device ready pin
- */
-static int cmx270_device_ready(struct nand_chip *this)
-{
-	dsb();
-
-	return (gpio_get_value(GPIO_NAND_RB));
-}
-
-/*
- * Main initialization routine
- */
-static int __init cmx270_init(void)
-{
-	struct nand_chip *this;
-	int ret;
-
-	if (!(machine_is_armcore() && cpu_is_pxa27x()))
-		return -ENODEV;
-
-	ret = gpio_request(GPIO_NAND_CS, "NAND CS");
-	if (ret) {
-		pr_warn("CM-X270: failed to request NAND CS gpio\n");
-		return ret;
-	}
-
-	gpio_direction_output(GPIO_NAND_CS, 1);
-
-	ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
-	if (ret) {
-		pr_warn("CM-X270: failed to request NAND R/B gpio\n");
-		goto err_gpio_request;
-	}
-
-	gpio_direction_input(GPIO_NAND_RB);
-
-	/* Allocate memory for MTD device structure and private data */
-	this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
-	if (!this) {
-		ret = -ENOMEM;
-		goto err_kzalloc;
-	}
-
-	cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12);
-	if (!cmx270_nand_io) {
-		pr_debug("Unable to ioremap NAND device\n");
-		ret = -EINVAL;
-		goto err_ioremap;
-	}
-
-	cmx270_nand_mtd = nand_to_mtd(this);
-
-	/* Link the private data with the MTD structure */
-	cmx270_nand_mtd->owner = THIS_MODULE;
-
-	/* insert callbacks */
-	this->legacy.IO_ADDR_R = cmx270_nand_io;
-	this->legacy.IO_ADDR_W = cmx270_nand_io;
-	this->legacy.cmd_ctrl = cmx270_hwcontrol;
-	this->legacy.dev_ready = cmx270_device_ready;
-
-	/* 15 us command delay time */
-	this->legacy.chip_delay = 20;
-	this->ecc.mode = NAND_ECC_SOFT;
-	this->ecc.algo = NAND_ECC_HAMMING;
-
-	/* read/write functions */
-	this->legacy.read_byte = cmx270_read_byte;
-	this->legacy.read_buf = cmx270_read_buf;
-	this->legacy.write_buf = cmx270_write_buf;
-
-	/* Scan to find existence of the device */
-	ret = nand_scan(this, 1);
-	if (ret) {
-		pr_notice("No NAND device\n");
-		goto err_scan;
-	}
-
-	/* Register the partitions */
-	ret = mtd_device_register(cmx270_nand_mtd, partition_info,
-				  NUM_PARTITIONS);
-	if (ret)
-		goto err_scan;
-
-	/* Return happy */
-	return 0;
-
-err_scan:
-	iounmap(cmx270_nand_io);
-err_ioremap:
-	kfree(this);
-err_kzalloc:
-	gpio_free(GPIO_NAND_RB);
-err_gpio_request:
-	gpio_free(GPIO_NAND_CS);
-
-	return ret;
-
-}
-module_init(cmx270_init);
-
-/*
- * Clean up routine
- */
-static void __exit cmx270_cleanup(void)
-{
-	/* Release resources, unregister device */
-	nand_release(mtd_to_nand(cmx270_nand_mtd));
-
-	gpio_free(GPIO_NAND_RB);
-	gpio_free(GPIO_NAND_CS);
-
-	iounmap(cmx270_nand_io);
-
-	kfree(mtd_to_nand(cmx270_nand_mtd));
-}
-module_exit(cmx270_cleanup);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
-MODULE_DESCRIPTION("NAND flash driver for Compulab CM-X270 Module");
-- 
2.25.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
  2020-04-29 22:31 ` Boris Brezillon
@ 2020-05-08 10:10   ` Miquel Raynal
  -1 siblings, 0 replies; 18+ messages in thread
From: Miquel Raynal @ 2020-05-08 10:10 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, Boris Brezillon, linux-mtd,
	linux-arm-kernel, Mike Rapoport, Daniel Mack

Hi Robert,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Thu, 30 Apr
2020 00:31:31 +0200:

> Hello,
> 
> As part of my attempt to convert all NAND drivers to exec_op() I noticed
> the cmx270 board didn't really deserve a custom driver since other boards
> using the same SoC (em-x270 to name one) are using the gen_nand driver.
> I think the only issue with the CM-X270 is that the chip is connected
> to D[16:23] (or D[16:31] if it's a 16bit bus). Adjusting the mem
> resource offset should do the trick.
> 
> I hope someone still has a board to test that.
> 
> Regards,
> 
> Boris
> 
> Boris Brezillon (3):
>   ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
>   ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
>   mtd: rawnand: Remove the cmx270 NAND controller driver
> 
>  arch/arm/configs/cm_x2xx_defconfig |   1 -
>  arch/arm/configs/pxa_defconfig     |   1 -
>  arch/arm/mach-pxa/cm-x270.c        | 131 ++++++++++++++++
>  drivers/mtd/nand/raw/Kconfig       |   4 -
>  drivers/mtd/nand/raw/Makefile      |   1 -
>  drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
>  6 files changed, 131 insertions(+), 243 deletions(-)
>  delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c
> 

Any chance you give this series a try? I plan to merge several series
like that during this release, but of course if you can test it
beforehands it's even better!


Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-05-08 10:10   ` Miquel Raynal
  0 siblings, 0 replies; 18+ messages in thread
From: Miquel Raynal @ 2020-05-08 10:10 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, Boris Brezillon, linux-mtd,
	linux-arm-kernel, Mike Rapoport, Daniel Mack

Hi Robert,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Thu, 30 Apr
2020 00:31:31 +0200:

> Hello,
> 
> As part of my attempt to convert all NAND drivers to exec_op() I noticed
> the cmx270 board didn't really deserve a custom driver since other boards
> using the same SoC (em-x270 to name one) are using the gen_nand driver.
> I think the only issue with the CM-X270 is that the chip is connected
> to D[16:23] (or D[16:31] if it's a 16bit bus). Adjusting the mem
> resource offset should do the trick.
> 
> I hope someone still has a board to test that.
> 
> Regards,
> 
> Boris
> 
> Boris Brezillon (3):
>   ARM: pxa: cm-x270: Use gen_nand to expose the NAND device
>   ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270
>   mtd: rawnand: Remove the cmx270 NAND controller driver
> 
>  arch/arm/configs/cm_x2xx_defconfig |   1 -
>  arch/arm/configs/pxa_defconfig     |   1 -
>  arch/arm/mach-pxa/cm-x270.c        | 131 ++++++++++++++++
>  drivers/mtd/nand/raw/Kconfig       |   4 -
>  drivers/mtd/nand/raw/Makefile      |   1 -
>  drivers/mtd/nand/raw/cmx270_nand.c | 236 -----------------------------
>  6 files changed, 131 insertions(+), 243 deletions(-)
>  delete mode 100644 drivers/mtd/nand/raw/cmx270_nand.c
> 

Any chance you give this series a try? I plan to merge several series
like that during this release, but of course if you can test it
beforehands it's even better!


Thanks,
Miquèl

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
  2020-05-08 10:10   ` Miquel Raynal
@ 2020-05-13 12:55     ` Robert Jarzmik
  -1 siblings, 0 replies; 18+ messages in thread
From: Robert Jarzmik @ 2020-05-13 12:55 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, Boris Brezillon, linux-mtd,
	linux-arm-kernel, Mike Rapoport, Daniel Mack

Miquel Raynal <miquel.raynal@bootlin.com> writes:

> Hi Robert,

Mi Miquel,

>> I hope someone still has a board to test that.
No, unfortunately I don't have this board, nor do I know of anyone having
one. It's the second time I see patches on cmx270, and the question to whether
we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
fully supported and testable, and no one I know has a cm-x2700 ...

Now for your series, I have 2 comments :
 - dsb() : can you explain the rationale of each of the 3 instances I saw
 please.
 - the +2 IOMEM offset
   I don't like it at all. I don't mind the offset, I disklike the use of
   readb() or readw() where before there was a readl().. Same thing for writeb()
   against writel().

   The bus semantics are not the same, the alignment is not the same as well
   (and PXA is very old and doesn't cope well with alignment), and without a
   proper board to test, I would be very wary to have that change.

Cheers.

-- 
Robert

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-05-13 12:55     ` Robert Jarzmik
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Jarzmik @ 2020-05-13 12:55 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, Boris Brezillon, linux-mtd,
	linux-arm-kernel, Mike Rapoport, Daniel Mack

Miquel Raynal <miquel.raynal@bootlin.com> writes:

> Hi Robert,

Mi Miquel,

>> I hope someone still has a board to test that.
No, unfortunately I don't have this board, nor do I know of anyone having
one. It's the second time I see patches on cmx270, and the question to whether
we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
fully supported and testable, and no one I know has a cm-x2700 ...

Now for your series, I have 2 comments :
 - dsb() : can you explain the rationale of each of the 3 instances I saw
 please.
 - the +2 IOMEM offset
   I don't like it at all. I don't mind the offset, I disklike the use of
   readb() or readw() where before there was a readl().. Same thing for writeb()
   against writel().

   The bus semantics are not the same, the alignment is not the same as well
   (and PXA is very old and doesn't cope well with alignment), and without a
   proper board to test, I would be very wary to have that change.

Cheers.

-- 
Robert

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
  2020-05-13 12:55     ` Robert Jarzmik
@ 2020-05-13 13:17       ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-05-13 13:17 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, linux-mtd, linux-arm-kernel,
	Miquel Raynal, Daniel Mack

Hi Robert,

On Wed, 13 May 2020 14:55:01 +0200
Robert Jarzmik <robert.jarzmik@free.fr> wrote:

> Miquel Raynal <miquel.raynal@bootlin.com> writes:
> 
> > Hi Robert,  
> 
> Mi Miquel,
> 
> >> I hope someone still has a board to test that.  
> No, unfortunately I don't have this board, nor do I know of anyone having
> one. It's the second time I see patches on cmx270, and the question to whether
> we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> fully supported and testable, and no one I know has a cm-x2700 ...

What's the point of keeping support for a board no one has or no one
cares about? I know I don't have my word in this decision, but I would
strongly recommend getting rid of it, especially when I see such
crappy/unmaintained code lurking around in the drivers/ tree.

> 
> Now for your series, I have 2 comments :
>  - dsb() : can you explain the rationale of each of the 3 instances I saw
>  please.

I didn't add any dsb(), just copied what was done before.

>  - the +2 IOMEM offset
>    I don't like it at all. I don't mind the offset, I disklike the use of
>    readb() or readw() where before there was a readl().. Same thing for writeb()
>    against writel().
> 
>    The bus semantics are not the same, the alignment is not the same as well
>    (and PXA is very old and doesn't cope well with alignment), and without a
>    proper board to test, I would be very wary to have that change.

Well, given the core uses {read,write}{b,w}() [1] to read/write data
and this driver doesn't provide its own
->{read_byte,write_buf,read_buf}() implementation, I'd expect things to
work just fine if we use byte/word accessors for the rest. This being
said, I'm fine switching back to 32bit accessors if that's a hard
requirement.

Thanks,

Boris

[1]https://elixir.bootlin.com/linux/v5.7-rc5/source/drivers/mtd/nand/raw/nand_legacy.c#L28

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-05-13 13:17       ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2020-05-13 13:17 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, linux-mtd, linux-arm-kernel,
	Miquel Raynal, Daniel Mack

Hi Robert,

On Wed, 13 May 2020 14:55:01 +0200
Robert Jarzmik <robert.jarzmik@free.fr> wrote:

> Miquel Raynal <miquel.raynal@bootlin.com> writes:
> 
> > Hi Robert,  
> 
> Mi Miquel,
> 
> >> I hope someone still has a board to test that.  
> No, unfortunately I don't have this board, nor do I know of anyone having
> one. It's the second time I see patches on cmx270, and the question to whether
> we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> fully supported and testable, and no one I know has a cm-x2700 ...

What's the point of keeping support for a board no one has or no one
cares about? I know I don't have my word in this decision, but I would
strongly recommend getting rid of it, especially when I see such
crappy/unmaintained code lurking around in the drivers/ tree.

> 
> Now for your series, I have 2 comments :
>  - dsb() : can you explain the rationale of each of the 3 instances I saw
>  please.

I didn't add any dsb(), just copied what was done before.

>  - the +2 IOMEM offset
>    I don't like it at all. I don't mind the offset, I disklike the use of
>    readb() or readw() where before there was a readl().. Same thing for writeb()
>    against writel().
> 
>    The bus semantics are not the same, the alignment is not the same as well
>    (and PXA is very old and doesn't cope well with alignment), and without a
>    proper board to test, I would be very wary to have that change.

Well, given the core uses {read,write}{b,w}() [1] to read/write data
and this driver doesn't provide its own
->{read_byte,write_buf,read_buf}() implementation, I'd expect things to
work just fine if we use byte/word accessors for the rest. This being
said, I'm fine switching back to 32bit accessors if that's a hard
requirement.

Thanks,

Boris

[1]https://elixir.bootlin.com/linux/v5.7-rc5/source/drivers/mtd/nand/raw/nand_legacy.c#L28

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
  2020-05-13 13:17       ` Boris Brezillon
@ 2020-05-13 13:23         ` Miquel Raynal
  -1 siblings, 0 replies; 18+ messages in thread
From: Miquel Raynal @ 2020-05-13 13:23 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, linux-mtd, linux-arm-kernel,
	Robert Jarzmik, Daniel Mack

Hello,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Wed, 13 May
2020 15:17:37 +0200:

> Hi Robert,
> 
> On Wed, 13 May 2020 14:55:01 +0200
> Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> 
> > Miquel Raynal <miquel.raynal@bootlin.com> writes:
> >   
> > > Hi Robert,    
> > 
> > Mi Miquel,
> >   
> > >> I hope someone still has a board to test that.    
> > No, unfortunately I don't have this board, nor do I know of anyone having
> > one. It's the second time I see patches on cmx270, and the question to whether
> > we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> > fully supported and testable, and no one I know has a cm-x2700 ...  
> 
> What's the point of keeping support for a board no one has or no one
> cares about? I know I don't have my word in this decision, but I would
> strongly recommend getting rid of it, especially when I see such
> crappy/unmaintained code lurking around in the drivers/ tree.

I also agree on the fact that spending time on maintain unused boards
is lost time. We have so many drivers to handle, maybe it's time to get
rid of these "too" old drivers.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-05-13 13:23         ` Miquel Raynal
  0 siblings, 0 replies; 18+ messages in thread
From: Miquel Raynal @ 2020-05-13 13:23 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Vignesh Raghavendra, Arnd Bergmann, Tudor Ambarus,
	Richard Weinberger, Haojian Zhuang, linux-mtd, linux-arm-kernel,
	Robert Jarzmik, Daniel Mack

Hello,

Boris Brezillon <boris.brezillon@collabora.com> wrote on Wed, 13 May
2020 15:17:37 +0200:

> Hi Robert,
> 
> On Wed, 13 May 2020 14:55:01 +0200
> Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> 
> > Miquel Raynal <miquel.raynal@bootlin.com> writes:
> >   
> > > Hi Robert,    
> > 
> > Mi Miquel,
> >   
> > >> I hope someone still has a board to test that.    
> > No, unfortunately I don't have this board, nor do I know of anyone having
> > one. It's the second time I see patches on cmx270, and the question to whether
> > we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> > fully supported and testable, and no one I know has a cm-x2700 ...  
> 
> What's the point of keeping support for a board no one has or no one
> cares about? I know I don't have my word in this decision, but I would
> strongly recommend getting rid of it, especially when I see such
> crappy/unmaintained code lurking around in the drivers/ tree.

I also agree on the fact that spending time on maintain unused boards
is lost time. We have so many drivers to handle, maybe it's time to get
rid of these "too" old drivers.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
  2020-05-13 13:23         ` Miquel Raynal
@ 2020-05-13 13:58           ` Arnd Bergmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2020-05-13 13:58 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	Haojian Zhuang, igor, Boris Brezillon, linux-mtd, Linux ARM,
	Robert Jarzmik, Daniel Mack

On Wed, May 13, 2020 at 3:23 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> Boris Brezillon <boris.brezillon@collabora.com> wrote on Wed, 13 May 2020 15:17:37 +0200:
> > On Wed, 13 May 2020 14:55:01 +0200 Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> > > Miquel Raynal <miquel.raynal@bootlin.com> writes:
> > >
> > > >> I hope someone still has a board to test that.
> > > No, unfortunately I don't have this board, nor do I know of anyone having
> > > one. It's the second time I see patches on cmx270, and the question to whether
> > > we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> > > fully supported and testable, and no one I know has a cm-x2700 ...
> >
> > What's the point of keeping support for a board no one has or no one
> > cares about? I know I don't have my word in this decision, but I would
> > strongly recommend getting rid of it, especially when I see such
> > crappy/unmaintained code lurking around in the drivers/ tree.
>
> I also agree on the fact that spending time on maintain unused boards
> is lost time. We have so many drivers to handle, maybe it's time to get
> rid of these "too" old drivers.

The cm-x255/cm-x270 came up in another discussion last year because
of its unusual PCI_HOST_ITE8152 PCI support that I'd like to kill off.

We did not see a strong reason to keep the board support at that time,
but nobody sent any patches. I think it would be reasonable to just
kill off MACH_ARMCORE, PCI_HOST_ITE8152 and
MTD_NAND_CM_X270 along with anything else that is no longer
used after those are gone, such as the pcmcia support.

       Arnd

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver
@ 2020-05-13 13:58           ` Arnd Bergmann
  0 siblings, 0 replies; 18+ messages in thread
From: Arnd Bergmann @ 2020-05-13 13:58 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	Haojian Zhuang, igor, Boris Brezillon, linux-mtd, Linux ARM,
	Robert Jarzmik, Daniel Mack

On Wed, May 13, 2020 at 3:23 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> Boris Brezillon <boris.brezillon@collabora.com> wrote on Wed, 13 May 2020 15:17:37 +0200:
> > On Wed, 13 May 2020 14:55:01 +0200 Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> > > Miquel Raynal <miquel.raynal@bootlin.com> writes:
> > >
> > > >> I hope someone still has a board to test that.
> > > No, unfortunately I don't have this board, nor do I know of anyone having
> > > one. It's the second time I see patches on cmx270, and the question to whether
> > > we shoud keep this board in kernel is still in my mind ... given that cm-x300 is
> > > fully supported and testable, and no one I know has a cm-x2700 ...
> >
> > What's the point of keeping support for a board no one has or no one
> > cares about? I know I don't have my word in this decision, but I would
> > strongly recommend getting rid of it, especially when I see such
> > crappy/unmaintained code lurking around in the drivers/ tree.
>
> I also agree on the fact that spending time on maintain unused boards
> is lost time. We have so many drivers to handle, maybe it's time to get
> rid of these "too" old drivers.

The cm-x255/cm-x270 came up in another discussion last year because
of its unusual PCI_HOST_ITE8152 PCI support that I'd like to kill off.

We did not see a strong reason to keep the board support at that time,
but nobody sent any patches. I think it would be reasonable to just
kill off MACH_ARMCORE, PCI_HOST_ITE8152 and
MTD_NAND_CM_X270 along with anything else that is no longer
used after those are gone, such as the pcmcia support.

       Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-05-13 13:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 22:31 [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver Boris Brezillon
2020-04-29 22:31 ` Boris Brezillon
2020-04-29 22:31 ` [PATCH 1/3] ARM: pxa: cm-x270: Use gen_nand to expose the NAND device Boris Brezillon
2020-04-29 22:31   ` Boris Brezillon
2020-04-29 22:31 ` [PATCH 2/3] ARM: pxa: Stop selecting CONFIG_MTD_NAND_CM_X270 Boris Brezillon
2020-04-29 22:31   ` Boris Brezillon
2020-04-29 22:31 ` [PATCH 3/3] mtd: rawnand: Remove the cmx270 NAND controller driver Boris Brezillon
2020-04-29 22:31   ` Boris Brezillon
2020-05-08 10:10 ` [PATCH 0/3] mtd: rawnand: Get rid of the cmx270 driver Miquel Raynal
2020-05-08 10:10   ` Miquel Raynal
2020-05-13 12:55   ` Robert Jarzmik
2020-05-13 12:55     ` Robert Jarzmik
2020-05-13 13:17     ` Boris Brezillon
2020-05-13 13:17       ` Boris Brezillon
2020-05-13 13:23       ` Miquel Raynal
2020-05-13 13:23         ` Miquel Raynal
2020-05-13 13:58         ` Arnd Bergmann
2020-05-13 13:58           ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.