1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 Amarula Solutions B.V.
4  * Copyright (C) 2016 Engicam S.r.l.
5  *
6  * Configuration settings for the Engicam i.MX6 SOM Starter Kits.
7  */
8 
9 #ifndef __IMX6_ENGICAM_CONFIG_H
10 #define __IMX6_ENGICAM_CONFIG_H
11 
12 #include <linux/sizes.h>
13 #include <linux/stringify.h>
14 #include "mx6_common.h"
15 
16 /* Size of malloc() pool */
17 #define CONFIG_SYS_MALLOC_LEN		(16 * SZ_1M)
18 
19 /* Total Size of Environment Sector */
20 
21 /* Environment */
22 #ifndef CONFIG_ENV_IS_NOWHERE
23 /* Environment in MMC */
24 # if defined(CONFIG_ENV_IS_IN_MMC)
25 /* Environment in NAND */
26 # endif
27 #endif
28 
29 /* Default environment */
30 #define CONFIG_EXTRA_ENV_SETTINGS \
31 	"script=boot.scr\0" \
32 	"splashpos=m,m\0" \
33 	"splashimage=" __stringify(CONFIG_LOADADDR) "\0" \
34 	"image=uImage\0" \
35 	"fit_image=fit.itb\0" \
36 	"fdt_high=0xffffffff\0" \
37 	"fdt_addr=" FDT_ADDR "\0" \
38 	"boot_fdt=try\0" \
39 	"mmcpart=1\0" \
40 	"nandroot=ubi0:rootfs rootfstype=ubifs\0" \
41 	"mmcautodetect=yes\0" \
42 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
43 		"root=${mmcroot}\0" \
44 	"ubiargs=setenv bootargs console=${console},${baudrate} " \
45 		"ubi.mtd=5 root=${nandroot} ${mtdparts}\0" \
46 	"loadbootscript=" \
47 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
48 	"bootscript=echo Running bootscript from mmc ...; " \
49 		"source\0" \
50 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
51 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
52 	"loadfit=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${fit_image}\0" \
53 	"altbootcmd=run recoveryboot\0"\
54 	"fitboot=echo Booting FIT image from mmc ...; " \
55 		"run mmcargs; " \
56 		"bootm ${loadaddr}\0" \
57 	"_mmcboot=run mmcargs; " \
58 		"run mmcargs; " \
59 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
60 			"if run loadfdt; then " \
61 				"bootm ${loadaddr} - ${fdt_addr}; " \
62 			"else " \
63 				"if test ${boot_fdt} = try; then " \
64 					"bootm; " \
65 				"else " \
66 					"echo WARN: Cannot load the DT; " \
67 				"fi; " \
68 			"fi; " \
69 		"else " \
70 			"bootm; " \
71 		"fi\0" \
72 	"mmcboot=echo Booting from mmc ...; " \
73 		"if mmc rescan; then " \
74 			"if run loadbootscript; then " \
75 				"run bootscript; " \
76 			"else " \
77 				"if run loadfit; then " \
78 					"run fitboot; " \
79 				"else " \
80 					"if run loadimage; then " \
81 						"run _mmcboot; " \
82 					"fi; " \
83 				"fi; " \
84 			"fi; " \
85 		"fi\0" \
86 	"nandboot=echo Booting from nand ...; " \
87 		"if mtdparts; then " \
88 			"echo Starting nand boot ...; " \
89 		"else " \
90 			"mtdparts default; " \
91 		"fi; " \
92 		"run ubiargs; " \
93 		"nand read ${loadaddr} kernel 0x800000; " \
94 		"nand read ${fdt_addr} dtb 0x100000; " \
95 		"bootm ${loadaddr} - ${fdt_addr}\0" \
96 	"recoveryboot=if test ${modeboot} = mmcboot; then " \
97 			"run mmcboot; " \
98 		"else " \
99 			"run nandboot; " \
100 		"fi\0"
101 
102 #define CONFIG_BOOTCOMMAND		"run $modeboot"
103 
104 /* Miscellaneous configurable options */
105 
106 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
107 #define CONFIG_SYS_HZ			1000
108 
109 #ifdef CONFIG_MX6UL
110 # define DRAM_OFFSET(x)			0x87##x
111 # define FDT_ADDR			__stringify(DRAM_OFFSET(800000))
112 #else
113 # define DRAM_OFFSET(x)			0x1##x
114 # define FDT_ADDR			__stringify(DRAM_OFFSET(8000000))
115 #endif
116 
117 /* Physical Memory Map */
118 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
119 
120 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
121 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
122 #define CONFIG_SYS_INIT_RAM_SIZE	IRAM_SIZE
123 
124 #define CONFIG_SYS_INIT_SP_OFFSET	(CONFIG_SYS_INIT_RAM_SIZE - \
125 					GENERATED_GBL_DATA_SIZE)
126 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INIT_RAM_ADDR + \
127 					CONFIG_SYS_INIT_SP_OFFSET)
128 
129 /* UART */
130 #ifdef CONFIG_MXC_UART
131 # ifdef CONFIG_MX6UL
132 #  define CONFIG_MXC_UART_BASE		UART1_BASE
133 # else
134 #  define CONFIG_MXC_UART_BASE		UART4_BASE
135 # endif
136 #endif
137 
138 /* MMC */
139 
140 /* NAND */
141 #ifdef CONFIG_NAND_MXS
142 # define CONFIG_SYS_MAX_NAND_DEVICE	1
143 # define CONFIG_SYS_NAND_BASE		0x40000000
144 # define CONFIG_SYS_NAND_5_ADDR_CYCLE
145 # define CONFIG_SYS_NAND_ONFI_DETECTION
146 # define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
147 # define CONFIG_SYS_NAND_U_BOOT_OFFS	0x200000
148 
149 /* MTD device */
150 #endif
151 
152 /* Falcon Mode */
153 #ifdef CONFIG_SPL_OS_BOOT
154 # define CONFIG_SPL_FS_LOAD_ARGS_NAME	"args"
155 # define CONFIG_SPL_FS_LOAD_KERNEL_NAME	"uImage"
156 # define CONFIG_SYS_SPL_ARGS_ADDR	0x18000000
157 
158 /* MMC support: args@1MB kernel@2MB */
159 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR		0x800   /* 1MB */
160 # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS		(CONFIG_CMD_SPL_WRITE_SIZE / 512)
161 # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x1000  /* 2MB */
162 #endif
163 
164 /* Framebuffer */
165 #ifdef CONFIG_VIDEO_IPUV3
166 # define CONFIG_IMX_VIDEO_SKIP
167 
168 # define CONFIG_VIDEO_LOGO
169 # define CONFIG_VIDEO_BMP_LOGO
170 #endif
171 
172 /* SPL */
173 #ifdef CONFIG_SPL
174 # ifdef CONFIG_ENV_IS_IN_NAND
175 #  define CONFIG_SPL_NAND_SUPPORT
176 # else
177 #  define CONFIG_SPL_MMC_SUPPORT
178 # endif
179 
180 # include "imx6_spl.h"
181 #endif
182 
183 #endif /* __IMX6_ENGICAM_CONFIG_H */
184