xref: /rk3399_rockchip-uboot/include/configs/mx23_olinuxino.h (revision 5434caf5ba32d0779f309d7a8d13e985dc667f5b)
1 /*
2  * Copyright (C) 2013 Marek Vasut <marex@denx.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17  * MA 02111-1307 USA
18  */
19 #ifndef __CONFIGS_MX23_OLINUXINO_H__
20 #define __CONFIGS_MX23_OLINUXINO_H__
21 
22 /* System configurations */
23 #define CONFIG_MX23				/* i.MX23 SoC */
24 #define CONFIG_MACH_TYPE	4105
25 
26 /* U-Boot Commands */
27 #define CONFIG_SYS_NO_FLASH
28 #include <config_cmd_default.h>
29 #define CONFIG_DISPLAY_CPUINFO
30 #define CONFIG_DOS_PARTITION
31 
32 #define CONFIG_CMD_CACHE
33 #define CONFIG_CMD_DHCP
34 #define CONFIG_CMD_EXT2
35 #define CONFIG_CMD_FAT
36 #define CONFIG_CMD_GPIO
37 #define CONFIG_CMD_LED
38 #define CONFIG_CMD_MMC
39 #define CONFIG_CMD_NET
40 #define CONFIG_CMD_USB
41 
42 /* Memory configuration */
43 #define CONFIG_NR_DRAM_BANKS		1		/* 1 bank of DRAM */
44 #define PHYS_SDRAM_1			0x40000000	/* Base address */
45 #define PHYS_SDRAM_1_SIZE		0x08000000	/* Max 128 MB RAM */
46 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
47 
48 /* Environment */
49 #define CONFIG_ENV_IS_IN_MMC
50 #define CONFIG_ENV_OVERWRITE
51 
52 /* Environment is in MMC */
53 #if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
54 #define CONFIG_ENV_OFFSET	(256 * 1024)
55 #define CONFIG_ENV_SIZE		(16 * 1024)
56 #define CONFIG_SYS_MMC_ENV_DEV	0
57 #endif
58 
59 /* Status LED */
60 #define CONFIG_STATUS_LED
61 #define CONFIG_GPIO_LED
62 #define CONFIG_BOARD_SPECIFIC_LED
63 #define STATUS_LED_BOOT		0
64 #define STATUS_LED_BIT		MX23_PAD_SSP1_DETECT__GPIO_2_1
65 #define STATUS_LED_STATE	STATUS_LED_ON
66 #define STATUS_LED_PERIOD	(CONFIG_SYS_HZ / 2)
67 
68 /* USB */
69 #ifdef CONFIG_CMD_USB
70 #define CONFIG_EHCI_MXS_PORT0
71 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
72 #define CONFIG_USB_STORAGE
73 #endif
74 
75 /* Ethernet */
76 #ifdef CONFIG_CMD_NET
77 #define CONFIG_USB_HOST_ETHER
78 #define CONFIG_USB_ETHER_SMSC95XX
79 #endif
80 
81 /* Booting Linux */
82 #define CONFIG_BOOTDELAY	3
83 #define CONFIG_BOOTFILE		"uImage"
84 #define CONFIG_LOADADDR		0x42000000
85 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
86 
87 /* Extra Environment */
88 #define CONFIG_EXTRA_ENV_SETTINGS \
89 	"update_sd_firmware_filename=u-boot.sd\0" \
90 	"update_sd_firmware="		/* Update the SD firmware partition */ \
91 		"if mmc rescan ; then "	\
92 		"if tftp ${update_sd_firmware_filename} ; then " \
93 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
94 		"setexpr fw_sz ${fw_sz} + 1 ; "	\
95 		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
96 		"fi ; "	\
97 		"fi\0" \
98 	"script=boot.scr\0"	\
99 	"uimage=uImage\0" \
100 	"console=ttyAMA0\0" \
101 	"fdt_file=imx23-olinuxino.dtb\0" \
102 	"fdt_addr=0x41000000\0" \
103 	"boot_fdt=try\0" \
104 	"ip_dyn=yes\0" \
105 	"mmcdev=0\0" \
106 	"mmcpart=2\0" \
107 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
108 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
109 		"root=${mmcroot}\0" \
110 	"loadbootscript="  \
111 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
112 	"bootscript=echo Running bootscript from mmc ...; "	\
113 		"source\0" \
114 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
115 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
116 	"mmcboot=echo Booting from mmc ...; " \
117 		"run mmcargs; " \
118 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
119 			"if run loadfdt; then " \
120 				"bootm ${loadaddr} - ${fdt_addr}; " \
121 			"else " \
122 				"if test ${boot_fdt} = try; then " \
123 					"bootm; " \
124 				"else " \
125 					"echo WARN: Cannot load the DT; " \
126 				"fi; " \
127 			"fi; " \
128 		"else " \
129 			"bootm; " \
130 		"fi;\0" \
131 	"netargs=setenv bootargs console=${console},${baudrate} " \
132 		"root=/dev/nfs " \
133 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
134 	"netboot=echo Booting from net ...; " \
135 		"usb start; " \
136 		"run netargs; "	\
137 		"if test ${ip_dyn} = yes; then " \
138 			"setenv get_cmd dhcp; " \
139 		"else " \
140 			"setenv get_cmd tftp; " \
141 		"fi; " \
142 		"${get_cmd} ${uimage}; " \
143 		"if test ${boot_fdt} = yes; then " \
144 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
145 				"bootm ${loadaddr} - ${fdt_addr}; " \
146 			"else " \
147 				"if test ${boot_fdt} = try; then " \
148 					"bootm; " \
149 				"else " \
150 					"echo WARN: Cannot load the DT; " \
151 				"fi;" \
152 			"fi; " \
153 		"else " \
154 			"bootm; " \
155 		"fi;\0"
156 
157 #define CONFIG_BOOTCOMMAND \
158 	"mmc dev ${mmcdev}; if mmc rescan; then " \
159 		"if run loadbootscript; then " \
160 			"run bootscript; " \
161 		"else " \
162 			"if run loaduimage; then " \
163 				"run mmcboot; " \
164 			"else run netboot; " \
165 			"fi; " \
166 		"fi; " \
167 	"else run netboot; fi"
168 
169 /* The rest of the configuration is shared */
170 #include <configs/mxs.h>
171 
172 #endif /* __CONFIGS_MX23_OLINUXINO_H__ */
173