1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2012 Freescale Semiconductor, Inc.
4  *
5  * Configuration settings for the Freescale i.MX6Q SabreSD board.
6  */
7 
8 #ifndef __MX6QSABRE_COMMON_CONFIG_H
9 #define __MX6QSABRE_COMMON_CONFIG_H
10 
11 #include <linux/stringify.h>
12 
13 #include "mx6_common.h"
14 
15 /* Size of malloc() pool */
16 #define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
17 
18 /* MMC Configs */
19 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
20 
21 #ifdef CONFIG_SUPPORT_EMMC_BOOT
22 #define EMMC_ENV \
23 	"emmcdev=2\0" \
24 	"update_emmc_firmware=" \
25 		"if test ${ip_dyn} = yes; then " \
26 			"setenv get_cmd dhcp; " \
27 		"else " \
28 			"setenv get_cmd tftp; " \
29 		"fi; " \
30 		"if ${get_cmd} ${update_sd_firmware_filename}; then " \
31 			"if mmc dev ${emmcdev} 1; then "	\
32 				"setexpr fw_sz ${filesize} / 0x200; " \
33 				"setexpr fw_sz ${fw_sz} + 1; "	\
34 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
35 			"fi; "	\
36 		"fi\0"
37 #else
38 #define EMMC_ENV ""
39 #endif
40 
41 #define CONFIG_EXTRA_ENV_SETTINGS \
42 	"script=boot.scr\0" \
43 	"image=zImage\0" \
44 	"fdtfile=undefined\0" \
45 	"fdt_addr=0x18000000\0" \
46 	"boot_fdt=try\0" \
47 	"ip_dyn=yes\0" \
48 	"console=" CONSOLE_DEV "\0" \
49 	"dfuspi=dfu 0 sf 0:0:10000000:0\0" \
50 	"dfu_alt_info_spl=spl raw 0x400\0" \
51 	"dfu_alt_info_img=u-boot raw 0x10000\0" \
52 	"dfu_alt_info=spl raw 0x400\0" \
53 	"fdt_high=0xffffffff\0"	  \
54 	"initrd_high=0xffffffff\0" \
55 	"splashimage=" __stringify(CONFIG_LOADADDR) "\0" \
56 	"mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
57 	"mmcpart=1\0" \
58 	"finduuid=part uuid mmc ${mmcdev}:2 uuid\0" \
59 	"update_sd_firmware=" \
60 		"if test ${ip_dyn} = yes; then " \
61 			"setenv get_cmd dhcp; " \
62 		"else " \
63 			"setenv get_cmd tftp; " \
64 		"fi; " \
65 		"if mmc dev ${mmcdev}; then "	\
66 			"if ${get_cmd} ${update_sd_firmware_filename}; then " \
67 				"setexpr fw_sz ${filesize} / 0x200; " \
68 				"setexpr fw_sz ${fw_sz} + 1; "	\
69 				"mmc write ${loadaddr} 0x2 ${fw_sz}; " \
70 			"fi; "	\
71 		"fi\0" \
72 	EMMC_ENV	  \
73 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
74 		"root=PARTUUID=${uuid} rootwait rw\0" \
75 	"loadbootscript=" \
76 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script} || " \
77 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${script};\0" \
78 	"bootscript=echo Running bootscript from mmc ...; " \
79 		"source\0" \
80 	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} || " \
81 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} boot/${image}\0" \
82 	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdtfile} || " \
83 		"load mmc ${mmcdev}:${mmcpart} ${fdt_addr} boot/${fdtfile}\0" \
84 	"mmcboot=echo Booting from mmc ...; " \
85 		"run finduuid; " \
86 		"run mmcargs; " \
87 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
88 			"if run loadfdt; then " \
89 				"bootz ${loadaddr} - ${fdt_addr}; " \
90 			"else " \
91 				"if test ${boot_fdt} = try; then " \
92 					"bootz; " \
93 				"else " \
94 					"echo WARN: Cannot load the DT; " \
95 				"fi; " \
96 			"fi; " \
97 		"else " \
98 			"bootz; " \
99 		"fi;\0" \
100 	"netargs=setenv bootargs console=${console},${baudrate} " \
101 		"root=/dev/nfs " \
102 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
103 	"netboot=echo Booting from net ...; " \
104 		"run netargs; " \
105 		"if test ${ip_dyn} = yes; then " \
106 			"setenv get_cmd dhcp; " \
107 		"else " \
108 			"setenv get_cmd tftp; " \
109 		"fi; " \
110 		"${get_cmd} ${image}; " \
111 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
112 			"if ${get_cmd} ${fdt_addr} ${fdtfile}; then " \
113 				"bootz ${loadaddr} - ${fdt_addr}; " \
114 			"else " \
115 				"if test ${boot_fdt} = try; then " \
116 					"bootz; " \
117 				"else " \
118 					"echo WARN: Cannot load the DT; " \
119 				"fi; " \
120 			"fi; " \
121 		"else " \
122 			"bootz; " \
123 		"fi;\0" \
124 		"findfdt="\
125 			"if test $fdtfile = undefined; then " \
126 				"if test $board_name = SABREAUTO && test $board_rev = MX6QP; then " \
127 					"setenv fdtfile imx6qp-sabreauto.dtb; fi; " \
128 				"if test $board_name = SABREAUTO && test $board_rev = MX6Q; then " \
129 					"setenv fdtfile imx6q-sabreauto.dtb; fi; " \
130 				"if test $board_name = SABREAUTO && test $board_rev = MX6DL; then " \
131 					"setenv fdtfile imx6dl-sabreauto.dtb; fi; " \
132 				"if test $board_name = SABRESD && test $board_rev = MX6QP; then " \
133 					"setenv fdtfile imx6qp-sabresd.dtb; fi; " \
134 				"if test $board_name = SABRESD && test $board_rev = MX6Q; then " \
135 					"setenv fdtfile imx6q-sabresd.dtb; fi; " \
136 				"if test $board_name = SABRESD && test $board_rev = MX6DL; then " \
137 					"setenv fdtfile imx6dl-sabresd.dtb; fi; " \
138 				"if test $fdtfile = undefined; then " \
139 					"echo WARNING: Could not determine dtb to use; fi; " \
140 			"fi;\0" \
141 
142 #define CONFIG_BOOTCOMMAND \
143 	"run findfdt;" \
144 	"mmc dev ${mmcdev};" \
145 	"if mmc rescan; then " \
146 		"if run loadbootscript; then " \
147 		"run bootscript; " \
148 		"else " \
149 			"if run loadimage; then " \
150 				"run mmcboot; " \
151 			"else run netboot; " \
152 			"fi; " \
153 		"fi; " \
154 	"else run netboot; fi"
155 
156 #define CONFIG_ARP_TIMEOUT     200UL
157 
158 /* Physical Memory Map */
159 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
160 
161 #define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM
162 #define CONFIG_SYS_INIT_RAM_ADDR       IRAM_BASE_ADDR
163 #define CONFIG_SYS_INIT_RAM_SIZE       IRAM_SIZE
164 
165 #define CONFIG_SYS_INIT_SP_OFFSET \
166 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
167 #define CONFIG_SYS_INIT_SP_ADDR \
168 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
169 
170 /* Environment organization */
171 
172 /* Framebuffer */
173 #define CONFIG_VIDEO_LOGO
174 #define CONFIG_VIDEO_BMP_LOGO
175 #define CONFIG_IMX_HDMI
176 #define CONFIG_IMX_VIDEO_SKIP
177 
178 #define CONFIG_USBD_HS
179 
180 #endif                         /* __MX6QSABRE_COMMON_CONFIG_H */
181