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