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