diff mbox

[U-Boot,1/5] am335x_evm: Make NAND support modular

Message ID 1373396410-23518-2-git-send-email-justin.waters@timesys.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Justin Waters July 9, 2013, 7 p.m. UTC
Give the user the ability to disable NAND support by defining
CONFIG_NO_NAND. This will allow custom hardware to easily support
this configuration.

Signed-off-by: Justin Waters <justin.waters@timesys.com>
---
 include/configs/am335x_evm.h |   55 ++++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)

Comments

Tom Rini July 9, 2013, 7:44 p.m. UTC | #1
On Tue, Jul 09, 2013 at 03:00:06PM -0400, Justin Waters wrote:

> Give the user the ability to disable NAND support by defining
> CONFIG_NO_NAND. This will allow custom hardware to easily support
> this configuration.
> 
> Signed-off-by: Justin Waters <justin.waters@timesys.com>

Just make boards.cfg set NAND by default, ala the console number.
Justin Waters July 9, 2013, 7:48 p.m. UTC | #2
Tom,

On Tue, 2013-07-09 at 15:44 -0400, Tom Rini wrote:
> On Tue, Jul 09, 2013 at 03:00:06PM -0400, Justin Waters wrote:
> 
> > Give the user the ability to disable NAND support by defining
> > CONFIG_NO_NAND. This will allow custom hardware to easily support
> > this configuration.
> > 
> > Signed-off-by: Justin Waters <justin.waters@timesys.com>
> 
> Just make boards.cfg set NAND by default, ala the console number.

Sounds good to me. That was my original preference, but I was trying to
be as non-invasive as possible. I'll make the change now that I have the
blessing.

-Justin
Scott Wood July 17, 2013, 9:05 p.m. UTC | #3
On 07/09/2013 02:00:06 PM, Justin Waters wrote:
> Give the user the ability to disable NAND support by defining
> CONFIG_NO_NAND. This will allow custom hardware to easily support
> this configuration.
> 
> Signed-off-by: Justin Waters <justin.waters@timesys.com>
> ---
>  include/configs/am335x_evm.h |   55  
> ++++++++++++++++++++++++++++--------------
>  1 file changed, 37 insertions(+), 18 deletions(-)
> 
> diff --git a/include/configs/am335x_evm.h  
> b/include/configs/am335x_evm.h
> index c5a6d4b..7bcfe2e 100644
> --- a/include/configs/am335x_evm.h
> +++ b/include/configs/am335x_evm.h
> @@ -42,12 +42,39 @@
> 
>  #define CONFIG_SYS_CACHELINE_SIZE       64
> 
> +#ifdef CONFIG_NO_NAND
> +#undef CONFIG_NAND
> +#else
> +#define CONFIG_NAND
> +#endif

Wouldn't it be cleaner to move CONFIG_NAND into boards.cfg, so if you  
want NAND to be absent, you just add a similar target that doesn't set  
it?

Especially if this is for custom hardware, which ought to get its own  
board.cfg line.

-Scott
Scott Wood July 17, 2013, 9:08 p.m. UTC | #4
On 07/17/2013 04:05:37 PM, Scott Wood wrote:
> On 07/09/2013 02:00:06 PM, Justin Waters wrote:
>> Give the user the ability to disable NAND support by defining
>> CONFIG_NO_NAND. This will allow custom hardware to easily support
>> this configuration.
>> 
>> Signed-off-by: Justin Waters <justin.waters@timesys.com>
>> ---
>>  include/configs/am335x_evm.h |   55  
>> ++++++++++++++++++++++++++++--------------
>>  1 file changed, 37 insertions(+), 18 deletions(-)
>> 
>> diff --git a/include/configs/am335x_evm.h  
>> b/include/configs/am335x_evm.h
>> index c5a6d4b..7bcfe2e 100644
>> --- a/include/configs/am335x_evm.h
>> +++ b/include/configs/am335x_evm.h
>> @@ -42,12 +42,39 @@
>> 
>>  #define CONFIG_SYS_CACHELINE_SIZE       64
>> 
>> +#ifdef CONFIG_NO_NAND
>> +#undef CONFIG_NAND
>> +#else
>> +#define CONFIG_NAND
>> +#endif
> 
> Wouldn't it be cleaner to move CONFIG_NAND into boards.cfg, so if you  
> want NAND to be absent, you just add a similar target that doesn't  
> set it?
> 
> Especially if this is for custom hardware, which ought to get its own  
> board.cfg line.

Sigh, as soon as I sent this my mail client decided it would be a good  
idea to show me the other replies from a couple days ago saying the  
same thing.  I need a new mail client...

-Scott
diff mbox

Patch

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c5a6d4b..7bcfe2e 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -42,12 +42,39 @@ 
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
 
+#ifdef CONFIG_NO_NAND
+#undef CONFIG_NAND
+#else
+#define CONFIG_NAND
+#endif
+
 /* commands to include */
 #include <config_cmd_default.h>
 
 #define CONFIG_CMD_ASKENV
 #define CONFIG_VERSION_VARIABLE
 
