Skip to contentSkip to conversation

davinci_nand, trivial : use symbolic ECC start command

PATCH New Ben Gardiner 1 participant 7 messages Oct 14, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/7 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]>

---

V2:
* Rebased to b69b02b92f59330be9d662110e202cfd3503eafa of u-boot-ti/master

---
 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 v2 2/7 da850evm : enable NAND even when not in NAND boot mode

In reply to a message not in the archive

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]>

---

V2:
* Rebased to b69b02b92f59330be9d662110e202cfd3503eafa of u-boot-ti/master

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 v2 3/7 da850evm: setup the NAND flash timings

In reply to a message not in the archive

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 5.3x for reads.

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

To: Sudhakar Rajashekhara <[email protected]>

---

V2:
* Rebased to b69b02b92f59330be9d662110e202cfd3503eafa of u-boot-ti/master

---
 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 v2 4/7 da850evm: setup NAND support under CONFIG_USE_NAND

In reply to a message not in the archive

The current da850evm config is missing the pieces for NAND support that can be found in Sandeep's 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]>

---

V2:
* Rebased to b69b02b92f59330be9d662110e202cfd3503eafa of u-boot-ti/master

---
 include/configs/da850evm.h |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
include/configs/da850evm.h +29 -0
index e0a3bae..0320917 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 v2 5/7 da850evm: add mtdpart and ubi commands with NAND support

In reply to a message not in the archive

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

To: Sudhakar Rajashekhara <[email protected]>

---

V2:
* Rebased to b69b02b92f59330be9d662110e202cfd3503eafa of u-boot-ti/master

---
 include/configs/da850evm.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/configs/da850evm.h +8 -0
index 0320917..91dc0c6 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
#6 lore raw

PATCH v7 6/7 da850evm: basic MII EMAC support

In reply to a message not in the archive

The current da850evm support in u-boot/master omits any use of the davinci EMAC. This patch adds basic support for the EMAC using the MII PHY found on the baseboard of the EVM. The MAC address is read from the environment variable 'ethadd'. Note that this is different from the da850evm support in the u-boot omapl1 tree where the MAC address is read from SPI flash.

CC Sandeep Paulraj <[email protected]>
CC Sudhakar Rajashekhara <[email protected]>
CC Ben Warren <[email protected]>
CC Mike Frysinger <[email protected]>

---

V7:
* rebased to bacbbac5be83ab7348d1c6176d287e9a61364a84 of u-boot-ti/master and integrated with NAND patch series from remaining patch of [1]
V6:
* no change
V5:
* no change
V4:
* make the emac_pins static
V3:
* rebased to u-boot/next
V2:
* added SOB
* renumbered this patch from 1/1 to 2/2
* just initialize the driver and let eth_initialize() take care of setting the MAC address from the environment variable enetaddr

[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg38461.html

---
 board/davinci/da8xxevm/da850evm.c |   49 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 64 insertions(+), 0 deletions(-)
board/davinci/da8xxevm/da850evm.c +49 -0
index 0eb9e29..c8c5e1b 100644
@@ -23,8 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -49,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+static const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -142,6 +167,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -149,3 +182,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
include/configs/da850evm.h +15 -0
index 91dc0c6..d544c13 100644
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -102,6 +103,20 @@
 #endif
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH v2 7/7 da850evm: fix linux bootparam address

In reply to a message not in the archive

This patch fixes the LINUX_BOOT_PARAM_ADDR define to be based off of PHYS_SDRAM_1 instead of CONFIG_SYS_MEMTEST_START. On da830 they are the same thing but on da850 the CONFIG_SYS_MEMSTART define is offset from the PHYS_SDRAM_1 start.

Without this patch it is not possible to boot linux on da850 -- bootm hangs at "Uncompressing Linux... done, booting the kernel."

CC "Paulraj, Sandeep" <[email protected]>

---

V2:
* Rebased to bacbbac5be83ab7348d1c6176d287e9a61364a84 of u-boot-ti/master and integrated with NAND patch series from outstanding patch [1]

[1] http://www.mail-archive.com/u-boot at lists.denx.de/msg38363.html

---
 include/configs/da850evm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/da850evm.h +1 -1
index d544c13..7bf6336 100644
@@ -138,7 +138,7 @@
 /*
  * Linux Information
  */
-#define LINUX_BOOT_PARAM_ADDR	(CONFIG_SYS_MEMTEST_START + 0x100)
+#define LINUX_BOOT_PARAM_ADDR	(PHYS_SDRAM_1 + 0x100)
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_BOOTARGS		\
Signature · 1 line
1.7.0.4