Skip to contentSkip to conversation

ti814x: enable support for parallel NAND flash devices

PATCH New Pekon Gupta 1 participant 2 messages Sep 30, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ti814x: enable support for parallel NAND flash devices

TI81xx (TI816x, TI814x, TI813x) family of devices include in-built GPMC and ELM hardware controllers which have the capability to support:
- x8 and x16 parallel NAND, NOR flash devices.
- generation and error detection of Hamming and BCH ECC schemes.

This patch enables support for detection and boot via NAND flash devices for TI814x SoC.

---
 arch/arm/cpu/armv7/am33xx/clock_ti814x.c      | 5 +++++
 arch/arm/include/asm/arch-am33xx/mux_ti814x.h | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/am33xx/clock_ti814x.c +5 -0
index ef14f47..341f341 100644
@@ -188,6 +188,11 @@ static void enable_per_clocks(void)
 	writel(PRCM_MOD_EN, &cmalwon->rtcclkctrl);
 	while (readl(&cmalwon->rtcclkctrl) != PRCM_MOD_EN)
 		;
+
+	/* GPMC */
+	writel(PRCM_MOD_EN, &cmalwon->gpmcclkctrl);
+	while (readl(&cmalwon->gpmcclkctrl) != PRCM_MOD_EN)
+		;
 }
 
 /*
arch/arm/include/asm/arch-am33xx/mux_ti814x.h +3 -2
index a26e503..6105b27 100644
@@ -19,8 +19,9 @@
 /* PAD Control Fields */
 #define PINCNTL_RSV_MSK	(0x3 << 18) /* Reserved bitmask */
 #define PULLUP_EN	(0x1 << 17) /* Pull UP Selection */
-#define PULLUDEN	(0x0 << 16) /* Pull up enabled */
-#define PULLUDDIS	(0x1 << 16) /* Pull up disabled */
+#define PULLDOWN_EN	(0x1 << 17) /* Pull UP Selection */
+#define PULL_ENABLE	(0x0 << 16) /* Pull up enabled */
+#define PULL_DISABLE	(0x1 << 16) /* Pull up disabled */
 #define MODE(val)	val	/* used for Readability */
 
 #define MUX_CFG(value, offset)				\
Signature · 1 line
1.8.1
#1 lore raw

PATCH v2 2/2 ti814x: add support for NAND flash on ti814x_evm board

ti814x_evm has on-board socket for using Micron (MT29Fxx) family of NAND devices to GPMC interface. This patch
- adds NAND related pin-mux configuration for same
- adds #defines for NAND partitions to TI814x configs
- enables support for NAND in TI814x configs

---
 board/ti/ti814x/evm.c        |  4 +-
 board/ti/ti814x/evm.h        |  1 +
 board/ti/ti814x/mux.c        | 34 +++++++++++++++++
 include/configs/ti814x_evm.h | 91 +++++++++++++++++++++++++++++++++++++++++---
 4 files changed, 124 insertions(+), 6 deletions(-)
board/ti/ti814x/evm.c +3 -1
index e406326..3bd73a3 100644
@@ -91,9 +91,10 @@ void set_mux_conf_regs(void)
 {
 	/* Set MMC pins */
 	enable_mmc1_pin_mux();
-
 	/* Set Ethernet pins */
 	enable_enet_pin_mux();
+	/* Set NAND pins */
+	enable_nand_pin_mux();
 }
 
 void sdram_init(void)
@@ -113,6 +114,7 @@ void sdram_init(void)
 int board_init(void)
 {
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+	gpmc_init();
 	return 0;
 }
 
board/ti/ti814x/evm.h +1 -0
index 6aebec6..113ccc0 100644
@@ -4,5 +4,6 @@
 void enable_uart0_pin_mux(void);
 void enable_mmc1_pin_mux(void);
 void enable_enet_pin_mux(void);
+void enable_nand_pin_mux(void);
 
 #endif /* _EVM_H */
board/ti/ti814x/mux.c +34 -0
index fd9f364..63afe04 100644
@@ -70,6 +70,35 @@ static struct module_pin_mux enet_pin_mux[] = {
 	{OFFSET(pincntl258), MODE(0x01)},		/* EMAC[0]_MTXEN */
 };
 
+#ifdef CONFIG_NAND
+static struct module_pin_mux nand_x16_pin_mux[] = {
+		{OFFSET(pincntl89) , MODE(1) | PULL_DISABLE}, /* GPMC_AD0  */
+		{OFFSET(pincntl90) , MODE(1) | PULL_DISABLE}, /* GPMC_AD1  */
+		{OFFSET(pincntl91) , MODE(1) | PULL_DISABLE}, /* GPMC_AD2  */
+		{OFFSET(pincntl92) , MODE(1) | PULL_DISABLE}, /* GPMC_AD3  */
+		{OFFSET(pincntl93) , MODE(1) | PULL_DISABLE}, /* GPMC_AD4  */
+		{OFFSET(pincntl94) , MODE(1) | PULL_DISABLE}, /* GPMC_AD5  */
+		{OFFSET(pincntl95) , MODE(1) | PULL_DISABLE}, /* GPMC_AD6  */
+		{OFFSET(pincntl96) , MODE(1) | PULL_DISABLE}, /* GPMC_AD7  */
+		{OFFSET(pincntl97) , MODE(1) | PULL_DISABLE}, /* GPMC_AD8  */
+		{OFFSET(pincntl98) , MODE(1) | PULL_DISABLE}, /* GPMC_AD9  */
+		{OFFSET(pincntl99) , MODE(1) | PULL_DISABLE}, /* GPMC_AD10 */
+		{OFFSET(pincntl100), MODE(1) | PULL_DISABLE}, /* GPMC_AD11 */
+		{OFFSET(pincntl101), MODE(1) | PULL_DISABLE}, /* GPMC_AD12 */
+		{OFFSET(pincntl102), MODE(1) | PULL_DISABLE}, /* GPMC_AD13 */
+		{OFFSET(pincntl103), MODE(1) | PULL_DISABLE}, /* GPMC_AD14 */
+		{OFFSET(pincntl104), MODE(1) | PULL_DISABLE}, /* GPMC_AD15 */
+		{OFFSET(pincntl122), MODE(1) | PULLUP_EN}, /* GPMC_CS0 */
+		{OFFSET(pincntl128), MODE(1) | PULLDOWN_EN}, /* GPMC_ALE_ADV */
+		{OFFSET(pincntl129), MODE(1) | PULLUP_EN}, /* GPMC_OE_RE */
+		{OFFSET(pincntl130), MODE(1) | PULLUP_EN}, /* GPMC_WEN */
+		{OFFSET(pincntl131), MODE(1) | PULLDOWN_EN}, /* GPMC_BE_CLE */
+		{OFFSET(pincntl133), MODE(1) | PULLUP_EN}, /* GPMC_WAIT0 */
+		/* GPMC_WPN is controlled by Switch SW11(3) on board */
+		{-1},
+};
+#endif
+
 void enable_uart0_pin_mux(void)
 {
 	configure_module_pin_mux(uart0_pin_mux);
@@ -84,3 +113,8 @@ void enable_enet_pin_mux(void)
 {
 	configure_module_pin_mux(enet_pin_mux);
 }
+
+void enable_nand_pin_mux(void)
+{
+	configure_module_pin_mux(nand_x16_pin_mux);
+}
include/configs/ti814x_evm.h +86 -5

123 lines not on this page · raw message

Signature · 1 line
1.8.1