Skip to contentSkip to conversation

mx23_olinuxino: Add default environment

PATCH Superseded Otavio Salvador 2 participants 5 messages Jan 23, 2013

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 mx23_olinuxino: Add default environment

This adds a default environment with support for MMC booting.

---
Changes in v5:
- Remove duplicate environment setting
- Improve commit log

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/configs/mx23_olinuxino.h | 74 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 7 deletions(-)
include/configs/mx23_olinuxino.h +67 -7
index bc63481..fc859b3 100644
@@ -114,6 +114,14 @@
 /*
  * MMC Driver
  */
+#define	CONFIG_ENV_IS_IN_MMC
+#define	CONFIG_ENV_OVERWRITE
+#ifdef	CONFIG_ENV_IS_IN_MMC
+#define	CONFIG_ENV_OFFSET	(256 * 1024)
+#define	CONFIG_ENV_SIZE	(16 * 1024)
+#define	CONFIG_SYS_MMC_ENV_DEV 0
+#endif
+#define	CONFIG_CMD_SAVEENV
 #ifdef	CONFIG_CMD_MMC
 #define	CONFIG_MMC
 #define	CONFIG_BOUNCE_BUFFER
@@ -127,21 +135,73 @@
 #define CONFIG_APBH_DMA
 
 /*
- * ENV -- nowhere so far
- */
-#define	CONFIG_ENV_SIZE			(16 * 1024)
-#define	CONFIG_ENV_IS_NOWHERE
-
-/*
  * Boot Linux
  */
 #define	CONFIG_CMDLINE_TAG
 #define	CONFIG_SETUP_MEMORY_TAGS
 #define	CONFIG_BOOTDELAY	3
 #define	CONFIG_BOOTFILE		"uImage"
-#define	CONFIG_BOOTARGS		"console=ttyAMA0,115200n8 "
 #define	CONFIG_LOADADDR		0x42000000
 #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 #define	CONFIG_OF_LIBFDT
 
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"update_sd_firmware_filename=u-boot.sd\0" \
+	"update_sd_firmware="		/* Update the SD firmware partition */ \
+		"if mmc rescan ; then "	\
+		"if tftp ${update_sd_firmware_filename} ; then " \
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "	\
+		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
+		"fi ; "	\
+		"fi\0" \
+	"script=boot.scr\0"	\
+	"uimage=uImage\0" \
+	"console=ttyAMA0\0" \
+	"fdt_file=imx23-olinuxino.dtb\0" \
+	"fdt_addr=0x41000000\0" \
+	"boot_fdt=try\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"root=${mmcroot}\0" \
+	"loadbootscript="  \
+		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+	"bootscript=echo Running bootscript from mmc ...; "	\
+		"source\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"run mmcargs; " \
+		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+			"if run loadfdt; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootm; " \
+		"fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+	"mmc dev ${mmcdev}; if mmc rescan; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else " \
+				"echo ERR: Fail to boot from MMC; " \
+			"fi; " \
+		"fi; " \
+	"else exit; fi"
+
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */
Signature · 1 line
1.8.1
#1 lore raw

PATCH v5 2/2 mx23evk: Add initial board support

The following features are supported:
* 128 MB DDR1 SDRAM
* DUART
* SD/MMC Card Socket

---
Changes in v5:
- Use 4bit bus for mmc

Changes in v4:
- Fix build warnings

Changes in v3:
- Removed unused macro for GPMI setting in spl_boot.c

Changes in v2:
- Add DUART in commitlog
- Remove AUART MUX setup as it is unused
- Remove wrong comment in mx23evk.h board config
- Use single line comments in mx23evk.h board config
- Use '=>' as prompt
- Remove SPI, RTC and USB support as those where not tested yet

 MAINTAINERS                        |   4 +
 board/freescale/mx23evk/Makefile   |  47 +++++++++
 board/freescale/mx23evk/mx23evk.c  |  83 +++++++++++++++
 board/freescale/mx23evk/spl_boot.c | 104 +++++++++++++++++++
 boards.cfg                         |   1 +
 include/configs/mx23evk.h          | 201 +++++++++++++++++++++++++++++++++++++
 6 files changed, 440 insertions(+)
 create mode 100644 board/freescale/mx23evk/Makefile
 create mode 100644 board/freescale/mx23evk/mx23evk.c
 create mode 100644 board/freescale/mx23evk/spl_boot.c
 create mode 100644 include/configs/mx23evk.h
