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