diff mbox

[U-Boot] omap3: Derive config for Beagleboard-XM sans NAND support

Message ID 1388932327-15986-1-git-send-email-spremi@ymail.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Sanjeev Premi Jan. 5, 2014, 2:32 p.m. UTC
Beagleboard XM doesn't have a NAND chip.
Let the configuration reflect so.

Signed-off-by: Sanjeev Premi <spremi@ymail.com>
Cc: Tom Rini <trini@ti.com>
---

 Patch was created and tested against:
   183acb70: Prepare v2013.10

 Forward ported to latest master for submission.

 Difference in binary sizes:   MLO     u-boot.img
   Before                      47932   337784
   After                       44676   277700

 boards.cfg                     |  1 +
 include/configs/omap3_beagle.h | 23 +++++++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

Comments

Tom Rini Jan. 6, 2014, 7:30 p.m. UTC | #1
On Sun, Jan 05, 2014 at 08:02:07PM +0530, Sanjeev Premi wrote:

> Beagleboard XM doesn't have a NAND chip.
> Let the configuration reflect so.
> 
> Signed-off-by: Sanjeev Premi <spremi@ymail.com>
> Cc: Tom Rini <trini@ti.com>

True, but why?  And please note that:

> +#ifdef CONFIG_BEAGLE_XM
> +#define CONFIG_ENV_IS_IN_MMC
> +#define CONFIG_SYS_MMC_ENV_DEV	0
> +#else
> +#define CONFIG_ENV_IS_IN_NAND
> +#endif	/* CONFIG_BEAGLE_XM */

Means that we'll be using part of the SD card for the stored environment
so a 'saveenv' will start breaking peoples SD cards if they didn't
re-partition them.
Sanjeev Premi Feb. 1, 2014, 7:17 p.m. UTC | #2
> On Tuesday, 7 January 2014 12:59 AM, Tom Rini <trini@ti.com> wrote:

> > On Sun, Jan 05, 2014 at 08:02:07PM +0530, Sanjeev Premi wrote:
> 
>>  Beagleboard XM doesn't have a NAND chip.
>>  Let the configuration reflect so.
>> 
>>  Signed-off-by: Sanjeev Premi <spremi@ymail.com>
>>  Cc: Tom Rini <trini@ti.com>
> 
> True, but why?  And please note that:

Because there is no NAND on certain BeagleXM, but saveenv would result in:

OMAP3 beagleboard.org # saveenv
Saving Environment to NAND...
Erasing NAND...
Attempt to erase non block-aligned data
OMAP3 beagleboard.org # 

Can be a problem when someone is working on mixed revisions of beagle boards esp. on a remote setup.

> 
>>  +#ifdef CONFIG_BEAGLE_XM
>>  +#define CONFIG_ENV_IS_IN_MMC
>>  +#define CONFIG_SYS_MMC_ENV_DEV    0
>>  +#else
>>  +#define CONFIG_ENV_IS_IN_NAND
>>  +#endif    /* CONFIG_BEAGLE_XM */
> 
> Means that we'll be using part of the SD card for the stored environment
> so a 'saveenv' will start breaking peoples SD cards if they didn't
> re-partition them.

Understood. But today everyone is using and can continue to use omap3_beagle_config. But someone explicitly using BeagleXM and expect saveenv to work on BeagleXM, manual change won't be required with each U-Boot release.

~sanjeev

> 
> 
> -- 
> Tom
>
diff mbox

Patch

diff --git a/boards.cfg b/boards.cfg
index c602a16..3a6fb87 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -332,6 +332,7 @@  Active  arm         armv7          omap3       technexion      twister
 Active  arm         armv7          omap3       teejet          mt_ventoux          mt_ventoux                           -                                                                                                                                 Stefano Babic <sbabic@denx.de>
 Active  arm         armv7          omap3       ti              am3517crane         am3517_crane                         -                                                                                                                                 Nagendra T S  <nagendra@mistralsolutions.com>
 Active  arm         armv7          omap3       ti              beagle              omap3_beagle                         -                                                                                                                                 Tom Rini <trini@ti.com>