MAINTAINERS +4 -0
index dfa3c8b..faa9b5e 100644
@@ -947,6 +947,10 @@ Matt Waddel <[email protected]>
 
 	ca9x4_ct_vxp	ARM ARMV7 (Quad Core)
 
+Otavio Salvador <[email protected]>
+
+	mx23evk		i.MX23
+
 Prafulla Wadaskar <[email protected]>
 
 	aspenite	ARM926EJS (ARMADA100 88AP168 SoC)
board/freescale/mx23evk/Makefile new file +47 -0

47 lines not on this page · raw message

board/freescale/mx23evk/mx23evk.c new file +83 -0

83 lines not on this page · raw message

board/freescale/mx23evk/spl_boot.c new file +104 -0

104 lines not on this page · raw message

boards.cfg +1 -0
index 9b31931..7d03620 100644
@@ -193,6 +193,7 @@ imx27lite                    arm         arm926ejs   imx27lite           logicpd
 magnesium                    arm         arm926ejs   imx27lite           logicpd        mx27
 mx23_olinuxino               arm         arm926ejs   mx23_olinuxino      olimex         mxs		mx23_olinuxino
 apx4devkit                   arm         arm926ejs   apx4devkit          bluegiga       mxs		apx4devkit
+mx23evk                      arm         arm926ejs   mx23evk             freescale      mxs		mx23evk
 m28evk                       arm         arm926ejs   m28evk              denx           mxs		m28evk
 mx28evk                      arm         arm926ejs   mx28evk             freescale      mxs		mx28evk
 sc_sps_1                     arm         arm926ejs   sc_sps_1            schulercontrol mxs
include/configs/mx23evk.h new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
1.8.1
#2 lore raw

PATCH v5 1/2 mx23_olinuxino: Add default environment

In reply to Otavio Salvador

Dear Otavio Salvador,

Quoted 21 lines

This adds a default environment with support for MMC booting.

---
Changes in v5:
- Remove duplicate environment setting
- Improve commit log

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/configs/mx23_olinuxino.h | 74

++++++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-)

(quoted diff) +0 -0

b/include/configs/mx23_olinuxino.h index bc63481..fc859b3 100644

include/configs/mx23_olinuxino.h line 123

Quoted 10 lines
include/configs/mx23_olinuxino.h +7 -0
@@ -114,6 +114,14 @@
 /*
  * MMC Driver
  */
+#define	CONFIG_ENV_IS_IN_MMC
+#define	CONFIG_ENV_OVERWRITE
+#ifdef	CONFIG_ENV_IS_IN_MMC
+#define	CONFIG_ENV_OFFSET	(256 * 1024)
+#define	CONFIG_ENV_SIZE	(16 * 1024)
+#define	CONFIG_SYS_MMC_ENV_DEV 0
+#endif

The stuff aboce goes into ENV section below

include/configs/mx23_olinuxino.h line 124

Quoted 1 line
include/configs/mx23_olinuxino.h +1 -0
+#define	CONFIG_CMD_SAVEENV

CMD goes under CMD section (is this really even needed? saveenv is there all the time anyway)

Quoted 19 lines
include/configs/mx23_olinuxino.h +0 -6
 #ifdef	CONFIG_CMD_MMC
 #define	CONFIG_MMC
 #define	CONFIG_BOUNCE_BUFFER
@@ -127,21 +135,73 @@
 #define CONFIG_APBH_DMA
 
 /*
- * ENV -- nowhere so far
- */
-#define	CONFIG_ENV_SIZE			(16 * 1024)
-#define	CONFIG_ENV_IS_NOWHERE
-
-/*
  * Boot Linux
  */
 #define	CONFIG_CMDLINE_TAG
 #define	CONFIG_SETUP_MEMORY_TAGS
 #define	CONFIG_BOOTDELAY	3
 #define	CONFIG_BOOTFILE		"uImage"

include/configs/mx23_olinuxino.h line 152

Quoted 10 lines
include/configs/mx23_olinuxino.h +5 -1
-#define	CONFIG_BOOTARGS		"console=ttyAMA0,115200n8 "
 #define	CONFIG_LOADADDR		0x42000000
 #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 #define	CONFIG_OF_LIBFDT
 
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"update_sd_firmware_filename=u-boot.sd\0" \

This is still broken, mxsboot doesn't work on mx23.

Quoted 55 lines
include/configs/mx23_olinuxino.h +54 -0
+	"update_sd_firmware="		/* Update the SD firmware partition */ \
+		"if mmc rescan ; then "	\
+		"if tftp ${update_sd_firmware_filename} ; then " \
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "	\
+		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
+		"fi ; "	\
+		"fi\0" \
+	"script=boot.scr\0"	\
+	"uimage=uImage\0" \
+	"console=ttyAMA0\0" \
+	"fdt_file=imx23-olinuxino.dtb\0" \
+	"fdt_addr=0x41000000\0" \
+	"boot_fdt=try\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"root=${mmcroot}\0" \
+	"loadbootscript="  \
+		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+	"bootscript=echo Running bootscript from mmc ...; "	\
+		"source\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"run mmcargs; " \
+		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+			"if run loadfdt; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootm; " \
+		"fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+	"mmc dev ${mmcdev}; if mmc rescan; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else " \
+				"echo ERR: Fail to boot from MMC; " \
+			"fi; " \
+		"fi; " \
+	"else exit; fi"
+
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */
#3 lore raw

PATCH v5 1/2 mx23_olinuxino: Add default environment

Quoted 36 lines · Marek Vasut

Dear Otavio Salvador,

Quoted 21 lines

This adds a default environment with support for MMC booting.

---
Changes in v5:
- Remove duplicate environment setting
- Improve commit log

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/configs/mx23_olinuxino.h | 74

++++++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-)

(quoted diff) +0 -0

b/include/configs/mx23_olinuxino.h index bc63481..fc859b3 100644

include/configs/mx23_olinuxino.h line 123

Quoted 10 lines
include/configs/mx23_olinuxino.h +7 -0
@@ -114,6 +114,14 @@
 /*
  * MMC Driver
  */
+#define      CONFIG_ENV_IS_IN_MMC
+#define      CONFIG_ENV_OVERWRITE
+#ifdef       CONFIG_ENV_IS_IN_MMC
+#define      CONFIG_ENV_OFFSET       (256 * 1024)
+#define      CONFIG_ENV_SIZE (16 * 1024)
+#define      CONFIG_SYS_MMC_ENV_DEV 0
+#endif

The stuff aboce goes into ENV section below

Quoted 4 lines

include/configs/mx23_olinuxino.h line 124

Quoted 1 line
include/configs/mx23_olinuxino.h +1 -0
+#define      CONFIG_CMD_SAVEENV

CMD goes under CMD section (is this really even needed? saveenv is there all the time anyway)

Indeed this is not need; I removed it.

Quoted 24 lines
Quoted 24 lines
include/configs/mx23_olinuxino.h +0 -7
 #ifdef       CONFIG_CMD_MMC
 #define      CONFIG_MMC
 #define      CONFIG_BOUNCE_BUFFER
@@ -127,21 +135,73 @@
 #define CONFIG_APBH_DMA
 
 /*
- * ENV -- nowhere so far
- */
-#define      CONFIG_ENV_SIZE                 (16 * 1024)
-#define      CONFIG_ENV_IS_NOWHERE
-
-/*
  * Boot Linux
  */
 #define      CONFIG_CMDLINE_TAG
 #define      CONFIG_SETUP_MEMORY_TAGS
 #define      CONFIG_BOOTDELAY        3
 #define      CONFIG_BOOTFILE         "uImage"
-#define      CONFIG_BOOTARGS         "console=ttyAMA0,115200n8 "
 #define      CONFIG_LOADADDR         0x42000000
 #define      CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
 #define      CONFIG_OF_LIBFDT
 
Quoted 7 lines

include/configs/mx23_olinuxino.h line 152

Quoted 5 lines
include/configs/mx23_olinuxino.h +5 -0
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+     "update_sd_firmware_filename=u-boot.sd\0" \

This is still broken, mxsboot doesn't work on mx23.

Well, yes but I see no reason to not put this here as it will work when mxsboot is done. I can hold it if you prefer...

