Skip to contentSkip to conversation

da850evm NAND support

PATCH New Ben Gardiner 1 participant 6 messages Oct 12, 2010

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

cover da850evm NAND support

This patch series adds NAND support to the da850evm. The support is in the spirit of that found in the omap-l1 and u-boot-davinci trees where NAND support can be enabled with the addition of a single '#define CONFIG_USE_NAND' to the top of the include/configs/da850evm.h file. Pinmux entries are added for NAND so that NAND is usable even when the boot mode is not from NAND. Also the mtdpart, ubi and ubifs commands are proposed to be added to the NAND support because of their importance when using NAND.

Ben Gardiner (5):
davinci_nand, trivial : use symbolic ECC start command da850evm : enable NAND even when not in NAND boot mode
da850evm: setup the NAND flash timings
da850evm: setup NAND support under CONFIG_USE_NAND
da850evm: add mtdpart and ubi commands with NAND support

 board/davinci/da8xxevm/da850evm.c |   40 +++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/davinci_nand.c   |    3 +-
 include/configs/da850evm.h        |   37 ++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/1 davinci_nand, trivial : use symbolic ECC start command

The ECC calculations were started by writing 1 << 13 to the nand FCR register; that value is also defined as DAVINCI_NANDFCR_4BIT_CALC_START in emif_defs.h.

This patch substitutes the macro DAVINCI_NANDFCR_4BIT_CALC_START for the magic number '1 << 13'.

CC Sandeep Paulraj <[email protected]>

To: Scott Wood <[email protected]>

---

 drivers/mtd/nand/davinci_nand.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/mtd/nand/davinci_nand.c +2 -1
