1 /*
2  * Copyright (C) 2013 Marek Vasut <marex@denx.de>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 #ifndef __CONFIGS_MX23_OLINUXINO_H__
7 #define __CONFIGS_MX23_OLINUXINO_H__
8 
9 /* System configurations */
10 #define CONFIG_MX23				/* i.MX23 SoC */
11 #define CONFIG_MACH_TYPE	4105
12 
13 /* U-Boot Commands */
14 #define CONFIG_SYS_NO_FLASH
15 
16 /* Memory configuration */
17 #define CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM */
18 #define PHYS_SDRAM_1			0x40000000	/* Base address */
19 #define PHYS_SDRAM_1_SIZE		0x08000000	/* Max 128 MB RAM */
20 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
21 
22 /* Environment */
23 #define CONFIG_ENV_IS_IN_MMC
24 #define CONFIG_ENV_OVERWRITE
25 
26 /* Environment is in MMC */
27 #if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
28 #define CONFIG_ENV_OFFSET	(256 * 1024)
29 #define CONFIG_ENV_SIZE		(16 * 1024)
30 #define CONFIG_SYS_MMC_ENV_DEV	0
31 #endif
32 
33 /* Status LED */
34 
35 /* USB */
36 #ifdef CONFIG_CMD_USB
37 #define CONFIG_EHCI_MXS_PORT0
38 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
39 #endif
40 
41 /* Ethernet */
42 #ifdef CONFIG_CMD_NET
43 #define CONFIG_USB_HOST_ETHER
44 #define CONFIG_USB_ETHER_SMSC95XX
45 #endif
46 
47 /* Booting Linux */
48 #define CONFIG_BOOTFILE		"uImage"
49 #define CONFIG_LOADADDR		0x42000000
50 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
51 
52 /* Extra Environment */
53 #define CONFIG_EXTRA_ENV_SETTINGS \
54 	"update_sd_firmware_filename=u-boot.sd\0" \
55 	"update_sd_firmware="		/* Update the SD firmware partition */ \
56 		"if mmc rescan ; then "	\
57 		"if tftp ${update_sd_firmware_filename} ; then " \
58 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
59 		"setexpr fw_sz ${fw_sz} + 1 ; "	\
60 		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
61 		"fi ; "	\
62 		"fi\0" \
63 	"script=boot.scr\0"	\
64 	"uimage=uImage\0" \
65 	"console=ttyAMA0\0" \
66 	"fdt_file=imx23-olinuxino.dtb\0" \
67 	"fdt_addr=0x41000000\0" \
68 	"boot_fdt=try\0" \
69 	"ip_dyn=yes\0" \
70 	"mmcdev=0\0" \
71 	"mmcpart=2\0" \
72 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
73 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
74 		"root=${mmcroot}\0" \
75 	"loadbootscript="  \
76 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
77 	"bootscript=echo Running bootscript from mmc ...; "	\
78 		"source\0" \
79 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
80 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
81 	"mmcboot=echo Booting from mmc ...; " \
82 		"run mmcargs; " \
83 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
84 			"if run loadfdt; then " \
85 				"bootm ${loadaddr} - ${fdt_addr}; " \
86 			"else " \
87 				"if test ${boot_fdt} = try; then " \
88 					"bootm; " \
89 				"else " \
90 					"echo WARN: Cannot load the DT; " \
91 				"fi; " \
92 			"fi; " \
93 		"else " \
94 			"bootm; " \
95 		"fi;\0" \
96 	"netargs=setenv bootargs console=${console},${baudrate} " \
97 		"root=/dev/nfs " \
98 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
99 	"netboot=echo Booting from net ...; " \
100 		"usb start; " \
101 		"run netargs; "	\
102 		"if test ${ip_dyn} = yes; then " \
103 			"setenv get_cmd dhcp; " \
104 		"else " \
105 			"setenv get_cmd tftp; " \
106 		"fi; " \
107 		"${get_cmd} ${uimage}; " \
108 		"if test ${boot_fdt} = yes; then " \
109 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
110 				"bootm ${loadaddr} - ${fdt_addr}; " \
111 			"else " \
112 				"if test ${boot_fdt} = try; then " \
113 					"bootm; " \
114 				"else " \
115 					"echo WARN: Cannot load the DT; " \
116 				"fi;" \
117 			"fi; " \
118 		"else " \
119 			"bootm; " \
120 		"fi;\0"
121 
122 #define CONFIG_BOOTCOMMAND \
123 	"mmc dev ${mmcdev}; if mmc rescan; then " \
124 		"if run loadbootscript; then " \
125 			"run bootscript; " \
126 		"else " \
127 			"if run loaduimage; then " \
128 				"run mmcboot; " \
129 			"else run netboot; " \
130 			"fi; " \
131 		"fi; " \
132 	"else run netboot; fi"
133 
134 /* The rest of the configuration is shared */
135 #include <configs/mxs.h>
136 
137 #endif /* __CONFIGS_MX23_OLINUXINO_H__ */
138