Skip to contentSkip to conversation

nand/denali: split the driver into 3 parts: generic, PCI and DT

PATCH New [email protected] 2 participants 4 messages Sep 27, 2012 – Oct 11, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello,

The following 2 patches attempts to make the current Denali NAND controller, which is PCI-based, to be both PCI and device tree drivers.

The first patch is a resend of Jami Iles patch with only minor changes on the commit message and checkpatch errors and warnings. This patch was originally sent in this message:

http://lists.infradead.org/pipermail/linux-mtd/2011-May/035334.html

The second patch is also based on Jamie Iles' patch to add a MMIO version of the Denali NAND driver. I converted to be DT based.

I think there were comments to make it fully DT, but since I don't have a PCI-base hardware to test this, I don't want to break it. I can only test the DT version on the HW that I have access to.

.../devicetree/bindings/mtd/denali-nand.txt | 23 +++

 drivers/mtd/nand/Kconfig                           |   20 ++-
 drivers/mtd/nand/Makefile                          |    2 +
 drivers/mtd/nand/denali.c                          |  160 ++++---------------
 drivers/mtd/nand/denali.h                          |    5 +
 drivers/mtd/nand/denali_dt.c                       |  167 ++++++++++++++++++++
 drivers/mtd/nand/denali_pci.c                      |  144 +++++++++++++++++
 7 files changed, 386 insertions(+), 135 deletions(-)

Thanks,
Dinh

#1 lore raw

PATCH v2 1/2 nand/denali: split the generic driver and PCI layer

From: Dinh Nguyen <[email protected]>

The Denali controller can also be found in SoC devices attached to a simple bus. Move the PCI specific parts into denali_pci so that we can add a denali_dt that uses the same driver but for a device tree driver instead of a PCI based device.

Cc David Woodhouse <[email protected]>
Cc Chuanxiao Dong <[email protected]>
---
 drivers/mtd/nand/Kconfig      |   11 ++-
 drivers/mtd/nand/Makefile     |    1 +
 drivers/mtd/nand/denali.c     |  160 ++++++++---------------------------------
 drivers/mtd/nand/denali.h     |    4 ++
 drivers/mtd/nand/denali_pci.c |  144 +++++++++++++++++++++++++++++++++++++
 5 files changed, 186 insertions(+), 134 deletions(-)
 create mode 100644 drivers/mtd/nand/denali_pci.c
drivers/mtd/nand/Kconfig +9 -2
index 8ca4176..f5659c1 100644
@@ -66,8 +66,15 @@ config MTD_NAND_AUTCPU12
 	  access the SmartMediaCard.
 
 config MTD_NAND_DENALI
-       depends on PCI
+        tristate "Support Denali NAND controller"
+        help
+	  Enable support for the Denali NAND controller.  This should be
+	  combined with either the PCI or platform drivers to provide device
+	  registration.
+
+config MTD_NAND_DENALI_PCI
         tristate "Support Denali NAND controller on Intel Moorestown"
+	depends on PCI && MTD_NAND_DENALI
         help
           Enable the driver for NAND flash on Intel Moorestown, using the
           Denali NAND controller core.
@@ -75,7 +82,7 @@ config MTD_NAND_DENALI
 config MTD_NAND_DENALI_SCRATCH_REG_ADDR
         hex "Denali NAND size scratch register address"
         default "0xFF108018"
-        depends on MTD_NAND_DENALI
+        depends on MTD_NAND_DENALI_PCI
         help
           Some platforms place the NAND chip size in a scratch register
           because (some versions of) the driver aren't able to automatically
drivers/mtd/nand/Makefile +1 -0
index d4b4d87..0b3c9e2 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_NAND_SPIA)		+= spia.o
 obj-$(CONFIG_MTD_NAND_AMS_DELTA)	+= ams-delta.o
 obj-$(CONFIG_MTD_NAND_AUTCPU12)		+= autcpu12.o
 obj-$(CONFIG_MTD_NAND_DENALI)		+= denali.o
+obj-$(CONFIG_MTD_NAND_DENALI_PCI)	+= denali_pci.o
 obj-$(CONFIG_MTD_NAND_AU1550)		+= au1550nd.o
 obj-$(CONFIG_MTD_NAND_BF5XX)		+= bf5xx_nand.o
 obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB)	+= ppchameleonevb.o
drivers/mtd/nand/denali.c +28 -132

249 lines not on this page · raw message

