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