Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx
[oweals/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_BASE (CONFIG_SYS_FLASH_BASE + 0x80000)
16 #define CONFIG_SYS_SPL_ARGS_ADDR        0x18000000
17
18 /*
19  * Below defines are set but NOT really used since we by
20  * design force U-Boot run when we boot in development
21  * mode from SD card (SD2)
22  */
23 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR (0x800)
24 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (0x80)
25 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR (0x1000)
26 #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "fitImage"
27
28 /* Size of malloc() pool */
29 #define CONFIG_SYS_MALLOC_LEN           (10 * SZ_1M)
30
31 #define CONFIG_MXC_UART_BASE            UART1_BASE
32
33 /* MMC Configuration */
34 #define CONFIG_SYS_FSL_USDHC_NUM        2
35 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
36
37 /* NOR 16-bit mode */
38 #define CONFIG_SYS_FLASH_BASE           WEIM_ARB_BASE_ADDR
39 #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
40 #define CONFIG_SYS_FLASH_EMPTY_INFO
41 #define CONFIG_FLASH_VERIFY
42
43 /* NOR Flash MTD */
44 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1
45 #define CONFIG_SYS_FLASH_BANKS_LIST     { (CONFIG_SYS_FLASH_BASE) }
46 #define CONFIG_SYS_FLASH_BANKS_SIZES    { (32 * SZ_1M) }
47
48 /* Ethernet Configuration */
49 #define IMX_FEC_BASE                    ENET_BASE_ADDR
50 #define CONFIG_FEC_MXC_PHYADDR          1
51
52 #define CONFIG_EXTRA_ENV_SETTINGS \
53         "console=ttymxc0,115200 quiet\0" \
54         "fdt_high=0xffffffff\0" \
55         "initrd_high=0xffffffff\0" \
56         "boot_os=yes\0" \
57         "kernelsize=0x300000\0" \
58         "disable_giga=yes\0" \
59         "download_kernel=" \
60                 "tftpboot ${loadaddr} ${kernel_file};\0" \
61         "get_boot_medium=" \
62                 "setenv boot_medium nor;" \
63                 "setexpr.l _src_sbmr1 *0x020d8004;" \
64                 "setexpr _b_medium ${_src_sbmr1} '&' 0x00000040;" \
65                 "if test ${_b_medium} = 40; then " \
66                         "setenv boot_medium sdcard;" \
67                 "fi\0" \
68         "kernel_file=fitImage\0" \
69         "boot_sd=" \
70                 "echo '#######################';" \
71                 "echo '# Factory SDcard Boot #';" \
72                 "echo '#######################';" \
73                 "setenv mmcdev 1;" \
74                 "setenv mmcfactorydev 0;" \
75                 "setenv mmcfactorypart 1;" \
76                 "run factory_flash_img;\0" \
77         "boot_nor=" \
78                 "setenv kernelnor 0x08180000;" \
79                 "setenv bootargs console=${console} " \
80                 CONFIG_MTDPARTS_DEFAULT " " \
81                 "root=/dev/mmcblk1 rootfstype=ext4 rw rootwait noinitrd;" \
82                 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
83                 "bootm ${loadaddr};reset;\0" \
84         "boot_recovery=" \
85                 "echo '#######################';" \
86                 "echo '# RECOVERY SWU Boot   #';" \
87                 "echo '#######################';" \
88                 "setenv rootfsloadaddr 0x13000000;" \
89                 "setenv swukernelnor 0x08980000;" \
90                 "setenv swurootfsnor 0x09180000;" \
91                 "setenv bootargs console=${console} " \
92                 CONFIG_MTDPARTS_DEFAULT " " \
93                 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
94                     ":${hostname}::off root=/dev/ram rw;" \
95                 "cp.l ${swurootfsnor} ${rootfsloadaddr} 0x200000;" \
96                 "cp.l ${swukernelnor} ${loadaddr} ${kernelsize};" \
97                 "bootm ${loadaddr} ${rootfsloadaddr};reset;\0" \
98         "boot_tftp=" \
99                 "echo '#######################';" \
100                 "echo '# TFTP Boot           #';" \
101                 "echo '#######################';" \
102                 "if run download_kernel; then " \
103                      "setenv bootargs console=${console} " \
104                      "root=/dev/mmcblk0p2 rootwait;" \
105                      "bootm $loadaddr};reset;" \
106                 "fi\0" \
107         "bootcmd=" \
108                 "if test -n ${recovery_status}; then " \
109                      "run boot_recovery;" \
110                 "else " \
111                      "if test ! -n ${boot_medium}; then " \
112                           "run get_boot_medium;" \
113                           "if test ${boot_medium} = sdcard; then " \
114                               "run boot_sd;" \
115                           "else " \
116                               "run boot_nor;" \
117                           "fi;" \
118                      "else " \
119                           "if test ${boot_medium} = tftp; then " \
120                               "run boot_tftp;" \
121                           "fi;" \
122                      "fi;" \
123                 "fi\0" \
124         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
125         "bootdev=1\0" \
126         "bootpart=1\0" \
127         "netdev=eth0\0" \
128         "load_addr=0x11000000\0" \
129         "uboot_file=u-boot.img\0" \
130         "SPL_file=SPL\0" \
131         "load_uboot=tftp ${load_addr} ${uboot_file}\0" \
132         "nor_img_addr=0x11000000\0" \
133         "nor_img_file=core-image-lwn-mccmon6.nor\0" \
134         "emmc_img_file=core-image-lwn-mccmon6.ext4\0" \
135         "nor_bank_start=" __stringify(CONFIG_SYS_FLASH_BASE) "\0" \
136         "nor_img_size=0x02000000\0" \
137         "factory_script_file=factory.scr\0" \
138         "factory_load_script=" \
139                 "if test -e mmc ${mmcdev}:${mmcfactorypart} " \
140                     "${factory_script_file}; then " \
141                     "load mmc ${mmcdev}:${mmcfactorypart} " \
142                      "${loadaddr} ${factory_script_file};" \
143                 "fi\0" \
144         "factory_script=echo Running factory script from mmc${mmcdev} ...; " \
145                 "source ${loadaddr}\0" \
146         "factory_flash_img="\
147                 "echo 'Flash mccmon6 with factory images'; " \
148                 "if run factory_load_script; then " \
149                         "run factory_script;" \
150                 "else " \
151                     "echo No factory script: ${factory_script_file} found on " \
152                     "device ${mmcdev};" \
153                     "run factory_nor_img;" \
154                     "run factory_eMMC_img;" \
155                     "run factory_SPL_falcon_setup;" \
156                 "fi\0" \
157         "factory_eMMC_img="\
158                 "echo 'Update mccmon6 eMMC image'; " \
159                 "if load mmc ${mmcdev}:${mmcfactorypart} " \
160                     "${loadaddr} ${emmc_img_file}; then " \
161                     "setexpr fw_sz ${filesize} / 0x200;" \
162                     "setexpr fw_sz ${fw_sz} + 1;" \
163                     "mmc dev ${mmcfactorydev};" \
164                     "mmc write ${loadaddr} 0x0 ${fw_sz};" \
165                 "fi\0" \
166         "factory_nor_img="\
167                 "echo 'Update mccmon6 NOR image'; " \
168                 "if load mmc ${mmcdev}:${mmcfactorypart} " \
169                     "${nor_img_addr} ${nor_img_file}; then " \
170                         "run nor_update;" \
171                 "fi\0" \
172         "nor_update=" \
173                     "protect off ${nor_bank_start} +${nor_img_size};" \
174                     "erase ${nor_bank_start} +${nor_img_size};" \
175                     "setexpr nor_img_size ${nor_img_size} / 4; " \
176                     "cp.l ${nor_img_addr} ${nor_bank_start} ${nor_img_size}\0" \
177         "factory_SPL_falcon_setup="\
178                 "echo 'Write Falcon boot data'; " \
179                 "setenv kernelnor 0x08180000;" \
180                 "cp.l ${kernelnor} ${loadaddr} ${kernelsize};" \
181                 "spl export fdt ${loadaddr};" \
182                 "setenv nor_img_addr ${fdtargsaddr};" \
183                 "setenv nor_img_size 0x20000;" \
184                 "setenv nor_bank_start " \
185                                 __stringify(CONFIG_CMD_SPL_NOR_OFS)";" \
186                 "run nor_update\0" \
187         "tftp_nor_uboot="\
188                 "echo 'Update mccmon6 NOR U-BOOT via TFTP'; " \
189                 "setenv nor_img_file u-boot.img; " \
190                 "setenv nor_img_size 0x80000; " \
191                 "setenv nor_bank_start 0x08080000; " \
192                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
193                     "run nor_update;" \
194                 "fi\0" \
195         "tftp_nor_fitImg="\
196                 "echo 'Update mccmon6 NOR fitImage via TFTP'; " \
197                 "setenv nor_img_file fitImage; " \
198                 "setenv nor_img_size 0x500000; " \
199                 "setenv nor_bank_start 0x08180000; " \
200                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
201                     "run nor_update;" \
202                 "fi\0" \
203         "tftp_nor_img="\
204                 "echo 'Update mccmon6 NOR image via TFTP'; " \
205                 "if tftpboot ${nor_img_addr} ${nor_img_file}; then " \
206                     "run nor_update;" \
207                 "fi\0" \
208         "tftp_nor_SPL="\
209                 "if tftp ${load_addr} SPL_padded; then " \
210                     "erase 0x08000000 +0x20000;" \
211                     "cp.b ${load_addr} 0x08000000 0x20000;" \
212                 "fi;\0" \
213         "tftp_sd_SPL="\
214             "if mmc dev 1; then "      \
215                 "if tftp ${load_addr} ${SPL_file}; then " \
216                     "setexpr fw_sz ${filesize} / 0x200; " \
217                     "setexpr fw_sz ${fw_sz} + 1; " \
218                     "mmc write ${load_addr} 0x2 ${fw_sz};" \
219                 "fi;" \
220             "fi;\0" \
221         "tftp_sd_uboot="\
222             "if mmc dev 1; then "      \
223                 "if run load_uboot; then " \
224                     "setexpr fw_sz ${filesize} / 0x200; " \
225                     "setexpr fw_sz ${fw_sz} + 1; " \
226                     "mmc write ${load_addr} 0x8A ${fw_sz};" \
227                 "fi;" \
228             "fi;\0"
229
230 /* Physical Memory Map */
231 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
232
233 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
234 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
235 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
236
237 #define CONFIG_SYS_INIT_SP_OFFSET \
238         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
239 #define CONFIG_SYS_INIT_SP_ADDR \
240         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
241
242 /* Environment organization */
243
244 /* Envs are stored in NOR flash */
245
246 #endif                         /* __CONFIG_H * */