drivers/mtd/nand/denali.h +4 -0
index fabb9d5..e5aa995 100644
@@ -487,6 +487,7 @@ struct denali_nand_info {
 	uint32_t irq_status;
 	int irq_debug_array[32];
 	int idx;
+	int irq;
 
 	uint32_t devnum;	/* represent how many nands connected */
 	uint32_t fwblks; /* represent how many blocks FW used */
@@ -496,4 +497,7 @@ struct denali_nand_info {
 	uint32_t max_banks;
 };
 
+extern int denali_init(struct denali_nand_info *denali);
+extern void denali_remove(struct denali_nand_info *denali);
+
 #endif /*_LLD_NAND_*/
drivers/mtd/nand/denali_pci.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/2 nand/denali: add a DT driver

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

Add a device tree version of the Denali NAND driver. Based on an original patch from Jamie Iles to add a MMIO version of this driver.

Cc David Woodhouse <[email protected]>
Cc Chuanxiao Dong <[email protected]>
Cc Jamie Iles <[email protected]>
---
 .../devicetree/bindings/mtd/denali-nand.txt        |   23 +++
 drivers/mtd/nand/Kconfig                           |    9 +-
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/denali.h                          |    1 +
 drivers/mtd/nand/denali_dt.c                       |  167 ++++++++++++++++++++
 5 files changed, 200 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/denali-nand.txt
 create mode 100644 drivers/mtd/nand/denali_dt.c
Documentation/devicetree/bindings/mtd/denali-nand.txt new file +23 -0
new file mode 100644
index 0000000..b04d03a
@@ -0,0 +1,23 @@
+* Denali NAND controller
+
+Required properties:
+  - compatible : should be "denali,denali-nand-dt"
+  - reg : should contain registers location and length for data and reg.
+  - reg-names: Should contain the reg names "nand_data" and "denali_reg"
+  - interrupts : The interrupt number.
+  - dm-mask : DMA bit mask
+
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
+Examples:
+
+nand: nand@ff900000 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "denali,denali-nand-dt";
+	reg = <0xff900000 0x100000>, <0xffb80000 0x10000>;
+	reg-names = "nand_data", "denali_reg";
+	interrupts = <0 144 4>;
+	dma-mask = <0xffffffff>;
+};
drivers/mtd/nand/Kconfig +8 -1
index f5659c1..2f6ace3 100644
@@ -78,7 +78,14 @@ config MTD_NAND_DENALI_PCI
         help
           Enable the driver for NAND flash on Intel Moorestown, using the
           Denali NAND controller core.
- 
+
+config MTD_NAND_DENALI_DT
+	tristate "Support Denali NAND controller as a DT device"
+	depends on HAVE_CLK && MTD_NAND_DENALI
+	help
+	  Enable the driver for NAND flash on platforms using a Denali NAND
+	  controller as a DT device.
+
 config MTD_NAND_DENALI_SCRATCH_REG_ADDR
         hex "Denali NAND size scratch register address"
         default "0xFF108018"
drivers/mtd/nand/Makefile +1 -0
index 0b3c9e2..50d6970 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_AMS_DELTA)	+= ams-delta.o
 obj-$(CONFIG_MTD_NAND_AUTCPU12)		+= autcpu12.o
 obj-$(CONFIG_MTD_NAND_DENALI)		+= denali.o
 obj-$(CONFIG_MTD_NAND_DENALI_PCI)	+= denali_pci.o
+obj-$(CONFIG_MTD_NAND_DENALI_DT)	+= denali_dt.o
 obj-$(CONFIG_MTD_NAND_AU1550)		+= au1550nd.o
 obj-$(CONFIG_MTD_NAND_BF5XX)		+= bf5xx_nand.o
 obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB)	+= ppchameleonevb.o
drivers/mtd/nand/denali.h +1 -0
index e5aa995..cec5712 100644
@@ -466,6 +466,7 @@ struct nand_buf {
 
 #define INTEL_CE4100	1
 #define INTEL_MRST	2
+#define DT		3
 
 struct denali_nand_info {
 	struct mtd_info mtd;
drivers/mtd/nand/denali_dt.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw
In reply to [email protected]
Quoted 4 lines · On Thu, 2012-09-27 at 10:58 -0600, [email protected] wrote:

Hello,

The following 2 patches attempts to make the current Denali NAND controller, which is PCI-based, to be both PCI and device tree drivers.

Pushed to l2-mtd.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy