xref: /openbmc/u-boot/include/configs/opos6uldev.h (revision d891ab95)
1 /*
2  * Copyright (C) 2017 Armadeus Systems
3  *
4  * Configuration settings for the OPOS6ULDev board
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #ifndef __OPOS6ULDEV_CONFIG_H
10 #define __OPOS6ULDEV_CONFIG_H
11 
12 #include "mx6_common.h"
13 
14 #ifdef CONFIG_SPL
15 #include "imx6_spl.h"
16 
17 #ifdef CONFIG_SPL_BUILD
18 #undef CONFIG_DM_GPIO
19 #undef CONFIG_DM_MMC
20 
21 #define CONFIG_MXC_UART_BASE		UART1_BASE
22 #endif
23 #endif
24 
25 /* Size of malloc() pool */
26 #define CONFIG_SYS_MALLOC_LEN		(16 << 20)
27 
28 /* Miscellaneous configurable options */
29 #define CONFIG_STANDALONE_LOAD_ADDR	CONFIG_SYS_LOAD_ADDR
30 
31 /* Physical Memory Map */
32 #define CONFIG_NR_DRAM_BANKS		1
33 #define CONFIG_SYS_SDRAM_BASE		MMDC0_ARB_BASE_ADDR
34 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
35 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
36 #define CONFIG_SYS_INIT_SP_OFFSET \
37 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
38 #define CONFIG_SYS_INIT_SP_ADDR \
39 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
40 
41 /* MMC */
42 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
43 #define CONFIG_SUPPORT_EMMC_BOOT
44 
45 /* USB */
46 #ifdef CONFIG_USB_EHCI_MX6
47 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
48 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
49 #define CONFIG_MXC_USB_FLAGS		0
50 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
51 #define CONFIG_USB_FUNCTION_MASS_STORAGE
52 #endif
53 
54 /* Ethernet */
55 #ifdef CONFIG_FEC_MXC
56 #define IMX_FEC_BASE			ENET_BASE_ADDR
57 #define CONFIG_FEC_MXC_PHYADDR          0x1
58 #define CONFIG_FEC_XCV_TYPE             RMII
59 #define CONFIG_ETHPRIME			"FEC"
60 #define CONFIG_MII
61 #endif
62 
63 /* LCD */
64 #ifdef CONFIG_VIDEO
65 #define CONFIG_VIDEO_LOGO
66 #define CONFIG_SPLASH_SCREEN
67 #define CONFIG_SPLASH_SCREEN_ALIGN
68 #define CONFIG_SPLASH_SOURCE
69 #define CONFIG_VIDEO_BMP_RLE8
70 #define CONFIG_VIDEO_BMP_LOGO
71 #define CONFIG_CMD_BMP
72 #define CONFIG_BMP_16BPP
73 #define CONFIG_VIDEO_MXS
74 #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR
75 #endif
76 
77 /* Environment is stored in the eMMC boot partition */
78 #define CONFIG_ENV_IS_IN_MMC
79 #define CONFIG_SYS_MMC_ENV_DEV          0
80 #define CONFIG_SYS_MMC_ENV_PART         1
81 #define CONFIG_ENV_SIZE                 (10 * 1024)
82 #define CONFIG_ENV_OFFSET               (1024 * 1024) /* 1 MB */
83 #define CONFIG_ENV_OFFSET_REDUND        (1536 * 1024) /* 512KB from CONFIG_ENV_OFFSET */
84 
85 #define CONFIG_ENV_VERSION	100
86 #define CONFIG_BOARD_NAME	opos6ul
87 #define ACFG_CONSOLE_DEV        ttymxc0
88 #define CONFIG_SYS_AUTOLOAD     "no"
89 #define CONFIG_ROOTPATH         "/tftpboot/" __stringify(CONFIG_BOARD_NAME) "-root"
90 #define CONFIG_BOOTARGS         "console=" __stringify(ACFG_CONSOLE_DEV) "," __stringify(CONFIG_BAUDRATE)
91 #define CONFIG_PREBOOT          "run check_env"
92 #define CONFIG_BOOTCOMMAND	"run emmcboot"
93 
94 #define CONFIG_EXTRA_ENV_SETTINGS \
95 	"env_version="          __stringify(CONFIG_ENV_VERSION)         "\0"                    \
96 	"consoledev="           __stringify(ACFG_CONSOLE_DEV)           "\0"                    \
97 	"board_name="           __stringify(CONFIG_BOARD_NAME)          "\0"                    \
98 	"fdt_addr=0x88000000\0"                                                                 \
99 	"fdt_high=0xffffffff\0"                                                                 \
100 	"fdt_name="           __stringify(CONFIG_BOARD_NAME)          "dev\0"                   \
101 	"initrd_high=0xffffffff\0"                                                              \
102 	"ip_dyn=yes\0"                                                                          \
103 	"stdin=serial\0"                                                                        \
104 	"stdout=serial\0"                                                                       \
105 	"stderr=serial\0"                                                                       \
106 	"mmcdev=0\0"                                                                            \
107 	"mmcpart=2\0"                                                                           \
108 	"mmcroot=/dev/mmcblk0p2 ro\0"                                                           \
109 	"mmcrootfstype=ext4 rootwait\0"                                                         \
110 	"kernelimg="           __stringify(CONFIG_BOARD_NAME)          "-linux.bin\0"           \
111 	"videomode=video=ctfb:x:800,y:480,depth:18,pclk:33033,le:96,ri:96,up:20,lo:21,hs:64,vs:4,sync:0,vmode:0\0" \
112 	"check_env=if test -n ${flash_env_version}; "                                           \
113 		"then env default env_version; "                                                \
114 		"else env set flash_env_version ${env_version}; env save; "                     \
115 		"fi; "                                                                          \
116 		"if itest ${flash_env_version} != ${env_version}; then "                        \
117 			"echo \"*** Warning - Environment version"                              \
118 			" change suggests: run flash_reset_env; reset\"; "                      \
119 			"env default flash_reset_env; "                                         \
120 		"else exit; fi; \0"                                                             \
121 	"flash_reset_env=env default -f -a && saveenv && "                                      \
122 		"echo Environment variables erased!\0"                                          \
123 	"download_uboot_spl=tftpboot ${loadaddr} ${board_name}-u-boot.spl\0"                    \
124 	"flash_uboot_spl="                                                                      \
125 		"if mmc dev 0 1; then "                                                         \
126 			"setexpr sz ${filesize} / 0x200; "                                      \
127 			"setexpr sz ${sz} + 1; "                                                \
128 			"if mmc write ${loadaddr} 0x2 ${sz}; then "                             \
129 				"echo Flashing of U-boot SPL succeed; "                         \
130 			"else echo Flashing of U-boot SPL failed; "                             \
131 			"fi; "                                                                  \
132 		"fi;\0"                                                                         \
133 	"download_uboot_img=tftpboot ${loadaddr} ${board_name}-u-boot.img\0"                    \
134 	"flash_uboot_img="                                                                      \
135 		"if mmc dev 0 1; then "                                                         \
136 			"setexpr sz ${filesize} / 0x200; "                                      \
137 			"setexpr sz ${sz} + 1; "                                                \
138 			"if mmc write ${loadaddr} 0x8a ${sz}; then "                            \
139 				"echo Flashing of U-boot image succeed; "                       \
140 			"else echo Flashing of U-boot image failed; "                           \
141 			"fi; "                                                                  \
142 		"fi;\0"                                                                         \
143 	"update_uboot=run download_uboot_spl flash_uboot_spl "                                  \
144 		"download_uboot_img flash_uboot_img\0"                                          \
145 	"download_kernel=tftpboot ${loadaddr} ${kernelimg}\0"                                   \
146 	"flash_kernel="                                                                         \
147 		"if ext4write mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} ${filesize}; then "    \
148 			"echo kernel update succeed; "                                          \
149 			"else echo kernel update failed; "                                      \
150 		"fi;\0"                                                                         \
151 	"update_kernel=run download_kernel flash_kernel\0"                                      \
152 	"download_dtb=tftpboot ${fdt_addr} imx6ul-${fdt_name}.dtb\0"                            \
153 	"flash_dtb="                                                                            \
154 		"if ext4write mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb ${filesize}; then " \
155 			"echo dtb update succeed; "                                             \
156 			"else echo dtb update in failed; "                                      \
157 		"fi;\0"                                                                         \
158 	"update_dtb=run download_dtb flash_dtb\0"                                               \
159 	"download_rootfs=tftpboot ${loadaddr} ${board_name}-rootfs.ext4\0"                      \
160 	"flash_rootfs="                                                                         \
161 		"if mmc dev 0 0; then "                                                         \
162 			"setexpr nbblocks ${filesize} / 0x200; "                                \
163 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
164 			"if mmc write ${loadaddr} 0x40800 ${nbblocks}; then "                   \
165 				"echo Flashing of rootfs image succeed; "                       \
166 			"else echo Flashing of rootfs image failed; "                           \
167 			"fi; "                                                                  \
168 		"fi;\0"                                                                         \
169 	"update_rootfs=run download_rootfs flash_rootfs\0"                                      \
170 	"flash_failsafe="                                                                       \
171 		"if mmc dev 0 0; then "                                                         \
172 			"setexpr nbblocks ${filesize} / 0x200; "                                \
173 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
174 			"if mmc write ${loadaddr} 0x800 ${nbblocks}; then "                     \
175 				"echo Flashing of rootfs image in failsafe partition succeed; " \
176 			"else echo Flashing of rootfs image in failsafe partition failed; "     \
177 			"fi; "                                                                  \
178 		"fi;\0"                                                                         \
179 	"update_failsafe=run download_rootfs flash_failsafe\0"                                  \
180 	"download_userdata=tftpboot ${loadaddr} ${board_name}-user_data.ext4\0"                 \
181 	"flash_userdata="                                                                       \
182 		"if mmc dev 0 0; then "                                                         \
183 			"setexpr nbblocks ${filesize} / 0x200; "                                \
184 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
185 			"if mmc write ${loadaddr} 0 ${nbblocks}; then "                         \
186 				"echo Flashing of user_data image succeed; "                    \
187 			"else echo Flashing of user_data image failed; "                        \
188 			"fi; "                                                                  \
189 		"fi;\0"                                                                         \
190 	"update_userdata=run download_userdata flash_userdata; mmc rescan\0"                    \
191 	"erase_userdata="                                                                       \
192 		"if mmc dev 0 0; then "                                                         \
193 			"echo Erasing eMMC User Data partition, no way out...; "                \
194 			"mw ${loadaddr} 0 0x200000; "                                           \
195 			"mmc write ${loadaddr} 0 0x1000; "                                      \
196 			"mmc write ${loadaddr} 0x800 0x1000; "                                  \
197 			"mmc write ${loadaddr} 0x40800 0x1000; "                                \
198 			"mmc write ${loadaddr} 0x440800 0x1000; "                               \
199 		"fi;"                                                                           \
200 		"mmc rescan\0"                                                                  \
201 	"update_all=run update_rootfs update_uboot\0"						\
202 	"initargs=setenv bootargs console=${consoledev},${baudrate} ${extrabootargs}\0"         \
203 	"addipargs=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:"                       \
204 		"${gatewayip}:${netmask}:${hostname}:eth0:off\0"                                \
205 	"addmmcargs=setenv bootargs ${bootargs} root=${mmcroot} "                               \
206 		"rootfstype=${mmcrootfstype}\0"                                                 \
207 	"emmcboot=run initargs; run addmmcargs; "                                               \
208 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} && "              \
209 		"load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb && "    \
210 		"bootz ${loadaddr} - ${fdt_addr};\0"                                            \
211 	"emmcsafeboot=setenv mmcpart 1; setenv mmcroot /dev/mmcblk0p1 ro; run emmcboot;\0"      \
212 	"addnfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw "                              \
213 		"nfsroot=${serverip}:${rootpath}\0"                                             \
214 	"nfsboot=run initargs; run addnfsargs addipargs; "                                      \
215 		"nfs ${loadaddr} ${serverip}:${rootpath}/boot/${kernelimg} && "                 \
216 		"nfs ${fdt_addr} ${serverip}:${rootpath}/boot/imx6ul-${fdt_name}.dtb && "       \
217 		"bootz ${loadaddr} - ${fdt_addr};\0"
218 
219 #endif /* __OPOS6ULDEV_CONFIG_H */
220