ARM: imx: Convert mccmon6 to use DM/DTS in the u-boot proper
[platform/kernel/u-boot.git] / include / configs / mccmon6.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016-2017
4  * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5  */
6
7 #ifndef __CONFIG_H
8 #define __CONFIG_H
9
10 #include "mx6_common.h"
11
12 #define CONFIG_SPL_LIBCOMMON_SUPPORT
13 #include "imx6_spl.h"
14
15 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
16 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
17 #define CONFIG_SPL_OS_BOOT
18 #define CONFIG_SYS_OS_BASE (CONFIG_SYS_FLASH_BASE + 0x180000)
19 #define CONFIG_SYS_FDT_BASE (CONFIG_SYS_FLASH_BASE + 0x1980000)
20 #define CONFIG_SYS_FDT_SIZE (48 * SZ_1K)
21 #define CONFIG_SYS_SPL_ARGS_ADDR        0x18000000
22
23 /*
24  * Below defines are set but NOT really used since we by
25  * design force U-Boot run when we boot in development
26  * mode from SD card (SD2)
27  */
28 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
29 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
30 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
31 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
32 #define CONFIG_SPL_FS_LOAD_ARGS_NAME "imx6q-mccmon.dtb"
33
34 /* Size of malloc() pool */
35 #define CONFIG_SYS_MALLOC_LEN           (10 * SZ_1M)
36
37 #define CONFIG_BOARD_LATE_INIT
38 #define CONFIG_MXC_UART_BASE            UART1_BASE
39
40 #define CONFIG_SYS_MEMTEST_START        0x10000000
41 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M)
42
43 /* MMC Configuration */
44 #define CONFIG_SYS_FSL_USDHC_NUM        2
45 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
46
47 /* NOR 16-bit mode */
48 #define CONFIG_SYS_FLASH_BASE           WEIM_ARB_BASE_ADDR
49 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
50 #define CONFIG_SYS_FLASH_EMPTY_INFO
51 #define CONFIG_FLASH_VERIFY
52
53 /* NOR Flash MTD */
54 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
55 #define CONFIG_SYS_FLASH_BANKS_LIST     { (CONFIG_SYS_FLASH_BASE) }
56 #define CONFIG_SYS_FLASH_BANKS_SIZES    { (32 * SZ_1M) }
57
58 /* Ethernet Configuration */
59 #define IMX_FEC_BASE                    ENET_BASE_ADDR
60 #define CONFIG_FEC_MXC_PHYADDR          1
61
62 #define CONFIG_EXTRA_ENV_SETTINGS \
63         "console=ttymxc0,115200 quiet\0" \
64         "fdtfile=imx6q-mccmon6.dtb\0" \
65         "fdt_high=0xffffffff\0" \
66         "initrd_high=0xffffffff\0" \
67         "boot_os=yes\0" \
68         "disable_giga=yes\0" \
69         "download_kernel=" \
70                 "tftpboot ${kernel_addr} ${kernel_file};" \
71                 "tftpboot ${fdt_addr} ${fdtfile};\0" \
72         "get_boot_medium=" \
73                 "setenv boot_medium nor;" \
74                 "setexpr.l _src_sbmr1 *0x020d8004;" \
75                 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
76                 "if test ${_b_medium} = 40; then " \
77                         "setenv boot_medium sdcard;" \
78                 "fi\0" \
79         "kernel_file=uImage\0" \
80         "load_kernel=" \
81                 "load mmc ${bootdev}:${bootpart} ${kernel_addr} uImage;" \
82                 "load mmc ${bootdev}:${bootpart} ${fdt_addr} ${fdtfile};\0" \
83         "boot_sd=" \
84                 "echo '#######################';" \
85                 "echo '# Factory SDcard Boot #';" \
86                 "echo '#######################';" \
87                 "setenv mmcdev 1;" \
88                 "setenv mmcfactorydev 0;" \
89                 "setenv mmcfactorypart 1;" \
90                 "run factory_flash_img;\0" \
91         "boot_nor=" \
92                 "setenv kernelnor 0x08180000;" \
93                 "setenv dtbnor 0x09980000;" \
94                 "setenv bootargs console=${console} " \
95                 CONFIG_MTDPARTS_DEFAULT " " \
96                 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
97                 "cp.l ${dtbnor} ${dtbloadaddr} 0x8000;" \
98                 "bootm ${kernelnor} - ${dtbloadaddr};\0" \
99         "boot_recovery=" \
100                 "echo '#######################';" \
101                 "echo '# RECOVERY SWU Boot   #';" \
102                 "echo '#######################';" \
103                 "setenv rootfsloadaddr 0x13000000;" \
104                 "setenv swukernelnor 0x08980000;" \
105                 "setenv swurootfsnor 0x09180000;" \
106                 "setenv swudtbnor 0x099A0000;" \
107                 "setenv bootargs console=${console} " \
108                 CONFIG_MTDPARTS_DEFAULT " " \
109                 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
110                     ":${hostname}::off root=/dev/ram rw;" \
111                 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
112                 "cp.l ${swudtbnor} ${dtbloadaddr} 0x8000;" \
113                 "bootm ${swukernelnor} ${rootfsloadaddr} ${dtbloadaddr};\0" \
114         "boot_tftp=" \
115                 "echo '#######################';" \
116                 "echo '# TFTP Boot           #';" \
117                 "echo '#######################';" \
118                 "if run download_kernel; then " \
119                      "setenv bootargs console=${console} " \
120                      "root=/dev/mmcblk0p2 rootwait;" \
121                      "bootm ${kernel_addr} - ${fdt_addr};" \
122                 "fi\0" \
123         "bootcmd=" \
124                 "if test -n ${recovery_status}; then " \
125                      "run boot_recovery;" \
126                 "else " \
127                      "if test ! -n ${boot_medium}; then " \
128                           "run get_boot_medium;" \
129                           "if test ${boot_medium} = sdcard; then " \
130                               "run boot_sd;" \
131                           "else " \
132                               "run boot_nor;" \
133                           "fi;" \
134                      "else " \
135                           "if test ${boot_medium} = tftp; then " \
136                               "run boot_tftp;" \
137                           "fi;" \
138                      "fi;" \
139                 "fi\0" \
140         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
141         "fdt_addr=0x18000000\0" \
142         "bootdev=1\0" \
143         "bootpart=1\0" \
144         "kernel_addr=" __stringify(CONFIG_LOADADDR) "\0" \
145         "netdev=eth0\0" \
146         "load_addr=0x11000000\0" \
147         "dtbloadaddr=0x12000000\0" \
148         "uboot_file=u-boot.img\0" \
149         "SPL_file=SPL\0" \
150         "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
151         "nor_img_addr=0x11000000\0" \
152         "nor_img_file=core-image-lwn-mccmon6.nor\0" \
153         "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
154         "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
155         "nor_img_size=0x02000000\0" \
156         "factory_script_file=factory.scr\0" \
157         "factory_load_script=" \
158                 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
159                     "${factory_script_file}; then " \
160                     "load mmc ${mmcdev}:${mmcfactorypart} " \
161                      "${loadaddr} ${factory_script_file};" \
162                 "fi\0" \
163         "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
164                 "source ${loadaddr}\0" \
165         "factory_flash_img="\
166                 "echo 'Flash mccmon6 with factory images'; " \
167                 "if run factory_load_script; then " \
168                         "run factory_script;" \
169                 "else " \
170                     "echo No factory script: ${factory_script_file} found on " \
171                     "device ${mmcdev};" \
172                     "run factory_nor_img;" \
173                     "run factory_eMMC_img;" \
174                 "fi\0" \
175         "factory_eMMC_img="\
176                 "echo 'Update mccmon6 eMMC image'; " \
177                 "if load mmc ${mmcdev}:${mmcfactorypart} " \
178                     "${loadaddr} ${emmc_img_file}; then " \
179                     "setexpr fw_sz ${filesize} / 0x200;" \
180                     "setexpr fw_sz ${fw_sz} + 1;" \
181                     "mmc dev ${mmcfactorydev};" \
182                     "mmc write ${loadaddr} 0x0 ${fw_sz};" \
183                 "fi\0" \
184         "factory_nor_img="\
185                 "echo 'Update mccmon6 NOR image'; " \
186                 "if load mmc ${mmcdev}:${mmcfactorypart} " \
187                     "${nor_img_addr} ${nor_img_file}; then " \
188                         "run nor_update;" \
189                 "fi\0" \
190         "nor_update=" \
191                     "protect off ${nor_bank_start} +${nor_img_size};" \
192                     "erase ${nor_bank_start} +${nor_img_size};" \
193                     "setexpr nor_img_size ${nor_img_size} / 4; " \
194                     "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
195         "tftp_nor_uboot="\
196                 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
197                 "setenv nor_img_file u-boot.img; " \
198                 "setenv nor_img_size 0x80000; " \
199                 "setenv nor_bank_start 0x08080000; " \
200                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
201                     "run nor_update;" \
202                 "fi\0" \
203         "tftp_nor_uImg="\
204                 "echo 'Update mccmon6 NOR uImage via TFTP'; " \
205                 "setenv nor_img_file uImage; " \
206                 "setenv nor_img_size 0x500000; " \
207                 "setenv nor_bank_start 0x08180000; " \
208                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
209                     "run nor_update;" \
210                 "fi\0" \
211         "tftp_nor_dtb="\
212                 "echo 'Update mccmon6 NOR DTB via TFTP'; " \
213                 "setenv nor_img_file imx6q-mccmon6.dtb; " \
214                 "setenv nor_img_size 0x20000; " \
215                 "setenv nor_bank_start 0x09980000; " \
216                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
217                     "run nor_update;" \
218                 "fi\0" \
219         "tftp_nor_img="\
220                 "echo 'Update mccmon6 NOR image via TFTP'; " \
221                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
222                     "run nor_update;" \
223                 "fi\0" \
224         "tftp_nor_SPL="\
225                 "if tftp ${load_addr} SPL_padded; then " \
226                     "erase 0x08000000 +0x20000;" \
227                     "cp.b ${load_addr} 0x08000000 0x20000;" \
228                 "fi;\0" \
229         "tftp_sd_SPL="\
230             "if mmc dev 1; then "      \
231                 "if tftp ${load_addr} ${SPL_file}; then " \
232                     "setexpr fw_sz ${filesize} / 0x200; " \
233                     "setexpr fw_sz ${fw_sz} + 1; " \
234                     "mmc write ${load_addr} 0x2 ${fw_sz};" \
235                 "fi;" \
236             "fi;\0" \
237         "tftp_sd_uboot="\
238             "if mmc dev 1; then "      \
239                 "if run load_uboot; then " \
240                     "setexpr fw_sz ${filesize} / 0x200; " \
241                     "setexpr fw_sz ${fw_sz} + 1; " \
242                     "mmc write ${load_addr} 0x8A ${fw_sz};" \
243                 "fi;" \
244             "fi;\0"
245
246 /* Physical Memory Map */
247 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
248
249 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
250 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
251 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
252
253 #define CONFIG_SYS_INIT_SP_OFFSET \
254         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
255 #define CONFIG_SYS_INIT_SP_ADDR \
256         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
257
258 /* Environment organization */
259 #define CONFIG_ENV_SIZE                 (SZ_128K)
260
261 /* Envs are stored in NOR flash */
262 #define CONFIG_ENV_SECT_SIZE    (SZ_128K)
263 #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x40000)
264
265 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
266 #define CONFIG_ENV_ADDR_REDUND  (CONFIG_SYS_FLASH_BASE + 0x60000)
267 #define CONFIG_ENV_SIZE_REDUND  CONFIG_ENV_SIZE
268
269 #endif                         /* __CONFIG_H * */