+Active  arm         armv7          omap3       ti              beagle              omap3_beagle_xm                      omap3_beagle:BEAGLE_XM                                                                                                            Tom Rini <trini@ti.com>
 Active  arm         armv7          omap3       ti              evm                 omap3_evm                            -                                                                                                                                 Tom Rini <trini@ti.com>
 Active  arm         armv7          omap3       ti              evm                 omap3_evm_quick_mmc                  -                                                                                                                                 -
 Active  arm         armv7          omap3       ti              evm                 omap3_evm_quick_nand                 -                                                                                                                                 -
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 3acb854..51f9cfd 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -129,21 +129,31 @@ 
 
 #define CONFIG_CMD_ASKENV
 
+#ifdef CONFIG_BEAGLE_XM
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV	0
+#else
+#define CONFIG_ENV_IS_IN_NAND
+#endif	/* CONFIG_BEAGLE_XM */
+
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_EXT2		/* EXT2 Support			*/
 #define CONFIG_CMD_FAT		/* FAT support			*/
 #define CONFIG_CMD_FS_GENERIC	/* Generic FS support */
+
+#ifndef CONFIG_BEAGLE_XM
 #define CONFIG_CMD_MTDPARTS	/* Enable MTD parts commands */
 #define CONFIG_MTD_DEVICE	/* needed for mtdparts commands */
 #define MTDIDS_DEFAULT			"nand0=nand"
 #define MTDPARTS_DEFAULT		"mtdparts=nand:512k(x-loader),"\
 					"1920k(u-boot),128k(u-boot-env),"\
 					"4m(kernel),-(fs)"
+#define CONFIG_CMD_NAND		/* NAND support			*/
+#endif	/* CONFIG_BEAGLE_XM */
 
 #define CONFIG_CMD_I2C		/* I2C serial bus support	*/
 #define CONFIG_CMD_MMC		/* MMC support			*/
 #define CONFIG_USB_STORAGE	/* USB storage support		*/
-#define CONFIG_CMD_NAND		/* NAND support			*/
 #define CONFIG_CMD_LED		/* LED support			*/
 #define CONFIG_CMD_NET      /* bootp, tftpboot, rarpboot    */
 #define CONFIG_CMD_NFS      /* NFS support          */
@@ -173,6 +183,7 @@ 
 /*
  * Board NAND Info.
  */
+#ifndef CONFIG_BEAGLE_XM
 #define CONFIG_SYS_NAND_QUIET_TEST	1
 #define CONFIG_NAND_OMAP_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
@@ -184,6 +195,7 @@ 
 
 #define CONFIG_SYS_MAX_NAND_DEVICE	1		/* Max number of NAND */
 							/* devices */
+#endif	/* CONFIG_BEAGLE_XM */
 
 /* Environment information */
 #define CONFIG_BOOTDELAY		3
@@ -351,6 +363,7 @@ 
 
 /* **** PISMO SUPPORT *** */
 
+#ifndef CONFIG_BEAGLE_XM
 /* Configure the PISMO */
 #define PISMO1_NAND_SIZE		GPMC_SIZE_128M
 #define PISMO1_ONEN_SIZE		GPMC_SIZE_128M
@@ -365,13 +378,13 @@ 
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
 
-#define CONFIG_ENV_IS_IN_NAND		1
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
 #define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	(128 << 10)	/* 128 KiB */
 #define CONFIG_ENV_OFFSET		SMNAND_ENV_OFFSET
 #define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
+#endif	/* CONFIG_BEAGLE_XM */
 
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
@@ -408,16 +421,21 @@ 
 #define CONFIG_SPL_MMC_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
+
+#ifndef CONFIG_BEAGLE_XM
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_BASE
 #define CONFIG_SPL_NAND_DRIVERS
 #define CONFIG_SPL_NAND_ECC
+#endif	/* CONFIG_BEAGLE_XM */
+
 #define CONFIG_SPL_GPIO_SUPPORT
 #define CONFIG_SPL_POWER_SUPPORT
 #define CONFIG_SPL_OMAP3_ID_NAND
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
 
 /* NAND boot config */
+#ifndef CONFIG_BEAGLE_XM
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT	64
 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
@@ -431,6 +449,7 @@ 
 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_HAM1_CODE_HW
 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
+#endif	/* CONFIG_BEAGLE_XM */
 
 /*
  * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM