Skip to contentSkip to conversation

ARM: omap: Fix GPMC init for OMAP3 platforms

PATCH New Stefan Roese 3 participants 13 messages Jul 9, 2014 – Jul 26, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Tested on TAO3530 board.

---
 arch/arm/cpu/armv7/omap-common/mem-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/omap-common/mem-common.c +1 -1
index 5bc7e1f..ba26cd1 100644
@@ -89,7 +89,7 @@ void gpmc_init(void)
 						};
 	u32 size = GPMC_SIZE_16M;
 	u32 base = CONFIG_SYS_FLASH_BASE;
-#elif defined(CONFIG_NAND)
+#elif defined(CONFIG_NAND) || defined(CONFIG_CMD_NAND)
 /* configure GPMC for NAND */
 	const u32  gpmc_regs[GPMC_MAX_REG] = {	M_NAND_GPMC_CONFIG1,
 						M_NAND_GPMC_CONFIG2,
Signature · 1 line
2.0.1
#1 lore raw

PATCH 2/3 ARM: omap: Remove unused arch/arm/cpu/armv7/omap3/mem.c

These functions have been merged into the common GPMC init code with this commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform). The file is not compiled any more. So remove it as well.

---
 arch/arm/cpu/armv7/omap3/mem.c | 139 -----------------------------------------
 1 file changed, 139 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/omap3/mem.c
arch/arm/cpu/armv7/omap3/mem.c deleted +0 -139
deleted file mode 100644
index 1832aff..0000000
@@ -1,139 +0,0 @@
-/*
- * (C) Copyright 2008
- * Texas Instruments, <www.ti.com>
- *
- * Author :
- *     Manikandan Pillai <[email protected]>
- *
- * Initial Code from:
- *     Richard Woodruff <[email protected]>
- *     Syed Mohammed Khasim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/mem.h>
-#include <asm/arch/sys_proto.h>
-#include <command.h>
-
-struct gpmc *gpmc_cfg;
-
-#if defined(CONFIG_CMD_NAND)
-static const u32 gpmc_m_nand[GPMC_MAX_REG] = {
-	M_NAND_GPMC_CONFIG1,
-	M_NAND_GPMC_CONFIG2,
-	M_NAND_GPMC_CONFIG3,
-	M_NAND_GPMC_CONFIG4,
-	M_NAND_GPMC_CONFIG5,
-	M_NAND_GPMC_CONFIG6, 0
-};
-#endif /* CONFIG_CMD_NAND */
-
-#if defined(CONFIG_CMD_ONENAND)
-static const u32 gpmc_onenand[GPMC_MAX_REG] = {
-	ONENAND_GPMC_CONFIG1,
-	ONENAND_GPMC_CONFIG2,
-	ONENAND_GPMC_CONFIG3,
-	ONENAND_GPMC_CONFIG4,
-	ONENAND_GPMC_CONFIG5,
-	ONENAND_GPMC_CONFIG6, 0
-};
-#endif /* CONFIG_CMD_ONENAND */
-
-/********************************************************
- *  mem_ok() - test used to see if timings are correct
- *             for a part. Helps in guessing which part
- *             we are currently using.
- *******************************************************/
-u32 mem_ok(u32 cs)
-{
-	u32 val1, val2, addr;
-	u32 pattern = 0x12345678;
-
-	addr = OMAP34XX_SDRC_CS0 + get_sdr_cs_offset(cs);
-
-	writel(0x0, addr + 0x400);	/* clear pos A */
-	writel(pattern, addr);		/* pattern to pos B */
-	writel(0x0, addr + 4);		/* remove pattern off the bus */
-	val1 = readl(addr + 0x400);	/* get pos A value */
-	val2 = readl(addr);		/* get val2 */
-	writel(0x0, addr + 0x400);	/* clear pos A */
-
-	if ((val1 != 0) || (val2 != pattern))	/* see if pos A val changed */
-		return 0;
-	else
-		return 1;
-}
-
-void enable_gpmc_cs_config(const u32 *gpmc_config, struct gpmc_cs *cs, u32 base,
-			u32 size)
-{
-	writel(0, &cs->config7);
-	sdelay(1000);
-	/* Delay for settling */
-	writel(gpmc_config[0], &cs->config1);
-	writel(gpmc_config[1], &cs->config2);
-	writel(gpmc_config[2], &cs->config3);
-	writel(gpmc_config[3], &cs->config4);
-	writel(gpmc_config[4], &cs->config5);
-	writel(gpmc_config[5], &cs->config6);
-
-	/*
-	 * Enable the config.  size is the CS size and goes in
-	 * bits 11:8.  We set bit 6 to enable this CS and the base
-	 * address goes into bits 5:0.
-	 */
-	 writel((size << 8) | (GPMC_CS_ENABLE << 6) |
-				 ((base >> 24) & GPMC_BASEADDR_MASK),
-				 &cs->config7);
-	sdelay(2000);
-}
-
-/*****************************************************
- * gpmc_init(): init gpmc bus
- * Init GPMC for x16, MuxMode (SDRAM in x32).
- * This code can only be executed from SRAM or SDRAM.
- *****************************************************/
-void gpmc_init(void)
-{
-	/* putting a blanket check on GPMC based on ZeBu for now */
-	gpmc_cfg = (struct gpmc *)GPMC_BASE;
-#if defined(CONFIG_CMD_NAND) || defined(CONFIG_CMD_ONENAND)
-	const u32 *gpmc_config = NULL;
-	u32 base = 0;
-	u32 size = 0;
-#endif
-	u32 config = 0;
-
-	/* global settings */
-	writel(0, &gpmc_cfg->irqenable); /* isr's sources masked */
-	writel(0, &gpmc_cfg->timeout_control);/* timeout disable */
-
-	config = readl(&gpmc_cfg->config);
-	config &= (~0xf00);
-	writel(config, &gpmc_cfg->config);
-
-	/*
-	 * Disable the GPMC0 config set by ROM code
-	 * It conflicts with our MPDB (both at 0x08000000)
-	 */
-	writel(0, &gpmc_cfg->cs[0].config7);
-	sdelay(1000);
-
-#if defined(CONFIG_CMD_NAND)	/* CS 0 */
-	gpmc_config = gpmc_m_nand;
-
-	base = PISMO1_NAND_BASE;
-	size = PISMO1_NAND_SIZE;
-	enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[0], base, size);
-#endif
-
-#if defined(CONFIG_CMD_ONENAND)
-	gpmc_config = gpmc_onenand;
-	base = PISMO1_ONEN_BASE;
-	size = PISMO1_ONEN_SIZE;
-	enable_gpmc_cs_config(gpmc_config, &gpmc_cfg->cs[0], base, size);
-#endif
-}
Signature · 1 line
2.0.1
#2 lore raw

PATCH 2/3 ARM: omap: Remove unused arch/arm/cpu/armv7/omap3/mem.c

Quoted 6 lines

From: Stefan Roese [mailto:sr at denx.de]
These functions have been merged into the common GPMC init code with this commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform). The file is not compiled any more. So remove it as well.

Quoted 8 lines

---
arch/arm/cpu/armv7/omap3/mem.c | 139 -----------------------------------------

1 file changed, 139 deletions(-)

delete mode 100644 arch/arm/cpu/armv7/omap3/mem.c

This file was removed in original patch, but probably was missed out because Tom Rini had to manually rebase the patch before applying.

with regards, pekon

#3 lore raw

PATCH 2/3 ARM: omap: Remove unused arch/arm/cpu/armv7/omap3/mem.c

In reply to Stefan Roese
Quoted 9 lines · Stefan Roese

These functions have been merged into the common GPMC init code with this commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform). The file is not compiled any more. So remove it as well.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/6db256c4/attachment.pgp>
#4 lore raw

PATCH 3/3 ARM: omap: tao3530: Convert to generic board

In reply to Stefan Roese

Use generic board setup functions by defining
CONFIG_SYS_GENERIC_BOARD.

---
 include/configs/tao3530.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/tao3530.h +1 -0
index 1b0fee9..62613e1 100644
@@ -22,6 +22,7 @@
 
 #define CONFIG_OMAP_GPIO
 #define CONFIG_OMAP_COMMON
+#define CONFIG_SYS_GENERIC_BOARD
 
 #define MACH_TYPE_OMAP3_TAO3530		2836
 
Signature · 1 line
2.0.1
#5 lore raw

PATCH 3/3 ARM: omap: tao3530: Convert to generic board

Quoted 5 lines · Stefan Roese

Use generic board setup functions by defining
CONFIG_SYS_GENERIC_BOARD.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/4c7bdf36/attachment.pgp>
#6 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

In reply to Stefan Roese

Hi Stefan,

Quoted 7 lines

From: Stefan Roese [mailto:sr at denx.de]

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

Quoted 5 lines

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?
Otherwise, if TAO3530 board uses the on-die NAND, then it should enable NAND in its board profile via boards.cfg

Quoted 1 line

Tested on TAO3530 board.

with regards, pekon

#7 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Hi Pekon,

Quoted 5 lines · Pekon
Quoted 5 lines

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

Quoted 7 lines
Quoted 5 lines

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?

CONFIG_NAND doesn't seem to be a mandatory define if NAND is used. Many OMAP3 based boards don't enable this define but still use NAND. The "old" mem.c also did only check for CONFIG_CMD_NAND to configure the GPMC accordingly. Thats why I chose to change mem-common.c to accept this kind of configuration instead of changing all those config headers to enable CONFIG_NAND.

Quoted 2 lines

