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