Quoted 47 lines
Quoted 47 lines
include/configs/mx23_olinuxino.h +47 -0
+     "update_sd_firmware="           /* Update the SD firmware partition */ \
+             "if mmc rescan ; then " \
+             "if tftp ${update_sd_firmware_filename} ; then " \
+             "setexpr fw_sz ${filesize} / 0x200 ; "  /* SD block size */ \
+             "setexpr fw_sz ${fw_sz} + 1 ; " \
+             "mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
+             "fi ; " \
+             "fi\0" \
+     "script=boot.scr\0"     \
+     "uimage=uImage\0" \
+     "console=ttyAMA0\0" \
+     "fdt_file=imx23-olinuxino.dtb\0" \
+     "fdt_addr=0x41000000\0" \
+     "boot_fdt=try\0" \
+     "mmcdev=0\0" \
+     "mmcpart=2\0" \
+     "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+     "mmcargs=setenv bootargs console=${console},${baudrate} " \
+             "root=${mmcroot}\0" \
+     "loadbootscript="  \
+             "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+     "bootscript=echo Running bootscript from mmc ...; "     \
+             "source\0" \
+     "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+     "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+     "mmcboot=echo Booting from mmc ...; " \
+             "run mmcargs; " \
+             "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                     "if run loadfdt; then " \
+                             "bootm ${loadaddr} - ${fdt_addr}; " \
+                     "else " \
+                             "if test ${boot_fdt} = try; then " \
+                                     "bootm; " \
+                             "else " \
+                                     "echo WARN: Cannot load the DT; " \
+                             "fi; " \
+                     "fi; " \
+             "else " \
+                     "bootm; " \
+             "fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+     "mmc dev ${mmcdev}; if mmc rescan; then " \
+             "if run loadbootscript; then " \
+                     "run bootscript; " \
+             "else " \
+                     "if run loaduimage; then " \
Quoted 8 lines

include/configs/mx23_olinuxino.h line 207

Quoted 8 lines
include/configs/mx23_olinuxino.h +7 -0
+                             "run mmcboot; " \
+                     "else " \
+                             "echo ERR: Fail to boot from MMC; " \
+                     "fi; " \
+             "fi; " \
+     "else exit; fi"
+
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */

--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br

#4 lore raw

PATCH v5 1/2 mx23_olinuxino: Add default environment

Dear Otavio Salvador,

Quoted 87 lines · Marek Vasut
Quoted 40 lines

Dear Otavio Salvador,

Quoted 25 lines

This adds a default environment with support for MMC booting.

---
Changes in v5:
- Remove duplicate environment setting
- Improve commit log

Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/configs/mx23_olinuxino.h | 74

++++++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-)

(quoted diff) +0 -0

b/include/configs/mx23_olinuxino.h index bc63481..fc859b3 100644

include/configs/mx23_olinuxino.h +0 -0
@@ -114,6 +114,14 @@
 
 /*
 

include/configs/mx23_olinuxino.h line 126

Quoted 10 lines
include/configs/mx23_olinuxino.h +7 -0
  * MMC Driver
  */
 
+#define      CONFIG_ENV_IS_IN_MMC
+#define      CONFIG_ENV_OVERWRITE
+#ifdef       CONFIG_ENV_IS_IN_MMC
+#define      CONFIG_ENV_OFFSET       (256 * 1024)
+#define      CONFIG_ENV_SIZE (16 * 1024)
+#define      CONFIG_SYS_MMC_ENV_DEV 0
+#endif

The stuff aboce goes into ENV section below

Quoted 4 lines

include/configs/mx23_olinuxino.h line 124

Quoted 1 line
include/configs/mx23_olinuxino.h +1 -0
+#define      CONFIG_CMD_SAVEENV

CMD goes under CMD section (is this really even needed? saveenv is there all the time anyway)

Indeed this is not need; I removed it.

Quoted 31 lines
Quoted 31 lines
 #ifdef       CONFIG_CMD_MMC
 #define      CONFIG_MMC
 #define      CONFIG_BOUNCE_BUFFER
include/configs/mx23_olinuxino.h +0 -7
@@ -127,21 +135,73 @@
 
 #define CONFIG_APBH_DMA
 
 /*
 
- * ENV -- nowhere so far
- */
-#define      CONFIG_ENV_SIZE                 (16 * 1024)
-#define      CONFIG_ENV_IS_NOWHERE
-
-/*
 
  * Boot Linux
  */
 
 #define      CONFIG_CMDLINE_TAG
 #define      CONFIG_SETUP_MEMORY_TAGS
 #define      CONFIG_BOOTDELAY        3
 #define      CONFIG_BOOTFILE         "uImage"
 
-#define      CONFIG_BOOTARGS         "console=ttyAMA0,115200n8 "
 
 #define      CONFIG_LOADADDR         0x42000000
 #define      CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
 #define      CONFIG_OF_LIBFDT
Quoted 7 lines

include/configs/mx23_olinuxino.h line 152

Quoted 5 lines
include/configs/mx23_olinuxino.h +5 -0
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+     "update_sd_firmware_filename=u-boot.sd\0" \

This is still broken, mxsboot doesn't work on mx23.

Quoted 2 lines

Well, yes but I see no reason to not put this here as it will work when mxsboot is done. I can hold it if you prefer...

You're adding broken code -- hold it of course. Or split this into two patches

Best regards,
Marek Vasut