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