xref: /openbmc/u-boot/include/configs/opos6uldev.h (revision d9b23e26)
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_BMP_16BPP
72 #define CONFIG_VIDEO_MXS
73 #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR
74 #endif
75 
76 /* Environment is stored in the eMMC boot partition */
77 #define CONFIG_SYS_MMC_ENV_DEV          0
78 #define CONFIG_SYS_MMC_ENV_PART         1
79 #define CONFIG_ENV_SIZE                 (10 * 1024)
80 #define CONFIG_ENV_OFFSET               (1024 * 1024) /* 1 MB */
81 #define CONFIG_ENV_OFFSET_REDUND        (1536 * 1024) /* 512KB from CONFIG_ENV_OFFSET */
82 
83 #define CONFIG_ENV_VERSION	100
84 #define CONFIG_BOARD_NAME	opos6ul
85 #define ACFG_CONSOLE_DEV        ttymxc0
86 #define CONFIG_SYS_AUTOLOAD     "no"
87 #define CONFIG_ROOTPATH         "/tftpboot/" __stringify(CONFIG_BOARD_NAME) "-root"
88 #define CONFIG_PREBOOT          "run check_env"
89 #define CONFIG_BOOTCOMMAND	"run emmcboot"
90 
91 #define CONFIG_EXTRA_ENV_SETTINGS \
92 	"env_version="          __stringify(CONFIG_ENV_VERSION)         "\0"                    \
93 	"consoledev="           __stringify(ACFG_CONSOLE_DEV)           "\0"                    \
94 	"board_name="           __stringify(CONFIG_BOARD_NAME)          "\0"                    \
95 	"fdt_addr=0x88000000\0"                                                                 \
96 	"fdt_high=0xffffffff\0"                                                                 \
97 	"fdt_name="           __stringify(CONFIG_BOARD_NAME)          "dev\0"                   \
98 	"initrd_high=0xffffffff\0"                                                              \
99 	"ip_dyn=yes\0"                                                                          \
100 	"stdin=serial\0"                                                                        \
101 	"stdout=serial\0"                                                                       \
102 	"stderr=serial\0"                                                                       \
103 	"mmcdev=0\0"                                                                            \
104 	"mmcpart=2\0"                                                                           \
105 	"mmcroot=/dev/mmcblk0p2 ro\0"                                                           \
106 	"mmcrootfstype=ext4 rootwait\0"                                                         \
107 	"kernelimg="           __stringify(CONFIG_BOARD_NAME)          "-linux.bin\0"           \
108 	"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" \
109 	"check_env=if test -n ${flash_env_version}; "                                           \
110 		"then env default env_version; "                                                \
111 		"else env set flash_env_version ${env_version}; env save; "                     \
112 		"fi; "                                                                          \
113 		"if itest ${flash_env_version} != ${env_version}; then "                        \
114 			"echo \"*** Warning - Environment version"                              \
115 			" change suggests: run flash_reset_env; reset\"; "                      \
116 			"env default flash_reset_env; "                                         \
117 		"else exit; fi; \0"                                                             \
118 	"flash_reset_env=env default -f -a && saveenv && "                                      \
119 		"echo Environment variables erased!\0"                                          \
120 	"download_uboot_spl=tftpboot ${loadaddr} ${board_name}-u-boot.spl\0"                    \
121 	"flash_uboot_spl="                                                                      \
122 		"if mmc dev 0 1; then "                                                         \
123 			"setexpr sz ${filesize} / 0x200; "                                      \
124 			"setexpr sz ${sz} + 1; "                                                \
125 			"if mmc write ${loadaddr} 0x2 ${sz}; then "                             \
126 				"echo Flashing of U-boot SPL succeed; "                         \
127 			"else echo Flashing of U-boot SPL failed; "                             \
128 			"fi; "                                                                  \
129 		"fi;\0"                                                                         \
130 	"download_uboot_img=tftpboot ${loadaddr} ${board_name}-u-boot.img\0"                    \
131 	"flash_uboot_img="                                                                      \
132 		"if mmc dev 0 1; then "                                                         \
133 			"setexpr sz ${filesize} / 0x200; "                                      \
134 			"setexpr sz ${sz} + 1; "                                                \
135 			"if mmc write ${loadaddr} 0x8a ${sz}; then "                            \
136 				"echo Flashing of U-boot image succeed; "                       \
137 			"else echo Flashing of U-boot image failed; "                           \
138 			"fi; "                                                                  \
139 		"fi;\0"                                                                         \
140 	"update_uboot=run download_uboot_spl flash_uboot_spl "                                  \
141 		"download_uboot_img flash_uboot_img\0"                                          \
142 	"download_kernel=tftpboot ${loadaddr} ${kernelimg}\0"                                   \
143 	"flash_kernel="                                                                         \
144 		"if ext4write mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} ${filesize}; then "    \
145 			"echo kernel update succeed; "                                          \
146 			"else echo kernel update failed; "                                      \
147 		"fi;\0"                                                                         \
148 	"update_kernel=run download_kernel flash_kernel\0"                                      \
149 	"download_dtb=tftpboot ${fdt_addr} imx6ul-${fdt_name}.dtb\0"                            \
150 	"flash_dtb="                                                                            \
151 		"if ext4write mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb ${filesize}; then " \
152 			"echo dtb update succeed; "                                             \
153 			"else echo dtb update in failed; "                                      \
154 		"fi;\0"                                                                         \
155 	"update_dtb=run download_dtb flash_dtb\0"                                               \
156 	"download_rootfs=tftpboot ${loadaddr} ${board_name}-rootfs.ext4\0"                      \
157 	"flash_rootfs="                                                                         \
158 		"if mmc dev 0 0; then "                                                         \
159 			"setexpr nbblocks ${filesize} / 0x200; "                                \
160 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
161 			"if mmc write ${loadaddr} 0x40800 ${nbblocks}; then "                   \
162 				"echo Flashing of rootfs image succeed; "                       \
163 			"else echo Flashing of rootfs image failed; "                           \
164 			"fi; "                                                                  \
165 		"fi;\0"                                                                         \
166 	"update_rootfs=run download_rootfs flash_rootfs\0"                                      \
167 	"flash_failsafe="                                                                       \
168 		"if mmc dev 0 0; then "                                                         \
169 			"setexpr nbblocks ${filesize} / 0x200; "                                \
170 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
171 			"if mmc write ${loadaddr} 0x800 ${nbblocks}; then "                     \
172 				"echo Flashing of rootfs image in failsafe partition succeed; " \
173 			"else echo Flashing of rootfs image in failsafe partition failed; "     \
174 			"fi; "                                                                  \
175 		"fi;\0"                                                                         \
176 	"update_failsafe=run download_rootfs flash_failsafe\0"                                  \
177 	"download_userdata=tftpboot ${loadaddr} ${board_name}-user_data.ext4\0"                 \
178 	"flash_userdata="                                                                       \
179 		"if mmc dev 0 0; then "                                                         \
180 			"setexpr nbblocks ${filesize} / 0x200; "                                \
181 			"setexpr nbblocks ${nbblocks} + 1; "                                    \
182 			"if mmc write ${loadaddr} 0 ${nbblocks}; then "                         \
183 				"echo Flashing of user_data image succeed; "                    \
184 			"else echo Flashing of user_data image failed; "                        \
185 			"fi; "                                                                  \
186 		"fi;\0"                                                                         \
187 	"update_userdata=run download_userdata flash_userdata; mmc rescan\0"                    \
188 	"erase_userdata="                                                                       \
189 		"if mmc dev 0 0; then "                                                         \
190 			"echo Erasing eMMC User Data partition, no way out...; "                \
191 			"mw ${loadaddr} 0 0x200000; "                                           \
192 			"mmc write ${loadaddr} 0 0x1000; "                                      \
193 			"mmc write ${loadaddr} 0x800 0x1000; "                                  \
194 			"mmc write ${loadaddr} 0x40800 0x1000; "                                \
195 			"mmc write ${loadaddr} 0x440800 0x1000; "                               \
196 		"fi;"                                                                           \
197 		"mmc rescan\0"                                                                  \
198 	"update_all=run update_rootfs update_uboot\0"						\
199 	"initargs=setenv bootargs console=${consoledev},${baudrate} ${extrabootargs}\0"         \
200 	"addipargs=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:"                       \
201 		"${gatewayip}:${netmask}:${hostname}:eth0:off\0"                                \
202 	"addmmcargs=setenv bootargs ${bootargs} root=${mmcroot} "                               \
203 		"rootfstype=${mmcrootfstype}\0"                                                 \
204 	"emmcboot=run initargs; run addmmcargs; "                                               \
205 		"load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${kernelimg} && "              \
206 		"load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/imx6ul-${fdt_name}.dtb && "    \
207 		"bootz ${loadaddr} - ${fdt_addr};\0"                                            \
208 	"emmcsafeboot=setenv mmcpart 1; setenv mmcroot /dev/mmcblk0p1 ro; run emmcboot;\0"      \
209 	"addnfsargs=setenv bootargs ${bootargs} root=/dev/nfs rw "                              \
210 		"nfsroot=${serverip}:${rootpath}\0"                                             \
211 	"nfsboot=run initargs; run addnfsargs addipargs; "                                      \
212 		"nfs ${loadaddr} ${serverip}:${rootpath}/boot/${kernelimg} && "                 \
213 		"nfs ${fdt_addr} ${serverip}:${rootpath}/boot/imx6ul-${fdt_name}.dtb && "       \
214 		"bootz ${loadaddr} - ${fdt_addr};\0"
215 
216 #endif /* __OPOS6ULDEV_CONFIG_H */
217