+#ifdef CONFIG_NAND
+#define NANDARGS \
+	"mtdids=" MTDIDS_DEFAULT "\0" \
+	"mtdparts=" MTDPARTS_DEFAULT "\0" \
+	"nandargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${nandroot} " \
+		"rootfstype=${nandrootfstype}\0" \
+	"dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \
+	"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
+	"nandrootfstype=ubifs rootwait=1\0" \
+	"nandsrcaddr=0x280000\0" \
+		"nandboot=echo Booting from nand ...; " \
+		"run nandargs; " \
+		"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
+		"bootm ${loadaddr}\0" \
+	"nandimgsize=0x500000\0"
+#else
+#define NANDARGS ""
+#endif
+
 /* set to negative value for no autoboot */
 #define CONFIG_BOOTDELAY		1
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
@@ -63,19 +90,12 @@ 
 	"fdtfile=undefined\0" \
 	"console=ttyO0,115200n8\0" \
 	"optargs=\0" \
-	"mtdids=" MTDIDS_DEFAULT "\0" \
-	"mtdparts=" MTDPARTS_DEFAULT "\0" \
 	"dfu_alt_info_mmc=" DFU_ALT_INFO_MMC "\0" \
 	"dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \
-	"dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \
 	"mmcdev=0\0" \
 	"mmcroot=/dev/mmcblk0p2 ro\0" \
 	"mmcrootfstype=ext4 rootwait\0" \
 	"bootpart=0:2\0" \
-	"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
-	"nandrootfstype=ubifs rootwait=1\0" \
-	"nandsrcaddr=0x280000\0" \
-	"nandimgsize=0x500000\0" \
 	"rootpath=/export/rootfs\0" \
 	"nfsopts=nolock\0" \
 	"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
@@ -86,10 +106,6 @@ 
 		"${optargs} " \
 		"root=${mmcroot} " \
 		"rootfstype=${mmcrootfstype}\0" \
-	"nandargs=setenv bootargs console=${console} " \
-		"${optargs} " \
-		"root=${nandroot} " \
-		"rootfstype=${nandrootfstype}\0" \
 	"spiroot=/dev/mtdblock4 rw\0" \
 	"spirootfstype=jffs2\0" \
 	"spisrcaddr=0xe0000\0" \
@@ -118,10 +134,6 @@ 
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr} - ${fdtaddr}\0" \
-	"nandboot=echo Booting from nand ...; " \
-		"run nandargs; " \
-		"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
-		"bootm ${loadaddr}\0" \
 	"spiboot=echo Booting from spi ...; " \
 		"run spiargs; " \
 		"sf probe ${spibusno}:0; " \
@@ -147,7 +159,8 @@ 
 		"if test $board_name = A335X_SK; then " \
 			"setenv fdtfile am335x-evmsk.dtb; fi; " \
 		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0"
+			"echo WARNING: Could not determine device tree to use; fi; \0" \
+	NANDARGS
 #endif
 
 #define CONFIG_BOOTCOMMAND \
@@ -231,7 +244,6 @@ 
 /* USB Device Firmware Update support */
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
-#define CONFIG_DFU_NAND
 #define CONFIG_CMD_DFU
 #define DFU_ALT_INFO_MMC \
 	"boot part 0 1;" \
@@ -241,6 +253,8 @@ 
 	"u-boot.img.raw mmc 300 3C0;" \
 	"u-boot.img fat 0 1;" \
 	"uEnv.txt fat 0 1"
+#ifdef CONFIG_NAND
+#define CONFIG_DFU_NAND
 #define DFU_ALT_INFO_NAND \
 	"SPL part 0 1;" \
 	"SPL.backup1 part 0 2;" \
@@ -249,6 +263,7 @@ 
 	"u-boot part 0 5;" \
 	"kernel part 0 7;" \
 	"rootfs part 0 8"
+#endif
 
  /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		1		/*  1 bank of DRAM */
@@ -337,9 +352,11 @@ 
 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	8     /* 4KB */
 
 /* nand */
+#ifdef CONFIG_NAND
 #define CONFIG_CMD_SPL_NAND_OFS			0x240000 /* end of u-boot */
 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS		0x280000
 #define CONFIG_CMD_SPL_WRITE_SIZE		0x1000
+#endif
 
 /* spl export command */
 #define CONFIG_CMD_SPL
@@ -369,6 +386,8 @@ 
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/am33xx/u-boot-spl.lds"
 
 #define CONFIG_SPL_BOARD_INIT
+
+#ifdef CONFIG_NAND
 #define CONFIG_SPL_NAND_AM33XX_BCH
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_NAND_BASE
@@ -395,6 +414,7 @@ 
 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x80000
+#endif
 
 /*
  * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
@@ -490,7 +510,6 @@ 
 #define CONFIG_PHY_ADDR			0
 #define CONFIG_PHY_SMSC
 
-#define CONFIG_NAND
 /* NAND support */
 #ifdef CONFIG_NAND
 #define CONFIG_CMD_NAND