diff mbox

[U-Boot,u-boot-arm/next,1/2] OMAP3: igep00x0: Add config option to choose flash storage memory

Message ID 1342208490-24761-1-git-send-email-javier@dowhile0.org
State Accepted
Commit ca511cfb2a7ce9d431811efab11165b6b088f0e0
Delegated to: Tom Rini
Headers show

Commit Message

Javier Martinez Canillas July 13, 2012, 7:41 p.m. UTC
IGEP-based boards can have two different flash memories, a OneNAND or a
NAND device. Add a configuration option for to choose which memory to use.

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 board/isee/igep0020/igep0020.h |    4 ++++
 board/isee/igep0030/igep0030.h |    4 ++++
 boards.cfg                     |    6 ++++--
 include/configs/igep00x0.h     |   19 +++++++++++++++++++
 4 files changed, 31 insertions(+), 2 deletions(-)

Comments

Tom Rini July 16, 2012, 5:58 p.m. UTC | #1
On 07/16/2012 12:43 AM, Enric Balletbò i Serra wrote:

[snip]
> I would like to investigateif we can do this using runtime detection
> instead of a separate config option. Give me some days. The runtime
> detection can be done reading the sysboot configuration for example. I
> think it's possible, do you think would be possible ?

Until we have the device model and the ability to see at run-time if we
have say NAND or OneNAND (or neither!) we can't because we have to
build-time define where the environment will be found.
Javier Martinez Canillas July 16, 2012, 11:41 p.m. UTC | #2
On Mon, Jul 16, 2012 at 7:58 PM, Tom Rini <trini@ti.com> wrote:
> On 07/16/2012 12:43 AM, Enric Balletbò i Serra wrote:
>
> [snip]
>> I would like to investigateif we can do this using runtime detection
>> instead of a separate config option. Give me some days. The runtime
>> detection can be done reading the sysboot configuration for example. I
>> think it's possible, do you think would be possible ?
>
> Until we have the device model and the ability to see at run-time if we
> have say NAND or OneNAND (or neither!) we can't because we have to
> build-time define where the environment will be found.
>
> --
> Tom

Hi Enric,

Runtime detection is possible reading the sysboot as you said (in fact
this is how we do it in the kernel) but as Tom said I didn't find a
common way to do this. I guess you can manually detect the NAND type
and configure the GPMC registers on the board code but I didn't see
other OMAP boards doing this. Instead I found other examples of boards
using compile options to choose between memory types.

Of course I will be more than glad if you have a better approach to
solve this :-)

Thanks a lot and best regards,
Javier
Tom Rini July 16, 2012, 11:54 p.m. UTC | #3
On 07/16/2012 04:41 PM, Javier Martinez Canillas wrote:

[snip]
> Runtime detection is possible reading the sysboot as you said (in fact
> this is how we do it in the kernel) but as Tom said I didn't find a
> common way to do this. I guess you can manually detect the NAND type
> and configure the GPMC registers on the board code but I didn't see
> other OMAP boards doing this. Instead I found other examples of boards
> using compile options to choose between memory types.
> 
> Of course I will be more than glad if you have a better approach to
> solve this :-)

The biggest problem is that today we don't have a way to read/write
environment to a dynamically detected backing store.  I had an idea on
how to do this, but given the device model will also allow for this,
easier, that's the way to go.
Enric Balletbo Serra July 17, 2012, 7:13 a.m. UTC | #4
Hi,

2012/7/17 Tom Rini <trini@ti.com>:
> On 07/16/2012 04:41 PM, Javier Martinez Canillas wrote:
>
> [snip]
>> Runtime detection is possible reading the sysboot as you said (in fact
>> this is how we do it in the kernel) but as Tom said I didn't find a
>> common way to do this. I guess you can manually detect the NAND type
>> and configure the GPMC registers on the board code but I didn't see
>> other OMAP boards doing this. Instead I found other examples of boards
>> using compile options to choose between memory types.
>>
>> Of course I will be more than glad if you have a better approach to
>> solve this :-)
>
> The biggest problem is that today we don't have a way to read/write
> environment to a dynamically detected backing store.  I had an idea on
> how to do this, but given the device model will also allow for this,
> easier, that's the way to go.
>
> --
> Tom

Cool, thanks for the explanations Tom.

Javier, of course you have my :-)

Acked-by: Enric Balletbo i Serra <eballetbo@gmail.com>

Cheers,
  Enric
diff mbox

Patch

diff --git a/board/isee/igep0020/igep0020.h b/board/isee/igep0020/igep0020.h
index 3d6e15f..3335ecc 100644
--- a/board/isee/igep0020/igep0020.h
+++ b/board/isee/igep0020/igep0020.h
@@ -26,7 +26,11 @@ 
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"IGEP v2 board",
+#if defined(CONFIG_ENV_IS_IN_ONENAND)
 	"ONENAND",
+#else
+	"NAND",
+#endif
 };
 
 static void setup_net_chip(void);
diff --git a/board/isee/igep0030/igep0030.h b/board/isee/igep0030/igep0030.h
index b7ce5aa..a93339d 100644
--- a/board/isee/igep0030/igep0030.h
+++ b/board/isee/igep0030/igep0030.h
@@ -26,7 +26,11 @@ 
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"OMAP3 IGEP module",
+#if defined(CONFIG_ENV_IS_IN_ONENAND)
 	"ONENAND",
+#else
+	"NAND",
+#endif
 };
 
 /*
diff --git a/boards.cfg b/boards.cfg
index 9efdc6d..7463896 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -224,8 +224,10 @@  cm_t35                       arm         armv7       cm_t35              -
 omap3_overo                  arm         armv7       overo               -              omap3
 omap3_pandora                arm         armv7       pandora             -              omap3
 dig297                       arm         armv7       dig297              comelit        omap3
-igep0020                     arm         armv7       igep0020            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020
-igep0030                     arm         armv7       igep0030            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030
+igep0020                     arm         armv7       igep0020            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_ONENAND
+igep0020_nand                arm         armv7       igep0020            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0020,BOOT_NAND
+igep0030                     arm         armv7       igep0030            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_ONENAND
+igep0030_nand                arm         armv7       igep0030            isee           omap3		igep00x0:MACH_TYPE=MACH_TYPE_IGEP0030,BOOT_NAND
 am3517_evm                   arm         armv7       am3517evm           logicpd        omap3
 mt_ventoux                   arm         armv7       mt_ventoux          teejet         omap3
 omap3_zoom1                  arm         armv7       zoom1               logicpd        omap3
diff --git a/include/configs/igep00x0.h b/include/configs/igep00x0.h
index a0a23a7..d8e87c3 100644
--- a/include/configs/igep00x0.h
+++ b/include/configs/igep00x0.h
@@ -105,7 +105,12 @@ 
 #define CONFIG_CMD_FAT		/* FAT support			*/
 #define CONFIG_CMD_I2C		/* I2C serial bus support	*/
 #define CONFIG_CMD_MMC		/* MMC support			*/
+#ifdef CONFIG_BOOT_ONENAND
 #define CONFIG_CMD_ONENAND	/* ONENAND support		*/
+#endif
+#ifdef CONFIG_BOOT_NAND
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_PING
@@ -244,6 +249,7 @@ 
  * FLASH and environment organization
  */
 
+#ifdef CONFIG_BOOT_ONENAND
 #define PISMO1_ONEN_SIZE		GPMC_SIZE_128M /* Configure the PISMO */
 
 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
@@ -253,6 +259,19 @@ 
 #define CONFIG_ENV_IS_IN_ONENAND	1
 #define CONFIG_ENV_SIZE			(512 << 10) /* Total Size Environment */
 #define CONFIG_ENV_ADDR			ONENAND_ENV_OFFSET
+#endif
+
+#ifdef CONFIG_BOOT_NAND
+#define PISMO1_NAND_SIZE		GPMC_SIZE_128M /* Configure the PISMO */
+#define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_SYS_NAND_BASE		NAND_BASE
+#define GPMC_NAND_ECC_LP_x16_LAYOUT	1
+#define CONFIG_ENV_OFFSET		0x260000 /* environment starts here */
+#define CONFIG_ENV_IS_IN_NAND	        1
+#define CONFIG_ENV_SIZE			(512 << 10) /* Total Size Environment */
+#define CONFIG_ENV_ADDR			NAND_ENV_OFFSET
+#define CONFIG_SYS_MAX_NAND_DEVICE      1
+#endif
 
 /*
  * Size of malloc() pool