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