Otherwise, if TAO3530 board uses the on-die NAND, then it should enable NAND in its board profile via boards.cfg

Sorry, I don't understand what this has to do with on-die NAND. This patch is a clear fix to restore the original behavior with the "old" mem.c.

Thanks,
Stefan

#8 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Quoted 10 lines · Stefan Roese

Hi Pekon,

Quoted 7 lines · Pekon
Quoted 7 lines

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?

CONFIG_NAND doesn't seem to be a mandatory define if NAND is used.

Exactly. Adding in CONFIG_NAND is something that am335x started doing because of the cases where we do, or do not, want to assume NAND exists.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140711/b2e8f25b/attachment.pgp>
#9 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Quoted 15 lines

From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Rini, Tom

Quoted 14 lines · Stefan Roese

Hi Pekon,

Quoted 11 lines · Pekon
Quoted 10 lines

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?

CONFIG_NAND doesn't seem to be a mandatory define if NAND is used.

Exactly. Adding in CONFIG_NAND is something that am335x started doing because of the cases where we do, or do not, want to assume NAND exists.

That is bad. We shouldn't have added any CONFIG just for sake of making one platform work, that to with very generic nomenclature. Anyways, given the fact we have two similar configs, Let's kill one of them completely. I think killing CONFIG_NAND would be easier, as it's used only in few TI specific am33xx boards. Agree ?

with regards, pekon

#10 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Quoted 20 lines · Pekon
Quoted 20 lines

From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Rini, Tom

Quoted 18 lines · Stefan Roese

Hi Pekon,

Quoted 6 lines · Pekon
Quoted 5 lines

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

Quoted 7 lines
Quoted 5 lines

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?

CONFIG_NAND doesn't seem to be a mandatory define if NAND is used.

Quoted 8 lines
Quoted 3 lines

Exactly. Adding in CONFIG_NAND is something that am335x started doing because of the cases where we do, or do not, want to assume NAND exists.

That is bad. We shouldn't have added any CONFIG just for sake of making one platform work, that to with very generic nomenclature. Anyways, given the fact we have two similar configs, Let's kill one of them completely. I think killing CONFIG_NAND would be easier, as it's used only in few TI specific am33xx boards. Agree ?

Yes. It would be great if you send an patch for this to be applied after this release. And we should take my patch for this release to fix this problem quickly.

Thanks,
Stefan

#11 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

Quoted 31 lines

From: Stefan Roese [mailto:sr at denx.de]

Quoted 21 lines · Pekon
Quoted 20 lines

From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Rini, Tom

Quoted 18 lines · Stefan Roese

Hi Pekon,

Quoted 6 lines · Pekon
Quoted 5 lines

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

Quoted 7 lines
Quoted 5 lines

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Sorry couldn't understand this, why have users enabled CONFIG_NAND_CMD, if CONFIG_NAND itself is not enabled ?

CONFIG_NAND doesn't seem to be a mandatory define if NAND is used.

Quoted 8 lines
Quoted 3 lines

Exactly. Adding in CONFIG_NAND is something that am335x started doing because of the cases where we do, or do not, want to assume NAND exists.

That is bad. We shouldn't have added any CONFIG just for sake of making one platform work, that to with very generic nomenclature. Anyways, given the fact we have two similar configs, Let's kill one of them completely. I think killing CONFIG_NAND would be easier, as it's used only in few TI specific am33xx boards. Agree ?

Quoted 4 lines

Yes. It would be great if you send an patch for this to be applied after this release. And we should take my patch for this release to fix this problem quickly.

Yes, absolutely, I don't want to stall your work.

with regards, pekon

#12 lore raw

PATCH 1/3 ARM: omap: Fix GPMC init for OMAP3 platforms

In reply to Stefan Roese
Quoted 10 lines · Stefan Roese

Commit a0a37183 (ARM: omap: merge GPMC initialization code for all platform) broke NAND on OMAP3 based platforms. I noticed this while testing the latest 2014.07-rc version on the TAO3530 board. NAND detection did not work with this error message:

NAND: nand: error: Unable to find NAND settings in GPMC Configuration - quitting

As OMAP3 configs don't set CONFIG_NAND but CONFIG_NAND_CMD. the GPMC was not initialized for NAND at all. This patch now fixes this issue.

Quoted 6 lines

Tested on TAO3530 board.

Please note that this introduces build failure on the tricorder platforms but is a bugfix. Thomas, tricorder is currently broken in that NAND doesn't work without this patch. With this patch we're now too big in SPL to fit in SRAM. I suspect, but this needs run-time testing that we can bump max size / say 6KB for stack, or better yet confirm that like am335x / am43xx / omap4+ we init DDR prior to putting CONFIG_SPL_STACK into sp and can use the whole of SRAM for SPL and have stack be an address in DDR (see
http://patchwork.ozlabs.org/patch/371636/).

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/5f3b0c5e/attachment.pgp>