Skip to contentSkip to conversation

CM-x270 NAND flash support

PATCH In review Mike Rapoport 2 participants 2 messages Jul 18, 2006 – Jul 21, 2006

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

PATCH 1/1 CM-x270 NAND flash support

This patch provides MTD support for NAND flash device on CM-x270 modules.

 drivers/mtd/nand/Kconfig       |    4 +
 drivers/mtd/nand/Makefile      |    1 
 drivers/mtd/nand/cmx270-nand.c |  271 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 276 insertions(+), 0 deletions(-)
drivers/mtd/nand/Kconfig +4 -0
index 3db77ee..4c212fd 100644
@@ -232,6 +232,10 @@ config MTD_NAND_CS553X
 
 	  If you say "m", the module will be called "cs553x_nand.ko".
 
+config MTD_NAND_CM_X270
+	tristate "Support for NAND Flash on CM-X270 modules"
+	depends on MTD_NAND && MACH_CM_X270
+
 config MTD_NAND_NANDSIM
 	tristate "Support for NAND Flash Simulator"
 	depends on MTD_NAND && MTD_PARTITIONS
drivers/mtd/nand/Makefile +1 -0
index f747593..f2718aa 100644
@@ -22,5 +22,6 @@ obj-$(CONFIG_MTD_NAND_TS7250)		+= ts7250
 obj-$(CONFIG_MTD_NAND_NANDSIM)		+= nandsim.o
 obj-$(CONFIG_MTD_NAND_CS553X)		+= cs553x_nand.o
 obj-$(CONFIG_MTD_NAND_NDFC)		+= ndfc.o
+obj-$(CONFIG_MTD_NAND_CM_X270)		+= cmx270-nand.o
 
 nand-objs = nand_base.o nand_bbt.o
drivers/mtd/nand/cmx270-nand.c new file +271 -0

271 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Mike Rapoport
drivers/mtd/nand/cmx270-nand.c new file +4 -0
+
+/* This macro needed to ensure in-order operation of GPIO and local
+ * bus. Without both asm command and dummy uncached read there're
+ * states when NAND access is broken. I've looked for such macro(s) in

drivers/mtd/nand/cmx270-nand.c line 49

Quoted 10 lines
drivers/mtd/nand/cmx270-nand.c new file +10 -0
+ * include/asm-arm but found nothing approptiate.
+ * dmac_clean_range is close, but is makes cache invalidation
+ * unnecessary here and it cannot be used in module
+ */
+#define DRAIN_WB() \
+	do { \
+		unsigned char dummy; \
+		asm volatile ("mcr p15, 0, r0, c7, c10, 4":::"r0"); \
+		dummy=*((unsigned char*)UNCACHED_ADDR); \
+	} while(0)

I think you should add the volatile keyword to the typecast:

dummy=*((volatile unsigned char*)UNCACHED_ADDR);

In the cm-x255 nand flash driver, I had problems without it (read errors, ecc errors, etc). Maybe the compiler is optimising this read away thinking it does nothing useful?

Regards,
Raphael Assenat