index c5a86d6..d41579c 100644
@@ -481,7 +481,8 @@ static int nand_davinci_4bit_correct_data(struct mtd_info *mtd, uint8_t *dat,
 	 * Set the addr_calc_st bit(bit no 13) in the NAND Flash Control
 	 * register to 1.
 	 */
-	__raw_writel(1 << 13, &davinci_emif_regs->nandfcr);
+	__raw_writel(DAVINCI_NANDFCR_4BIT_CALC_START,
+			&davinci_emif_regs->nandfcr);
 
 	/*
 	 * Wait for the corr_state field (bits 8 to 11) in the
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/1 da850evm : enable NAND even when not in NAND boot mode

In reply to Ben Gardiner

There is currently no NAND pinmux enabled by the da850evm board setup code. This is fine when booting from NAND since the early boot code (UBL) will setup the pinmux; however, when the boot mode is any other setting NAND is unusable when enabled in the config.

This patch adds a pinmux list for NAND and enables it when NAND is enabled in the config. Tested by booting from SPI on the da850evm and verifying NAND was usable.

To: Sudhakar Rajashekhara <[email protected]>

---

Note: there is precendent for NAND configuration by u-boot independent of the selected boot mode; see commit 26be2c53d671ecfd3e0483f0870649ac28322293 by Nick Thompson <[email protected]> "Davinci: NAND enable ECC even when not in NAND boot mode"

---

 board/davinci/da8xxevm/da850evm.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +22 -0
index eeb456c..f84adb9 100644
@@ -54,12 +54,34 @@ static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 3 }
 };
 
+#ifdef CONFIG_NAND_DAVINCI
+const struct pinmux_config nand_pins[] = {
+	{ pinmux(7), 1, 1 },
+	{ pinmux(7), 1, 2 },
+	{ pinmux(7), 1, 4 },
+	{ pinmux(7), 1, 5 },
+	{ pinmux(9), 1, 0 },
+	{ pinmux(9), 1, 1 },
+	{ pinmux(9), 1, 2 },
+	{ pinmux(9), 1, 3 },
+	{ pinmux(9), 1, 4 },
+	{ pinmux(9), 1, 5 },
+	{ pinmux(9), 1, 6 },
+	{ pinmux(9), 1, 7 },
+	{ pinmux(12), 1, 5 },
+	{ pinmux(12), 1, 6 }
+};
+#endif
+
 static const struct pinmux_resource pinmuxes[] = {
 #ifdef CONFIG_SPI_FLASH
 	PINMUX_ITEM(spi1_pins),
 #endif
 	PINMUX_ITEM(uart_pins),
 	PINMUX_ITEM(i2c_pins),
+#ifdef CONFIG_NAND_DAVINCI
+	PINMUX_ITEM(nand_pins),
+#endif
 };
 
 static const struct lpsc_resource lpsc[] = {
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 1/1 da850evm: setup the NAND flash timings

In reply to Ben Gardiner

The default NAND flash timings are very conservative. This patch assigns the timings reccomended in the recent linux kernel patch [1] from Sekhar Nori. The speedup, as reported in that patch, is greater than 5x for reads.

[1] http://www.spinics.net/lists/arm-kernel/msg100278.html

To: Sudhakar Rajashekhara <[email protected]>

---

 board/davinci/da8xxevm/da850evm.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +18 -0
index f84adb9..0eb9e29 100644
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <i2c.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -98,6 +99,23 @@ int board_init(void)
 	irq_init();
 #endif
 
+
+#ifdef CONFIG_NAND_DAVINCI
+	/*
+	 * NAND CS setup - cycle counts based on da850evm NAND timings in the
+	 * Linux kernel @ 25MHz EMIFA
+	 */
+	writel((DAVINCI_ABCR_WSETUP(0) |
+		DAVINCI_ABCR_WSTROBE(0) |
+		DAVINCI_ABCR_WHOLD(0) |
+		DAVINCI_ABCR_RSETUP(0) |
+		DAVINCI_ABCR_RSTROBE(1) |
+		DAVINCI_ABCR_RHOLD(0) |
+		DAVINCI_ABCR_TA(0) |
+		DAVINCI_ABCR_ASIZE_8BIT),
+	       &davinci_emif_regs->ab2cr); /* CS3 */
+#endif
+
 	/* arch number of the board */
 	gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA850_EVM;
 
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 1/1 da850evm: setup NAND support under CONFIG_USE_NAND

In reply to Ben Gardiner

The current da850evm config is missing the pieces for NAND support that can be found in the u-boot-davinci tree [1].

This patch adds NAND support in the spirit of the support in the u-boot-davinci tree where NAND support for the da850evm can be enabled by putting a single '#define CONFIG_USE_NAND' at the top of the include/configs/da850evm.h file.

[1] http://arago-project.org/git/people/?p=sandeep/u-boot-davinci.git;a=tree

CC Sandeep Paulraj <[email protected]>

To: Sudhakar Rajashekhara <[email protected]>

---

 include/configs/da850evm.h |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
include/configs/da850evm.h +29 -0
index d02b196..c96d45a 100644
@@ -79,6 +79,29 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Flash & Environment
+ */
+#ifdef CONFIG_USE_NAND
+#undef CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_NAND_DAVINCI
+#define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_IN_NAND		/* U-Boot env in NAND Flash  */
+#define CONFIG_ENV_OFFSET		0x0 /* Block 0--not used by bootcode */
+#define CONFIG_ENV_SIZE			(128 << 10)
+#define	CONFIG_SYS_NAND_USE_FLASH_BBT
+#define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
+#define	CONFIG_SYS_NAND_PAGE_2K
+#define CONFIG_SYS_NAND_CS		3
+#define CONFIG_SYS_NAND_BASE		DAVINCI_ASYNC_EMIF_DATA_CE3_BASE
+#define CONFIG_SYS_CLE_MASK		0x10
+#define CONFIG_SYS_ALE_MASK		0x8
+#undef CONFIG_SYS_NAND_HW_ECC
+#define CONFIG_SYS_MAX_NAND_DEVICE	1 /* Max number of NAND devices */
+#define NAND_MAX_CHIPS			1
+#define DEF_BOOTM			""
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
@@ -127,6 +150,12 @@
 #undef CONFIG_CMD_PING
 #endif
 
+#ifdef CONFIG_USE_NAND
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_IMLS
+#define CONFIG_CMD_NAND
+#endif
+
 #if !defined(CONFIG_USE_NAND) && \
 	!defined(CONFIG_USE_NOR) && \
 	!defined(CONFIG_USE_SPIFLASH)
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 1/1 da850evm: add mtdpart and ubi commands with NAND support

In reply to Ben Gardiner

This patch enables also the mtdpart, ubi and ubifs commands when NAND support is enabled.

To: Sudhakar Rajashekhara <[email protected]>

---

 include/configs/da850evm.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/da850evm.h +8 -0
index c96d45a..49dfc06 100644
@@ -154,6 +154,14 @@
 #undef CONFIG_CMD_FLASH
 #undef CONFIG_CMD_IMLS
 #define CONFIG_CMD_NAND
+
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_LZO
+#define CONFIG_RBTREE
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
 #endif
 
 #if !defined(CONFIG_USE_NAND) && \
Signature · 1 line
1.7.0.4