Commit 4b2850ccfd8b387590c9fb4abfffdd0ac5cc8e58
1 parent
cf2acc5b7c
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
4 other branches
MLK-20664-1 imx8qxp: spl: Enable SPL container support for NAND
Add the NAND support to SPL container parser and enable it for imx8qxp arm2 nand reworked board. The SPL NAND will read from nandfit mtdpart (128MB offset) to parsing the entire boot image and get the 3rd container from it. This requires burning tool (uuu) to program the entire boot image into nandfit. Signed-off-by: Ye Li <ye.li@nxp.com>
Showing 4 changed files with 53 additions and 12 deletions Inline Diff
arch/arm/include/asm/arch-imx8/image.h
1 | /* SPDX-License-Identifier: GPL-2.0+ */ | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | /* | 2 | /* |
3 | * Copyright 2018 NXP | 3 | * Copyright 2018 NXP |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define IV_MAX_LEN 32 | 6 | #define IV_MAX_LEN 32 |
7 | #define HASH_MAX_LEN 64 | 7 | #define HASH_MAX_LEN 64 |
8 | 8 | ||
9 | #define CONTAINER_HDR_ALIGNMENT 0x400 | 9 | #define CONTAINER_HDR_ALIGNMENT 0x400 |
10 | #define CONTAINER_HDR_EMMC_OFFSET 0 | 10 | #define CONTAINER_HDR_EMMC_OFFSET 0 |
11 | #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K | 11 | #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K |
12 | #define CONTAINER_HDR_QSPI_OFFSET SZ_4K | 12 | #define CONTAINER_HDR_QSPI_OFFSET SZ_4K |
13 | #define CONTAINER_HDR_NAND_OFFSET SZ_64M | 13 | #define CONTAINER_HDR_NAND_OFFSET SZ_128M |
14 | 14 | ||
15 | struct container_hdr{ | 15 | struct container_hdr{ |
16 | uint8_t version; | 16 | uint8_t version; |
17 | uint8_t length_lsb; | 17 | uint8_t length_lsb; |
18 | uint8_t length_msb; | 18 | uint8_t length_msb; |
19 | uint8_t tag; | 19 | uint8_t tag; |
20 | uint32_t flags; | 20 | uint32_t flags; |
21 | uint16_t sw_version; | 21 | uint16_t sw_version; |
22 | uint8_t fuse_version; | 22 | uint8_t fuse_version; |
23 | uint8_t num_images; | 23 | uint8_t num_images; |
24 | uint16_t sig_blk_offset; | 24 | uint16_t sig_blk_offset; |
25 | uint16_t reserved; | 25 | uint16_t reserved; |
26 | }__attribute__((packed)); | 26 | }__attribute__((packed)); |
27 | 27 | ||
28 | struct boot_img_t{ | 28 | struct boot_img_t{ |
29 | uint32_t offset; | 29 | uint32_t offset; |
30 | uint32_t size; | 30 | uint32_t size; |
31 | uint64_t dst; | 31 | uint64_t dst; |
32 | uint64_t entry; | 32 | uint64_t entry; |
33 | uint32_t hab_flags; | 33 | uint32_t hab_flags; |
34 | uint32_t meta; | 34 | uint32_t meta; |
35 | uint8_t hash[HASH_MAX_LEN]; | 35 | uint8_t hash[HASH_MAX_LEN]; |
36 | uint8_t iv[IV_MAX_LEN]; | 36 | uint8_t iv[IV_MAX_LEN]; |
37 | }__attribute__((packed)); | 37 | }__attribute__((packed)); |
38 | 38 | ||
39 | struct signature_block_hdr{ | 39 | struct signature_block_hdr{ |
40 | uint8_t version; | 40 | uint8_t version; |
41 | uint8_t length_lsb; | 41 | uint8_t length_lsb; |
42 | uint8_t length_msb; | 42 | uint8_t length_msb; |
43 | uint8_t tag; | 43 | uint8_t tag; |
44 | uint16_t srk_table_offset; | 44 | uint16_t srk_table_offset; |
45 | uint16_t cert_offset; | 45 | uint16_t cert_offset; |
46 | uint16_t blob_offset; | 46 | uint16_t blob_offset; |
47 | uint16_t signature_offset; | 47 | uint16_t signature_offset; |
48 | uint32_t reserved; | 48 | uint32_t reserved; |
49 | }__attribute__((packed)); | 49 | }__attribute__((packed)); |
50 | 50 |
arch/arm/mach-imx/imx8/parser.c
1 | // SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | 2 | /* |
3 | * Copyright 2018 NXP | 3 | * Copyright 2018 NXP |
4 | */ | 4 | */ |
5 | #include <common.h> | 5 | #include <common.h> |
6 | #include <spl.h> | 6 | #include <spl.h> |
7 | #include <errno.h> | 7 | #include <errno.h> |
8 | #include <asm/io.h> | 8 | #include <asm/io.h> |
9 | #include <dm.h> | 9 | #include <dm.h> |
10 | #include <mmc.h> | 10 | #include <mmc.h> |
11 | #include <spi_flash.h> | 11 | #include <spi_flash.h> |
12 | #include <nand.h> | ||
12 | #include <asm/arch/image.h> | 13 | #include <asm/arch/image.h> |
13 | #include <asm/arch/sys_proto.h> | 14 | #include <asm/arch/sys_proto.h> |
14 | #include <asm/mach-imx/sci/sci.h> | 15 | #include <asm/mach-imx/sci/sci.h> |
15 | #include <asm/mach-imx/boot_mode.h> | 16 | #include <asm/mach-imx/boot_mode.h> |
16 | 17 | ||
17 | #define MMC_DEV 0 | 18 | #define MMC_DEV 0 |
18 | #define QSPI_DEV 1 | 19 | #define QSPI_DEV 1 |
19 | #define RAM_DEV 3 | 20 | #define NAND_DEV 2 |
21 | #define RAM_DEV 3 | ||
20 | 22 | ||
21 | #define SEC_SECURE_RAM_BASE (0x31800000UL) | 23 | #define SEC_SECURE_RAM_BASE (0x31800000UL) |
22 | #define SEC_SECURE_RAM_END_BASE (SEC_SECURE_RAM_BASE + 0xFFFFUL) | 24 | #define SEC_SECURE_RAM_END_BASE (SEC_SECURE_RAM_BASE + 0xFFFFUL) |
23 | #define SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE (0x60000000UL) | 25 | #define SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE (0x60000000UL) |
24 | 26 | ||
25 | #define SECO_PT 2U | 27 | #define SECO_PT 2U |
26 | 28 | ||
27 | DECLARE_GLOBAL_DATA_PTR; | 29 | DECLARE_GLOBAL_DATA_PTR; |
28 | 30 | ||
29 | #if defined(CONFIG_IMX_TRUSTY_OS) | 31 | #if defined(CONFIG_IMX_TRUSTY_OS) |
30 | /* Pre-declaration of check_rpmb_blob. */ | 32 | /* Pre-declaration of check_rpmb_blob. */ |
31 | int check_rpmb_blob(struct mmc *mmc); | 33 | int check_rpmb_blob(struct mmc *mmc); |
32 | #endif | 34 | #endif |
33 | 35 | ||
34 | static int current_dev_type = MMC_DEV; | 36 | static int current_dev_type = MMC_DEV; |
35 | static int start_offset; | 37 | static int start_offset; |
36 | static void *device; | 38 | static void *device; |
37 | 39 | ||
38 | static int read(u32 start, u32 len, void *load_addr) | 40 | static int read(u32 start, u32 len, void *load_addr) |
39 | { | 41 | { |
40 | int ret = -ENODEV; | 42 | int ret = -ENODEV; |
41 | 43 | ||
42 | if (!device && current_dev_type != RAM_DEV) { | 44 | if (current_dev_type != NAND_DEV && current_dev_type != RAM_DEV |
45 | && !device) { | ||
43 | debug("No device selected\n"); | 46 | debug("No device selected\n"); |
44 | return ret; | 47 | return ret; |
45 | } | 48 | } |
46 | 49 | ||
47 | #ifdef CONFIG_SPL_MMC_SUPPORT | 50 | #ifdef CONFIG_SPL_MMC_SUPPORT |
48 | if (current_dev_type == MMC_DEV) { | 51 | if (current_dev_type == MMC_DEV) { |
49 | struct mmc *mmc = (struct mmc *)device; | 52 | struct mmc *mmc = (struct mmc *)device; |
50 | unsigned long count; | 53 | unsigned long count; |
51 | 54 | ||
52 | ret = 0; | 55 | ret = 0; |
53 | 56 | ||
54 | count = blk_dread(mmc_get_blk_desc(mmc), | 57 | count = blk_dread(mmc_get_blk_desc(mmc), |
55 | start / mmc->read_bl_len, | 58 | start / mmc->read_bl_len, |
56 | len / mmc->read_bl_len, | 59 | len / mmc->read_bl_len, |
57 | load_addr); | 60 | load_addr); |
58 | if (count == 0) { | 61 | if (count == 0) { |
59 | debug("Read container image failed\n"); | 62 | debug("Read container image failed\n"); |
60 | return -EIO; | 63 | return -EIO; |
61 | } | 64 | } |
62 | } | 65 | } |
63 | #endif | 66 | #endif |
64 | #ifdef CONFIG_SPL_SPI_LOAD | 67 | #ifdef CONFIG_SPL_SPI_LOAD |
65 | if (current_dev_type == QSPI_DEV) { | 68 | if (current_dev_type == QSPI_DEV) { |
66 | struct spi_flash *flash = (struct spi_flash *)device; | 69 | struct spi_flash *flash = (struct spi_flash *)device; |
67 | 70 | ||
68 | ret = spi_flash_read(flash, start, | 71 | ret = spi_flash_read(flash, start, |
69 | len, load_addr); | 72 | len, load_addr); |
70 | if (ret != 0) { | 73 | if (ret != 0) { |
71 | debug("Read container image from QSPI failed\n"); | 74 | debug("Read container image from QSPI failed\n"); |
72 | return -EIO; | 75 | return -EIO; |
73 | } | 76 | } |
74 | } | 77 | } |
75 | #endif | 78 | #endif |
79 | #ifdef CONFIG_SPL_NAND_SUPPORT | ||
80 | if (current_dev_type == NAND_DEV) { | ||
81 | ret = nand_spl_load_image(start, len, load_addr); | ||
82 | if (ret != 0) { | ||
83 | debug("Read container image from NAND failed\n"); | ||
84 | return -EIO; | ||
85 | } | ||
86 | } | ||
87 | #endif | ||
76 | 88 | ||
77 | if (current_dev_type == RAM_DEV) { | 89 | if (current_dev_type == RAM_DEV) { |
78 | memcpy(load_addr, (const void *)(ulong)start, len); | 90 | memcpy(load_addr, (const void *)(ulong)start, len); |
79 | ret = 0; | 91 | ret = 0; |
80 | } | 92 | } |
81 | 93 | ||
82 | return ret; | 94 | return ret; |
83 | } | 95 | } |
84 | 96 | ||
85 | static int authenticate_image(struct boot_img_t *img, int image_index) | 97 | static int authenticate_image(struct boot_img_t *img, int image_index) |
86 | { | 98 | { |
87 | sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle; | 99 | sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle; |
88 | sc_faddr_t start, end; | 100 | sc_faddr_t start, end; |
89 | sc_rm_mr_t mr; | 101 | sc_rm_mr_t mr; |
90 | sc_err_t err; | 102 | sc_err_t err; |
91 | int ret = 0; | 103 | int ret = 0; |
92 | 104 | ||
93 | debug("img %d, dst 0x%llx, src 0x%x, size 0x%x\n", | 105 | debug("img %d, dst 0x%llx, src 0x%x, size 0x%x\n", |
94 | image_index, img->dst, img->offset, img->size); | 106 | image_index, img->dst, img->offset, img->size); |
95 | 107 | ||
96 | /* Find the memreg and set permission for seco pt */ | 108 | /* Find the memreg and set permission for seco pt */ |
97 | err = sc_rm_find_memreg(ipcHndl, &mr, | 109 | err = sc_rm_find_memreg(ipcHndl, &mr, |
98 | img->dst & ~(CONFIG_SYS_CACHELINE_SIZE - 1), | 110 | img->dst & ~(CONFIG_SYS_CACHELINE_SIZE - 1), |
99 | ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE)); | 111 | ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE)); |
100 | 112 | ||
101 | if (err) { | 113 | if (err) { |
102 | printf("can't find memreg for image load address %d, error %d\n", | 114 | printf("can't find memreg for image load address %d, error %d\n", |
103 | image_index, err); | 115 | image_index, err); |
104 | return -ENOMEM; | 116 | return -ENOMEM; |
105 | } | 117 | } |
106 | 118 | ||
107 | err = sc_rm_get_memreg_info(ipcHndl, mr, &start, &end); | 119 | err = sc_rm_get_memreg_info(ipcHndl, mr, &start, &end); |
108 | if (!err) | 120 | if (!err) |
109 | debug("memreg %u 0x%llx -- 0x%llx\n", mr, start, end); | 121 | debug("memreg %u 0x%llx -- 0x%llx\n", mr, start, end); |
110 | 122 | ||
111 | err = sc_rm_set_memreg_permissions(ipcHndl, mr, | 123 | err = sc_rm_set_memreg_permissions(ipcHndl, mr, |
112 | SECO_PT, SC_RM_PERM_FULL); | 124 | SECO_PT, SC_RM_PERM_FULL); |
113 | if (err) { | 125 | if (err) { |
114 | printf("set permission failed for img %d, error %d\n", | 126 | printf("set permission failed for img %d, error %d\n", |
115 | image_index, err); | 127 | image_index, err); |
116 | return -EPERM; | 128 | return -EPERM; |
117 | } | 129 | } |
118 | 130 | ||
119 | err = sc_misc_seco_authenticate(ipcHndl, SC_MISC_VERIFY_IMAGE, | 131 | err = sc_misc_seco_authenticate(ipcHndl, SC_MISC_VERIFY_IMAGE, |
120 | 1 << image_index); | 132 | 1 << image_index); |
121 | if (err) { | 133 | if (err) { |
122 | printf("authenticate img %d failed, return %d\n", | 134 | printf("authenticate img %d failed, return %d\n", |
123 | image_index, err); | 135 | image_index, err); |
124 | ret = -EIO; | 136 | ret = -EIO; |
125 | } | 137 | } |
126 | 138 | ||
127 | err = sc_rm_set_memreg_permissions(ipcHndl, mr, | 139 | err = sc_rm_set_memreg_permissions(ipcHndl, mr, |
128 | SECO_PT, SC_RM_PERM_NONE); | 140 | SECO_PT, SC_RM_PERM_NONE); |
129 | if (err) { | 141 | if (err) { |
130 | printf("remove permission failed for img %d, error %d\n", | 142 | printf("remove permission failed for img %d, error %d\n", |
131 | image_index, err); | 143 | image_index, err); |
132 | ret = -EPERM; | 144 | ret = -EPERM; |
133 | } | 145 | } |
134 | 146 | ||
135 | return ret; | 147 | return ret; |
136 | } | 148 | } |
137 | 149 | ||
138 | static struct boot_img_t *read_auth_image(struct container_hdr *container, | 150 | static struct boot_img_t *read_auth_image(struct container_hdr *container, |
139 | int image_index) | 151 | int image_index) |
140 | { | 152 | { |
141 | struct boot_img_t *images; | 153 | struct boot_img_t *images; |
142 | 154 | ||
143 | if (image_index > container->num_images) { | 155 | if (image_index > container->num_images) { |
144 | debug("Invalid image number\n"); | 156 | debug("Invalid image number\n"); |
145 | return NULL; | 157 | return NULL; |
146 | } | 158 | } |
147 | 159 | ||
148 | images = (struct boot_img_t *) | 160 | images = (struct boot_img_t *) |
149 | ((uint8_t *)container + sizeof(struct container_hdr)); | 161 | ((uint8_t *)container + sizeof(struct container_hdr)); |
150 | 162 | ||
151 | if (read(images[image_index].offset + start_offset, | 163 | if (read(images[image_index].offset + start_offset, |
152 | images[image_index].size, | 164 | images[image_index].size, |
153 | (void *)images[image_index].entry) < 0) { | 165 | (void *)images[image_index].entry) < 0) { |
154 | return NULL; | 166 | return NULL; |
155 | } | 167 | } |
156 | 168 | ||
157 | if (authenticate_image(&images[image_index], image_index)) { | 169 | if (authenticate_image(&images[image_index], image_index)) { |
158 | printf("Failed to authenticate image %d\n", image_index); | 170 | printf("Failed to authenticate image %d\n", image_index); |
159 | return NULL; | 171 | return NULL; |
160 | } | 172 | } |
161 | 173 | ||
162 | return &images[image_index]; | 174 | return &images[image_index]; |
163 | } | 175 | } |
164 | 176 | ||
165 | static int read_auth_container(struct spl_image_info *spl_image) | 177 | static int read_auth_container(struct spl_image_info *spl_image) |
166 | { | 178 | { |
167 | sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle; | 179 | sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle; |
168 | struct container_hdr *container = NULL; | 180 | struct container_hdr *container = NULL; |
169 | uint16_t length; | 181 | uint16_t length; |
170 | int ret; | 182 | int ret; |
171 | int i; | 183 | int i; |
172 | 184 | ||
173 | container = malloc(CONTAINER_HDR_ALIGNMENT); | 185 | container = malloc(CONTAINER_HDR_ALIGNMENT); |
174 | if (!container) | 186 | if (!container) |
175 | return -ENOMEM; | 187 | return -ENOMEM; |
176 | 188 | ||
177 | ret = read(start_offset, CONTAINER_HDR_ALIGNMENT, (void *)container); | 189 | ret = read(start_offset, CONTAINER_HDR_ALIGNMENT, (void *)container); |
178 | if (ret) | 190 | if (ret) |
179 | return ret; | 191 | return ret; |
180 | 192 | ||
181 | if (container->tag != 0x87 && container->version != 0x0) { | 193 | if (container->tag != 0x87 && container->version != 0x0) { |
182 | printf("Wrong container header\n"); | 194 | printf("Wrong container header\n"); |
183 | ret = -EFAULT; | 195 | ret = -EFAULT; |
184 | goto out; | 196 | goto out; |
185 | } | 197 | } |
186 | 198 | ||
187 | if (!container->num_images) { | 199 | if (!container->num_images) { |
188 | printf("Wrong container, no image found\n"); | 200 | printf("Wrong container, no image found\n"); |
189 | ret = -EFAULT; | 201 | ret = -EFAULT; |
190 | goto out; | 202 | goto out; |
191 | } | 203 | } |
192 | 204 | ||
193 | length = container->length_lsb + (container->length_msb << 8); | 205 | length = container->length_lsb + (container->length_msb << 8); |
194 | 206 | ||
195 | debug("container length %u\n", length); | 207 | debug("container length %u\n", length); |
196 | memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)container, | 208 | memcpy((void *)SEC_SECURE_RAM_BASE, (const void *)container, |
197 | ALIGN(length, CONFIG_SYS_CACHELINE_SIZE)); | 209 | ALIGN(length, CONFIG_SYS_CACHELINE_SIZE)); |
198 | 210 | ||
199 | ret = sc_misc_seco_authenticate(ipcHndl, SC_MISC_AUTH_CONTAINER, | 211 | ret = sc_misc_seco_authenticate(ipcHndl, SC_MISC_AUTH_CONTAINER, |
200 | SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE); | 212 | SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE); |
201 | if (ret) { | 213 | if (ret) { |
202 | printf("authenticate container hdr failed, return %d\n", ret); | 214 | printf("authenticate container hdr failed, return %d\n", ret); |
203 | ret = -EFAULT; | 215 | ret = -EFAULT; |
204 | goto out; | 216 | goto out; |
205 | } | 217 | } |
206 | 218 | ||
207 | for (i = 0; i < container->num_images; i++) { | 219 | for (i = 0; i < container->num_images; i++) { |
208 | struct boot_img_t *image = read_auth_image(container, i); | 220 | struct boot_img_t *image = read_auth_image(container, i); |
209 | 221 | ||
210 | if (!image) { | 222 | if (!image) { |
211 | ret = -EINVAL; | 223 | ret = -EINVAL; |
212 | sc_misc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0); | 224 | sc_misc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0); |
213 | goto out; | 225 | goto out; |
214 | } | 226 | } |
215 | 227 | ||
216 | if (i == 0) { | 228 | if (i == 0) { |
217 | spl_image->load_addr = image->dst; | 229 | spl_image->load_addr = image->dst; |
218 | spl_image->entry_point = image->entry; | 230 | spl_image->entry_point = image->entry; |
219 | } | 231 | } |
220 | } | 232 | } |
221 | 233 | ||
222 | sc_misc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0); | 234 | sc_misc_seco_authenticate(ipcHndl, SC_MISC_REL_CONTAINER, 0); |
223 | 235 | ||
224 | out: | 236 | out: |
225 | free(container); | 237 | free(container); |
226 | 238 | ||
227 | return ret; | 239 | return ret; |
228 | } | 240 | } |
229 | 241 | ||
230 | int mmc_load_image_parse_container(struct spl_image_info *spl_image, | 242 | int mmc_load_image_parse_container(struct spl_image_info *spl_image, |
231 | struct mmc *mmc, unsigned long sector) | 243 | struct mmc *mmc, unsigned long sector) |
232 | { | 244 | { |
233 | int ret = 0; | 245 | int ret = 0; |
234 | 246 | ||
235 | current_dev_type = MMC_DEV; | 247 | current_dev_type = MMC_DEV; |
236 | device = mmc; | 248 | device = mmc; |
237 | 249 | ||
238 | start_offset = sector * mmc->read_bl_len; | 250 | start_offset = sector * mmc->read_bl_len; |
239 | 251 | ||
240 | ret = read_auth_container(spl_image); | 252 | ret = read_auth_container(spl_image); |
241 | 253 | ||
242 | if (!ret) | 254 | if (!ret) |
243 | { | 255 | { |
244 | /* Images loaded, now check the rpmb keyblob for Trusty OS. */ | 256 | /* Images loaded, now check the rpmb keyblob for Trusty OS. */ |
245 | #if defined(CONFIG_IMX_TRUSTY_OS) | 257 | #if defined(CONFIG_IMX_TRUSTY_OS) |
246 | ret = check_rpmb_blob(mmc); | 258 | ret = check_rpmb_blob(mmc); |
247 | #endif | 259 | #endif |
248 | } | 260 | } |
249 | return ret; | 261 | return ret; |
250 | } | 262 | } |
251 | 263 | ||
252 | int spi_load_image_parse_container(struct spl_image_info *spl_image, | 264 | int spi_load_image_parse_container(struct spl_image_info *spl_image, |
253 | struct spi_flash *flash, | 265 | struct spi_flash *flash, |
254 | unsigned long offset) | 266 | unsigned long offset) |
255 | { | 267 | { |
256 | int ret = 0; | 268 | int ret = 0; |
257 | 269 | ||
258 | current_dev_type = QSPI_DEV; | 270 | current_dev_type = QSPI_DEV; |
259 | device = flash; | 271 | device = flash; |
272 | |||
273 | start_offset = offset; | ||
274 | |||
275 | ret = read_auth_container(spl_image); | ||
276 | |||
277 | return ret; | ||
278 | } | ||
279 | |||
280 | int nand_load_image_parse_container(struct spl_image_info *spl_image, | ||
281 | unsigned long offset) | ||
282 | { | ||
283 | int ret = 0; | ||
284 | |||
285 | current_dev_type = NAND_DEV; | ||
286 | device = NULL; | ||
260 | 287 | ||
261 | start_offset = offset; | 288 | start_offset = offset; |
262 | 289 | ||
263 | ret = read_auth_container(spl_image); | 290 | ret = read_auth_container(spl_image); |
264 | 291 | ||
265 | return ret; | 292 | return ret; |
266 | } | 293 | } |
267 | 294 | ||
268 | int sdp_load_image_parse_container(struct spl_image_info *spl_image, | 295 | int sdp_load_image_parse_container(struct spl_image_info *spl_image, |
269 | unsigned long offset) | 296 | unsigned long offset) |
270 | { | 297 | { |
271 | int ret = 0; | 298 | int ret = 0; |
272 | 299 | ||
273 | current_dev_type = RAM_DEV; | 300 | current_dev_type = RAM_DEV; |
274 | device = NULL; | 301 | device = NULL; |
275 | 302 | ||
276 | start_offset = offset; | 303 | start_offset = offset; |
277 | 304 | ||
278 | ret = read_auth_container(spl_image); | 305 | ret = read_auth_container(spl_image); |
279 | 306 | ||
280 | return ret; | 307 | return ret; |
281 | } | 308 | } |
282 | 309 |
common/spl/spl_nand.c
1 | /* | 1 | /* |
2 | * Copyright (C) 2011 | 2 | * Copyright (C) 2011 |
3 | * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de> | 3 | * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de> |
4 | * | 4 | * |
5 | * SPDX-License-Identifier: GPL-2.0+ | 5 | * SPDX-License-Identifier: GPL-2.0+ |
6 | */ | 6 | */ |
7 | #include <common.h> | 7 | #include <common.h> |
8 | #include <config.h> | 8 | #include <config.h> |
9 | #include <spl.h> | 9 | #include <spl.h> |
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | #include <nand.h> | 11 | #include <nand.h> |
12 | #include <linux/libfdt_env.h> | 12 | #include <linux/libfdt_env.h> |
13 | #include <fdt.h> | 13 | #include <fdt.h> |
14 | 14 | ||
15 | #if defined(CONFIG_SPL_NAND_RAW_ONLY) | 15 | #ifdef CONFIG_PARSE_CONTAINER |
16 | int __weak nand_load_image_parse_container(struct spl_image_info *spl_image, | ||
17 | unsigned long offset) | ||
18 | { | ||
19 | return -EINVAL; | ||
20 | } | ||
21 | #endif | ||
22 | |||
16 | uint32_t __weak spl_nand_get_uboot_raw_page(void) | 23 | uint32_t __weak spl_nand_get_uboot_raw_page(void) |
17 | { | 24 | { |
18 | return CONFIG_SYS_NAND_U_BOOT_OFFS; | 25 | return CONFIG_SYS_NAND_U_BOOT_OFFS; |
19 | } | 26 | } |
20 | 27 | ||
28 | #if defined(CONFIG_SPL_NAND_RAW_ONLY) | ||
21 | int spl_nand_load_image(struct spl_image_info *spl_image, | 29 | int spl_nand_load_image(struct spl_image_info *spl_image, |
22 | struct spl_boot_device *bootdev) | 30 | struct spl_boot_device *bootdev) |
23 | { | 31 | { |
24 | nand_init(); | 32 | nand_init(); |
25 | nand_spl_load_image(spl_nand_get_uboot_raw_page(), | 33 | nand_spl_load_image(spl_nand_get_uboot_raw_page(), |
26 | CONFIG_SYS_NAND_U_BOOT_SIZE, | 34 | CONFIG_SYS_NAND_U_BOOT_SIZE, |
27 | (void *)CONFIG_SYS_NAND_U_BOOT_DST); | 35 | (void *)CONFIG_SYS_NAND_U_BOOT_DST); |
28 | #if defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE) | 36 | #if defined(CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE) |
29 | spl_set_header_raw_atf(spl_image); | 37 | spl_set_header_raw_atf(spl_image); |
30 | #else | 38 | #else |
31 | spl_set_header_raw_uboot(spl_image); | 39 | spl_set_header_raw_uboot(spl_image); |
32 | #endif | 40 | #endif |
33 | nand_deselect(); | 41 | nand_deselect(); |
34 | 42 | ||
35 | return 0; | 43 | return 0; |
36 | } | 44 | } |
37 | #else | 45 | #else |
38 | 46 | ||
39 | static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs, | 47 | static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs, |
40 | ulong size, void *dst) | 48 | ulong size, void *dst) |
41 | { | 49 | { |
42 | int ret; | 50 | int ret; |
43 | 51 | ||
44 | ret = nand_spl_load_image(offs, size, dst); | 52 | ret = nand_spl_load_image(offs, size, dst); |
45 | if (!ret) | 53 | if (!ret) |
46 | return size; | 54 | return size; |
47 | else | 55 | else |
48 | return 0; | 56 | return 0; |
49 | } | 57 | } |
50 | 58 | ||
51 | static int spl_nand_load_element(struct spl_image_info *spl_image, | 59 | static int spl_nand_load_element(struct spl_image_info *spl_image, |
52 | int offset, struct image_header *header) | 60 | int offset, struct image_header *header) |
53 | { | 61 | { |
54 | int err; | 62 | int err; |
55 | 63 | ||
56 | err = nand_spl_load_image(offset, sizeof(*header), (void *)header); | 64 | err = nand_spl_load_image(offset, sizeof(*header), (void *)header); |
57 | if (err) | 65 | if (err) |
58 | return err; | 66 | return err; |
59 | 67 | ||
60 | if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && | 68 | if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && |
61 | image_get_magic(header) == FDT_MAGIC) { | 69 | image_get_magic(header) == FDT_MAGIC) { |
62 | struct spl_load_info load; | 70 | struct spl_load_info load; |
63 | 71 | ||
64 | debug("Found FIT\n"); | 72 | debug("Found FIT\n"); |
65 | load.dev = NULL; | 73 | load.dev = NULL; |
66 | load.priv = NULL; | 74 | load.priv = NULL; |
67 | load.filename = NULL; | 75 | load.filename = NULL; |
68 | load.bl_len = 1; | 76 | load.bl_len = 1; |
69 | load.read = spl_nand_fit_read; | 77 | load.read = spl_nand_fit_read; |
70 | return spl_load_simple_fit(spl_image, &load, offset, header); | 78 | return spl_load_simple_fit(spl_image, &load, offset, header); |
71 | } else { | 79 | } else { |
80 | #ifdef CONFIG_PARSE_CONTAINER | ||
81 | return nand_load_image_parse_container(spl_image, offset); | ||
82 | #else | ||
72 | err = spl_parse_image_header(spl_image, header); | 83 | err = spl_parse_image_header(spl_image, header); |
73 | if (err) | 84 | if (err) |
74 | return err; | 85 | return err; |
75 | return nand_spl_load_image(offset, spl_image->size, | 86 | return nand_spl_load_image(offset, spl_image->size, |
76 | (void *)(ulong)spl_image->load_addr); | 87 | (void *)(ulong)spl_image->load_addr); |
88 | #endif | ||
77 | } | 89 | } |
78 | } | 90 | } |
79 | 91 | ||
80 | static int spl_nand_load_image(struct spl_image_info *spl_image, | 92 | static int spl_nand_load_image(struct spl_image_info *spl_image, |
81 | struct spl_boot_device *bootdev) | 93 | struct spl_boot_device *bootdev) |
82 | { | 94 | { |
83 | int err; | 95 | int err; |
84 | struct image_header *header; | 96 | struct image_header *header; |
85 | int *src __attribute__((unused)); | 97 | int *src __attribute__((unused)); |
86 | int *dst __attribute__((unused)); | 98 | int *dst __attribute__((unused)); |
87 | 99 | ||
88 | #ifdef CONFIG_SPL_NAND_SOFTECC | 100 | #ifdef CONFIG_SPL_NAND_SOFTECC |
89 | debug("spl: nand - using sw ecc\n"); | 101 | debug("spl: nand - using sw ecc\n"); |
90 | #else | 102 | #else |
91 | debug("spl: nand - using hw ecc\n"); | 103 | debug("spl: nand - using hw ecc\n"); |
92 | #endif | 104 | #endif |
93 | nand_init(); | 105 | nand_init(); |
94 | 106 | ||
95 | /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ | 107 | /*use CONFIG_SYS_TEXT_BASE as temporary storage area */ |
96 | header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); | 108 | header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); |
97 | #ifdef CONFIG_SPL_OS_BOOT | 109 | #ifdef CONFIG_SPL_OS_BOOT |
98 | if (!spl_start_uboot()) { | 110 | if (!spl_start_uboot()) { |
99 | /* | 111 | /* |
100 | * load parameter image | 112 | * load parameter image |
101 | * load to temp position since nand_spl_load_image reads | 113 | * load to temp position since nand_spl_load_image reads |
102 | * a whole block which is typically larger than | 114 | * a whole block which is typically larger than |
103 | * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite | 115 | * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite |
104 | * following sections like BSS | 116 | * following sections like BSS |
105 | */ | 117 | */ |
106 | nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS, | 118 | nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS, |
107 | CONFIG_CMD_SPL_WRITE_SIZE, | 119 | CONFIG_CMD_SPL_WRITE_SIZE, |
108 | (void *)CONFIG_SYS_TEXT_BASE); | 120 | (void *)CONFIG_SYS_TEXT_BASE); |
109 | /* copy to destintion */ | 121 | /* copy to destintion */ |
110 | for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR, | 122 | for (dst = (int *)CONFIG_SYS_SPL_ARGS_ADDR, |
111 | src = (int *)CONFIG_SYS_TEXT_BASE; | 123 | src = (int *)CONFIG_SYS_TEXT_BASE; |
112 | src < (int *)(CONFIG_SYS_TEXT_BASE + | 124 | src < (int *)(CONFIG_SYS_TEXT_BASE + |
113 | CONFIG_CMD_SPL_WRITE_SIZE); | 125 | CONFIG_CMD_SPL_WRITE_SIZE); |
114 | src++, dst++) { | 126 | src++, dst++) { |
115 | writel(readl(src), dst); | 127 | writel(readl(src), dst); |
116 | } | 128 | } |
117 | 129 | ||
118 | /* load linux */ | 130 | /* load linux */ |
119 | nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, | 131 | nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, |
120 | sizeof(*header), (void *)header); | 132 | sizeof(*header), (void *)header); |
121 | err = spl_parse_image_header(spl_image, header); | 133 | err = spl_parse_image_header(spl_image, header); |
122 | if (err) | 134 | if (err) |
123 | return err; | 135 | return err; |
124 | if (header->ih_os == IH_OS_LINUX) { | 136 | if (header->ih_os == IH_OS_LINUX) { |
125 | /* happy - was a linux */ | 137 | /* happy - was a linux */ |
126 | err = nand_spl_load_image( | 138 | err = nand_spl_load_image( |
127 | CONFIG_SYS_NAND_SPL_KERNEL_OFFS, | 139 | CONFIG_SYS_NAND_SPL_KERNEL_OFFS, |
128 | spl_image->size, | 140 | spl_image->size, |
129 | (void *)spl_image->load_addr); | 141 | (void *)spl_image->load_addr); |
130 | nand_deselect(); | 142 | nand_deselect(); |
131 | return err; | 143 | return err; |
132 | } else { | 144 | } else { |
133 | puts("The Expected Linux image was not " | 145 | puts("The Expected Linux image was not " |
134 | "found. Please check your NAND " | 146 | "found. Please check your NAND " |
135 | "configuration.\n"); | 147 | "configuration.\n"); |
136 | puts("Trying to start u-boot now...\n"); | 148 | puts("Trying to start u-boot now...\n"); |
137 | } | 149 | } |
138 | } | 150 | } |
139 | #endif | 151 | #endif |
140 | #ifdef CONFIG_NAND_ENV_DST | 152 | #ifdef CONFIG_NAND_ENV_DST |
141 | spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET, header); | 153 | spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET, header); |
142 | #ifdef CONFIG_ENV_OFFSET_REDUND | 154 | #ifdef CONFIG_ENV_OFFSET_REDUND |
143 | spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET_REDUND, header); | 155 | spl_nand_load_element(spl_image, CONFIG_ENV_OFFSET_REDUND, header); |
144 | #endif | 156 | #endif |
145 | #endif | 157 | #endif |
146 | /* Load u-boot */ | 158 | /* Load u-boot */ |
147 | err = spl_nand_load_element(spl_image, CONFIG_SYS_NAND_U_BOOT_OFFS, | 159 | err = spl_nand_load_element(spl_image, spl_nand_get_uboot_raw_page(), |
148 | header); | 160 | header); |
149 | #ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND | 161 | #ifdef CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND |
150 | #if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND | 162 | #if CONFIG_SYS_NAND_U_BOOT_OFFS != CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND |
151 | if (err) | 163 | if (err) |
152 | err = spl_nand_load_element(spl_image, | 164 | err = spl_nand_load_element(spl_image, |
153 | CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND, | 165 | CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND, |
154 | header); | 166 | header); |
155 | #endif | 167 | #endif |
156 | #endif | 168 | #endif |
157 | nand_deselect(); | 169 | nand_deselect(); |
158 | return err; | 170 | return err; |
159 | } | 171 | } |
160 | #endif | 172 | #endif |
161 | /* Use priorty 1 so that Ubi can override this */ | 173 | /* Use priorty 1 so that Ubi can override this */ |
162 | SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image); | 174 | SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image); |
163 | 175 |
include/configs/imx8qxp_arm2.h
1 | /* | 1 | /* |
2 | * Copyright 2017-2018 NXP | 2 | * Copyright 2017-2018 NXP |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: GPL-2.0+ | 4 | * SPDX-License-Identifier: GPL-2.0+ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __IMX8QXP_ARM2_H | 7 | #ifndef __IMX8QXP_ARM2_H |
8 | #define __IMX8QXP_ARM2_H | 8 | #define __IMX8QXP_ARM2_H |
9 | 9 | ||
10 | #include <linux/sizes.h> | 10 | #include <linux/sizes.h> |
11 | #include <asm/arch/imx-regs.h> | 11 | #include <asm/arch/imx-regs.h> |
12 | 12 | ||
13 | #include "imx_env.h" | 13 | #include "imx_env.h" |
14 | 14 | ||
15 | #ifdef CONFIG_SPL_BUILD | 15 | #ifdef CONFIG_SPL_BUILD |
16 | 16 | ||
17 | #define CONFIG_PARSE_CONTAINER | ||
18 | |||
17 | #ifdef CONFIG_QSPI_BOOT | 19 | #ifdef CONFIG_QSPI_BOOT |
18 | #define CONFIG_SPL_SPI_LOAD | 20 | #define CONFIG_SPL_SPI_LOAD |
19 | #endif | 21 | #endif |
20 | 22 | ||
21 | #define CONFIG_SPL_TEXT_BASE 0x0 | 23 | #define CONFIG_SPL_TEXT_BASE 0x0 |
22 | #define CONFIG_SPL_MAX_SIZE (124 * 1024) | 24 | #define CONFIG_SPL_MAX_SIZE (124 * 1024) |
23 | #define CONFIG_SYS_MONITOR_LEN (1024 * 1024) | 25 | #define CONFIG_SYS_MONITOR_LEN (1024 * 1024) |
24 | 26 | ||
25 | #ifdef CONFIG_NAND_BOOT | 27 | #ifdef CONFIG_NAND_BOOT |
28 | #ifndef CONFIG_PARSE_CONTAINER | ||
26 | #define CONFIG_SPL_NAND_RAW_ONLY | 29 | #define CONFIG_SPL_NAND_RAW_ONLY |
30 | #endif | ||
27 | #define CONFIG_SPL_NAND_SUPPORT | 31 | #define CONFIG_SPL_NAND_SUPPORT |
28 | #define CONFIG_SPL_DMA_SUPPORT | 32 | #define CONFIG_SPL_DMA_SUPPORT |
29 | #define CONFIG_SPL_NAND_MXS | 33 | #define CONFIG_SPL_NAND_MXS |
30 | #define CONFIG_SYS_NAND_U_BOOT_OFFS (0x4000000) /*Put the FIT out of first 64MB boot area */ | 34 | #define CONFIG_SYS_NAND_U_BOOT_OFFS (0x8000000) /*Put the FIT out of first 128MB boot area */ |
31 | #define CONFIG_SPL_NAND_BOOT | 35 | #define CONFIG_SPL_NAND_BOOT |
32 | #define CONFIG_SYS_NAND_U_BOOT_DST 0x80000000 | 36 | #define CONFIG_SYS_NAND_U_BOOT_DST 0x80000000 |
33 | #define CONFIG_SYS_NAND_U_BOOT_SIZE (1024 * 1024 ) | 37 | #define CONFIG_SYS_NAND_U_BOOT_SIZE (1024 * 1024 ) |
34 | 38 | ||
35 | #define CONFIG_SYS_NAND_U_BOOT_START 0x80000000 | 39 | #define CONFIG_SYS_NAND_U_BOOT_START 0x80000000 |
36 | #endif | 40 | #endif |
37 | 41 | ||
38 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR | 42 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR |
39 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x1040 /* (32K + 2Mb)/sector_size */ | 43 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x1040 /* (32K + 2Mb)/sector_size */ |
40 | #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 0 | 44 | #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 0 |
41 | 45 | ||
42 | 46 | ||
43 | #define CONFIG_SPL_WATCHDOG_SUPPORT | 47 | #define CONFIG_SPL_WATCHDOG_SUPPORT |
44 | #define CONFIG_SPL_DRIVERS_MISC_SUPPORT | 48 | #define CONFIG_SPL_DRIVERS_MISC_SUPPORT |
45 | #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv8/u-boot-spl.lds" | 49 | #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv8/u-boot-spl.lds" |
46 | #define CONFIG_SPL_STACK 0x013E000 | 50 | #define CONFIG_SPL_STACK 0x013E000 |
47 | #define CONFIG_SPL_LIBCOMMON_SUPPORT | 51 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
48 | #define CONFIG_SPL_LIBGENERIC_SUPPORT | 52 | #define CONFIG_SPL_LIBGENERIC_SUPPORT |
49 | #define CONFIG_SPL_SERIAL_SUPPORT | 53 | #define CONFIG_SPL_SERIAL_SUPPORT |
50 | #define CONFIG_SPL_BSS_START_ADDR 0x00138000 | 54 | #define CONFIG_SPL_BSS_START_ADDR 0x00138000 |
51 | #define CONFIG_SPL_BSS_MAX_SIZE 0x8000 /* 20 KB */ | 55 | #define CONFIG_SPL_BSS_MAX_SIZE 0x8000 /* 20 KB */ |
52 | #define CONFIG_SYS_SPL_MALLOC_START 0x00120000 | 56 | #define CONFIG_SYS_SPL_MALLOC_START 0x00120000 |
53 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x18000 /* 60 KB */ | 57 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x18000 /* 60 KB */ |
54 | #define CONFIG_SERIAL_LPUART_BASE 0x5a060000 | 58 | #define CONFIG_SERIAL_LPUART_BASE 0x5a060000 |
55 | #define CONFIG_SYS_ICACHE_OFF | 59 | #define CONFIG_SYS_ICACHE_OFF |
56 | #define CONFIG_SYS_DCACHE_OFF | 60 | #define CONFIG_SYS_DCACHE_OFF |
57 | #define CONFIG_MALLOC_F_ADDR 0x00120000 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */ | 61 | #define CONFIG_MALLOC_F_ADDR 0x00120000 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */ |
58 | 62 | ||
59 | #define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE | 63 | #define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE |
60 | 64 | ||
61 | #define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not panic */ | 65 | #define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not panic */ |
62 | 66 | ||
63 | #define CONFIG_OF_EMBED | 67 | #define CONFIG_OF_EMBED |
64 | #define CONFIG_ATF_TEXT_BASE 0x80000000 | 68 | #define CONFIG_ATF_TEXT_BASE 0x80000000 |
65 | #define CONFIG_SYS_ATF_START 0x80000000 | 69 | #define CONFIG_SYS_ATF_START 0x80000000 |
66 | /* #define CONFIG_FIT */ | 70 | /* #define CONFIG_FIT */ |
67 | 71 | ||
68 | /* Since the SPL runs before ATF, MU1 will not be started yet, so use MU0 */ | 72 | /* Since the SPL runs before ATF, MU1 will not be started yet, so use MU0 */ |
69 | #define SC_IPC_CH SC_IPC_AP_CH0 | 73 | #define SC_IPC_CH SC_IPC_AP_CH0 |
70 | 74 | ||
71 | #endif | 75 | #endif |
72 | 76 | ||
73 | #define CONFIG_REMAKE_ELF | 77 | #define CONFIG_REMAKE_ELF |
74 | 78 | ||
75 | #define CONFIG_BOARD_EARLY_INIT_F | 79 | #define CONFIG_BOARD_EARLY_INIT_F |
76 | #define CONFIG_ARCH_MISC_INIT | 80 | #define CONFIG_ARCH_MISC_INIT |
77 | 81 | ||
78 | /* Flat Device Tree Definitions */ | 82 | /* Flat Device Tree Definitions */ |
79 | #define CONFIG_OF_BOARD_SETUP | 83 | #define CONFIG_OF_BOARD_SETUP |
80 | 84 | ||
81 | #undef CONFIG_CMD_EXPORTENV | 85 | #undef CONFIG_CMD_EXPORTENV |
82 | #undef CONFIG_CMD_IMPORTENV | 86 | #undef CONFIG_CMD_IMPORTENV |
83 | #undef CONFIG_CMD_IMLS | 87 | #undef CONFIG_CMD_IMLS |
84 | 88 | ||
85 | #undef CONFIG_CMD_CRC32 | 89 | #undef CONFIG_CMD_CRC32 |
86 | #undef CONFIG_BOOTM_NETBSD | 90 | #undef CONFIG_BOOTM_NETBSD |
87 | 91 | ||
88 | #define CONFIG_FSL_ESDHC | 92 | #define CONFIG_FSL_ESDHC |
89 | #define CONFIG_FSL_USDHC | 93 | #define CONFIG_FSL_USDHC |
90 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 | 94 | #define CONFIG_SYS_FSL_ESDHC_ADDR 0 |
91 | #define USDHC1_BASE_ADDR 0x5B010000 | 95 | #define USDHC1_BASE_ADDR 0x5B010000 |
92 | #define USDHC2_BASE_ADDR 0x5B020000 | 96 | #define USDHC2_BASE_ADDR 0x5B020000 |
93 | #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ | 97 | #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ |
94 | 98 | ||
95 | #define CONFIG_ENV_OVERWRITE | 99 | #define CONFIG_ENV_OVERWRITE |
96 | 100 | ||
97 | 101 | ||
98 | #define CONFIG_FSL_HSIO | 102 | #define CONFIG_FSL_HSIO |
99 | #ifdef CONFIG_FSL_HSIO | 103 | #ifdef CONFIG_FSL_HSIO |
100 | #define CONFIG_PCIE_IMX8X | 104 | #define CONFIG_PCIE_IMX8X |
101 | #define CONFIG_CMD_PCI | 105 | #define CONFIG_CMD_PCI |
102 | #define CONFIG_PCI | 106 | #define CONFIG_PCI |
103 | #define CONFIG_PCI_PNP | 107 | #define CONFIG_PCI_PNP |
104 | #define CONFIG_PCI_SCAN_SHOW | 108 | #define CONFIG_PCI_SCAN_SHOW |
105 | #endif | 109 | #endif |
106 | 110 | ||
107 | #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG | 111 | #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
108 | 112 | ||
109 | /* FUSE command */ | 113 | /* FUSE command */ |
110 | #define CONFIG_CMD_FUSE | 114 | #define CONFIG_CMD_FUSE |
111 | 115 | ||
112 | /* GPIO configs */ | 116 | /* GPIO configs */ |
113 | #define CONFIG_MXC_GPIO | 117 | #define CONFIG_MXC_GPIO |
114 | 118 | ||
115 | /* ENET Config */ | 119 | /* ENET Config */ |
116 | #define CONFIG_MII | 120 | #define CONFIG_MII |
117 | 121 | ||
118 | #define CONFIG_FEC_MXC | 122 | #define CONFIG_FEC_MXC |
119 | #define CONFIG_FEC_XCV_TYPE RGMII | 123 | #define CONFIG_FEC_XCV_TYPE RGMII |
120 | #define FEC_QUIRK_ENET_MAC | 124 | #define FEC_QUIRK_ENET_MAC |
121 | 125 | ||
122 | #define CONFIG_PHY_GIGE /* Support for 1000BASE-X */ | 126 | #define CONFIG_PHY_GIGE /* Support for 1000BASE-X */ |
123 | #define CONFIG_PHYLIB | 127 | #define CONFIG_PHYLIB |
124 | #define CONFIG_PHY_ATHEROS | 128 | #define CONFIG_PHY_ATHEROS |
125 | 129 | ||
126 | /* ENET0 connects AR8031 on CPU board, ENET1 connects to base board and MUX with ESAI, default is ESAI */ | 130 | /* ENET0 connects AR8031 on CPU board, ENET1 connects to base board and MUX with ESAI, default is ESAI */ |
127 | #define CONFIG_FEC_ENET_DEV 0 | 131 | #define CONFIG_FEC_ENET_DEV 0 |
128 | 132 | ||
129 | #if (CONFIG_FEC_ENET_DEV == 0) | 133 | #if (CONFIG_FEC_ENET_DEV == 0) |
130 | #define IMX_FEC_BASE 0x5B040000 | 134 | #define IMX_FEC_BASE 0x5B040000 |
131 | #define CONFIG_FEC_MXC_PHYADDR 0x0 | 135 | #define CONFIG_FEC_MXC_PHYADDR 0x0 |
132 | #define CONFIG_ETHPRIME "eth0" | 136 | #define CONFIG_ETHPRIME "eth0" |
133 | #elif (CONFIG_FEC_ENET_DEV == 1) | 137 | #elif (CONFIG_FEC_ENET_DEV == 1) |
134 | #define IMX_FEC_BASE 0x5B050000 | 138 | #define IMX_FEC_BASE 0x5B050000 |
135 | #define CONFIG_FEC_MXC_PHYADDR 0x1 | 139 | #define CONFIG_FEC_MXC_PHYADDR 0x1 |
136 | #define CONFIG_FEC_ENABLE_MAX7322 | 140 | #define CONFIG_FEC_ENABLE_MAX7322 |
137 | #define CONFIG_ETHPRIME "eth1" | 141 | #define CONFIG_ETHPRIME "eth1" |
138 | #endif | 142 | #endif |
139 | 143 | ||
140 | /* ENET0 MDIO are shared */ | 144 | /* ENET0 MDIO are shared */ |
141 | #define CONFIG_FEC_MXC_MDIO_BASE 0x5B040000 | 145 | #define CONFIG_FEC_MXC_MDIO_BASE 0x5B040000 |
142 | 146 | ||
143 | #define CONFIG_LIB_RAND | 147 | #define CONFIG_LIB_RAND |
144 | #define CONFIG_NET_RANDOM_ETHADDR | 148 | #define CONFIG_NET_RANDOM_ETHADDR |
145 | 149 | ||
146 | /* MAX7322 */ | 150 | /* MAX7322 */ |
147 | #ifdef CONFIG_FEC_ENABLE_MAX7322 | 151 | #ifdef CONFIG_FEC_ENABLE_MAX7322 |
148 | #define CONFIG_MAX7322_I2C_ADDR 0x68 | 152 | #define CONFIG_MAX7322_I2C_ADDR 0x68 |
149 | #define CONFIG_MAX7322_I2C_BUS 0 /* I2C1 */ | 153 | #define CONFIG_MAX7322_I2C_BUS 0 /* I2C1 */ |
150 | #endif | 154 | #endif |
151 | 155 | ||
152 | #ifdef CONFIG_AHAB_BOOT | 156 | #ifdef CONFIG_AHAB_BOOT |
153 | #define AHAB_ENV "sec_boot=yes\0" | 157 | #define AHAB_ENV "sec_boot=yes\0" |
154 | #else | 158 | #else |
155 | #define AHAB_ENV "sec_boot=no\0" | 159 | #define AHAB_ENV "sec_boot=no\0" |
156 | #endif | 160 | #endif |
157 | 161 | ||
158 | /* Boot M4 */ | 162 | /* Boot M4 */ |
159 | #define M4_BOOT_ENV \ | 163 | #define M4_BOOT_ENV \ |
160 | "m4_0_image=m4_0.bin\0" \ | 164 | "m4_0_image=m4_0.bin\0" \ |
161 | "loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}\0" \ | 165 | "loadm4image_0=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4_0_image}\0" \ |
162 | "m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0\0" \ | 166 | "m4boot_0=run loadm4image_0; dcache flush; bootaux ${loadaddr} 0\0" \ |
163 | 167 | ||
164 | #ifdef CONFIG_NAND_BOOT | 168 | #ifdef CONFIG_NAND_BOOT |
165 | #define MFG_NAND_PARTITION "mtdparts=gpmi-nand:128m(nandboot),32m(nandkernel),16m(nanddtb),8m(nandtee),-(nandrootfs) " | 169 | #define MFG_NAND_PARTITION "mtdparts=gpmi-nand:128m(nandboot),16m(nandfit),32m(nandkernel),16m(nanddtb),8m(nandtee),-(nandrootfs) " |
166 | #else | ||
167 | #define MFG_NAND_PARTITION "" | ||
168 | #endif | 170 | #endif |
169 | 171 | ||
170 | #define CONFIG_MFG_ENV_SETTINGS \ | 172 | #define CONFIG_MFG_ENV_SETTINGS \ |
171 | CONFIG_MFG_ENV_SETTINGS_DEFAULT \ | 173 | CONFIG_MFG_ENV_SETTINGS_DEFAULT \ |
172 | "clk_ignore_unused "\ | 174 | "clk_ignore_unused "\ |
173 | "\0" \ | 175 | "\0" \ |
174 | "initrd_addr=0x83100000\0" \ | 176 | "initrd_addr=0x83100000\0" \ |
175 | "initrd_high=0xffffffffffffffff\0" \ | 177 | "initrd_high=0xffffffffffffffff\0" \ |
176 | "emmc_dev=0\0" \ | 178 | "emmc_dev=0\0" \ |
177 | "sd_dev=1\0" \ | 179 | "sd_dev=1\0" \ |
178 | "mtdparts=mtdparts=gpmi-nand:128m(nandboot),32m(nandkernel),16m(nanddtb),8m(nandtee),-(nandrootfs)\0" | ||
179 | 180 | ||
180 | /* Initial environment variables */ | 181 | /* Initial environment variables */ |
181 | #ifdef CONFIG_NAND_BOOT | 182 | #ifdef CONFIG_NAND_BOOT |
182 | #define CONFIG_EXTRA_ENV_SETTINGS \ | 183 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
183 | CONFIG_MFG_ENV_SETTINGS \ | 184 | CONFIG_MFG_ENV_SETTINGS \ |
184 | "bootargs=console=ttyLP0,115200 ubi.mtd=5 " \ | 185 | "bootargs=console=ttyLP0,115200 ubi.mtd=5 " \ |
185 | "root=ubi0:nandrootfs rootfstype=ubifs " \ | 186 | "root=ubi0:nandrootfs rootfstype=ubifs " \ |
186 | MFG_NAND_PARTITION \ | 187 | MFG_NAND_PARTITION \ |
187 | "\0"\ | 188 | "\0"\ |
188 | "console=ttyLP0,115200 earlycon=lpuart32,0x5a060000,115200\0" \ | 189 | "console=ttyLP0,115200 earlycon=lpuart32,0x5a060000,115200\0" \ |
190 | "mtdparts=" MFG_NAND_PARTITION "\0" \ | ||
189 | "fdt_addr=0x83000000\0" | 191 | "fdt_addr=0x83000000\0" |
190 | #else | 192 | #else |
191 | #define CONFIG_EXTRA_ENV_SETTINGS \ | 193 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
192 | CONFIG_MFG_ENV_SETTINGS \ | 194 | CONFIG_MFG_ENV_SETTINGS \ |
193 | M4_BOOT_ENV \ | 195 | M4_BOOT_ENV \ |
194 | AHAB_ENV \ | 196 | AHAB_ENV \ |
195 | "script=boot.scr\0" \ | 197 | "script=boot.scr\0" \ |
196 | "image=Image\0" \ | 198 | "image=Image\0" \ |
197 | "panel=NULL\0" \ | 199 | "panel=NULL\0" \ |
198 | "console=ttyLP0\0" \ | 200 | "console=ttyLP0\0" \ |
199 | "earlycon=lpuart32,0x5a060000\0" \ | 201 | "earlycon=lpuart32,0x5a060000\0" \ |
200 | "fdt_addr=0x83000000\0" \ | 202 | "fdt_addr=0x83000000\0" \ |
201 | "fdt_high=0xffffffffffffffff\0" \ | 203 | "fdt_high=0xffffffffffffffff\0" \ |
202 | "cntr_addr=0x88000000\0" \ | 204 | "cntr_addr=0x88000000\0" \ |
203 | "cntr_file=os_cntr_signed.bin\0" \ | 205 | "cntr_file=os_cntr_signed.bin\0" \ |
204 | "boot_fdt=try\0" \ | 206 | "boot_fdt=try\0" \ |
205 | "fdt_file=fsl-imx8qxp-lpddr4-arm2.dtb\0" \ | 207 | "fdt_file=fsl-imx8qxp-lpddr4-arm2.dtb\0" \ |
206 | "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ | 208 | "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ |
207 | "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ | 209 | "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ |
208 | "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ | 210 | "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ |
209 | "mmcautodetect=yes\0" \ | 211 | "mmcautodetect=yes\0" \ |
210 | "mmcargs=setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate} root=${mmcroot}\0 " \ | 212 | "mmcargs=setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate} root=${mmcroot}\0 " \ |
211 | "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ | 213 | "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
212 | "bootscript=echo Running bootscript from mmc ...; " \ | 214 | "bootscript=echo Running bootscript from mmc ...; " \ |
213 | "source\0" \ | 215 | "source\0" \ |
214 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ | 216 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ |
215 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ | 217 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ |
216 | "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \ | 218 | "loadcntr=fatload mmc ${mmcdev}:${mmcpart} ${cntr_addr} ${cntr_file}\0" \ |
217 | "auth_os=auth_cntr ${cntr_addr}\0" \ | 219 | "auth_os=auth_cntr ${cntr_addr}\0" \ |
218 | "mmcboot=echo Booting from mmc ...; " \ | 220 | "mmcboot=echo Booting from mmc ...; " \ |
219 | "run mmcargs; " \ | 221 | "run mmcargs; " \ |
220 | "if test ${sec_boot} = yes; then " \ | 222 | "if test ${sec_boot} = yes; then " \ |
221 | "if run auth_os; then " \ | 223 | "if run auth_os; then " \ |
222 | "booti ${loadaddr} - ${fdt_addr}; " \ | 224 | "booti ${loadaddr} - ${fdt_addr}; " \ |
223 | "else " \ | 225 | "else " \ |
224 | "echo ERR: failed to authenticate; " \ | 226 | "echo ERR: failed to authenticate; " \ |
225 | "fi; " \ | 227 | "fi; " \ |
226 | "else " \ | 228 | "else " \ |
227 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ | 229 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
228 | "if run loadfdt; then " \ | 230 | "if run loadfdt; then " \ |
229 | "booti ${loadaddr} - ${fdt_addr}; " \ | 231 | "booti ${loadaddr} - ${fdt_addr}; " \ |
230 | "else " \ | 232 | "else " \ |
231 | "echo WARN: Cannot load the DT; " \ | 233 | "echo WARN: Cannot load the DT; " \ |
232 | "fi; " \ | 234 | "fi; " \ |
233 | "else " \ | 235 | "else " \ |
234 | "echo wait for boot; " \ | 236 | "echo wait for boot; " \ |
235 | "fi;" \ | 237 | "fi;" \ |
236 | "fi;\0" \ | 238 | "fi;\0" \ |
237 | "netargs=setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate} " \ | 239 | "netargs=setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate} " \ |
238 | "root=/dev/nfs " \ | 240 | "root=/dev/nfs " \ |
239 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ | 241 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ |
240 | "netboot=echo Booting from net ...; " \ | 242 | "netboot=echo Booting from net ...; " \ |
241 | "run netargs; " \ | 243 | "run netargs; " \ |
242 | "if test ${ip_dyn} = yes; then " \ | 244 | "if test ${ip_dyn} = yes; then " \ |
243 | "setenv get_cmd dhcp; " \ | 245 | "setenv get_cmd dhcp; " \ |
244 | "else " \ | 246 | "else " \ |
245 | "setenv get_cmd tftp; " \ | 247 | "setenv get_cmd tftp; " \ |
246 | "fi; " \ | 248 | "fi; " \ |
247 | "if test ${sec_boot} = yes; then " \ | 249 | "if test ${sec_boot} = yes; then " \ |
248 | "${get_cmd} ${cntr_addr} ${cntr_file}; " \ | 250 | "${get_cmd} ${cntr_addr} ${cntr_file}; " \ |
249 | "if run auth_os; then " \ | 251 | "if run auth_os; then " \ |
250 | "booti ${loadaddr} - ${fdt_addr}; " \ | 252 | "booti ${loadaddr} - ${fdt_addr}; " \ |
251 | "else " \ | 253 | "else " \ |
252 | "echo ERR: failed to authenticate; " \ | 254 | "echo ERR: failed to authenticate; " \ |
253 | "fi; " \ | 255 | "fi; " \ |
254 | "else " \ | 256 | "else " \ |
255 | "${get_cmd} ${loadaddr} ${image}; " \ | 257 | "${get_cmd} ${loadaddr} ${image}; " \ |
256 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ | 258 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
257 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ | 259 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ |
258 | "booti ${loadaddr} - ${fdt_addr}; " \ | 260 | "booti ${loadaddr} - ${fdt_addr}; " \ |
259 | "else " \ | 261 | "else " \ |
260 | "echo WARN: Cannot load the DT; " \ | 262 | "echo WARN: Cannot load the DT; " \ |
261 | "fi; " \ | 263 | "fi; " \ |
262 | "else " \ | 264 | "else " \ |
263 | "booti; " \ | 265 | "booti; " \ |
264 | "fi;" \ | 266 | "fi;" \ |
265 | "fi;\0" | 267 | "fi;\0" |
266 | #endif | 268 | #endif |
267 | 269 | ||
268 | #ifdef CONFIG_NAND_BOOT | 270 | #ifdef CONFIG_NAND_BOOT |
269 | #define CONFIG_BOOTCOMMAND \ | 271 | #define CONFIG_BOOTCOMMAND \ |
270 | "nand read ${loadaddr} 0x8000000 0x2000000;"\ | 272 | "nand read ${loadaddr} 0x9000000 0x2000000;"\ |
271 | "nand read ${fdt_addr} 0xA000000 0x100000;"\ | 273 | "nand read ${fdt_addr} 0xB000000 0x100000;"\ |
272 | "booti ${loadaddr} - ${fdt_addr}" | 274 | "booti ${loadaddr} - ${fdt_addr}" |
273 | #else | 275 | #else |
274 | #define CONFIG_BOOTCOMMAND \ | 276 | #define CONFIG_BOOTCOMMAND \ |
275 | "mmc dev ${mmcdev}; if mmc rescan; then " \ | 277 | "mmc dev ${mmcdev}; if mmc rescan; then " \ |
276 | "if run loadbootscript; then " \ | 278 | "if run loadbootscript; then " \ |
277 | "run bootscript; " \ | 279 | "run bootscript; " \ |
278 | "else " \ | 280 | "else " \ |
279 | "if test ${sec_boot} = yes; then " \ | 281 | "if test ${sec_boot} = yes; then " \ |
280 | "if run loadcntr; then " \ | 282 | "if run loadcntr; then " \ |
281 | "run mmcboot; " \ | 283 | "run mmcboot; " \ |
282 | "else run netboot; " \ | 284 | "else run netboot; " \ |
283 | "fi; " \ | 285 | "fi; " \ |
284 | "else " \ | 286 | "else " \ |
285 | "if run loadimage; then " \ | 287 | "if run loadimage; then " \ |
286 | "run mmcboot; " \ | 288 | "run mmcboot; " \ |
287 | "else run netboot; " \ | 289 | "else run netboot; " \ |
288 | "fi; " \ | 290 | "fi; " \ |
289 | "fi; " \ | 291 | "fi; " \ |
290 | "fi; " \ | 292 | "fi; " \ |
291 | "else booti ${loadaddr} - ${fdt_addr}; fi" | 293 | "else booti ${loadaddr} - ${fdt_addr}; fi" |
292 | #endif | 294 | #endif |
293 | 295 | ||
294 | /* Link Definitions */ | 296 | /* Link Definitions */ |
295 | #define CONFIG_LOADADDR 0x80280000 | 297 | #define CONFIG_LOADADDR 0x80280000 |
296 | 298 | ||
297 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR | 299 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
298 | 300 | ||
299 | #define CONFIG_SYS_INIT_SP_ADDR 0x80200000 | 301 | #define CONFIG_SYS_INIT_SP_ADDR 0x80200000 |
300 | 302 | ||
301 | 303 | ||
302 | /* Default environment is in SD */ | 304 | /* Default environment is in SD */ |
303 | #define CONFIG_ENV_SIZE 0x2000 | 305 | #define CONFIG_ENV_SIZE 0x2000 |
304 | 306 | ||
305 | #ifdef CONFIG_NAND_BOOT | 307 | #ifdef CONFIG_NAND_BOOT |
306 | #define CONFIG_ENV_OFFSET (120 << 20) | 308 | #define CONFIG_ENV_OFFSET (120 << 20) |
307 | #elif defined(CONFIG_QSPI_BOOT) | 309 | #elif defined(CONFIG_QSPI_BOOT) |
308 | #define CONFIG_ENV_OFFSET (4 * 1024 * 1024) | 310 | #define CONFIG_ENV_OFFSET (4 * 1024 * 1024) |
309 | #define CONFIG_ENV_SECT_SIZE (128 * 1024) | 311 | #define CONFIG_ENV_SECT_SIZE (128 * 1024) |
310 | #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS | 312 | #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS |
311 | #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS | 313 | #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS |
312 | #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE | 314 | #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE |
313 | #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED | 315 | #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED |
314 | #else | 316 | #else |
315 | #define CONFIG_ENV_OFFSET (64 * SZ_64K) | 317 | #define CONFIG_ENV_OFFSET (64 * SZ_64K) |
316 | #define CONFIG_SYS_MMC_ENV_PART 0 /* user area */ | 318 | #define CONFIG_SYS_MMC_ENV_PART 0 /* user area */ |
317 | #endif | 319 | #endif |
318 | 320 | ||
319 | #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 | 321 | #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 |
320 | 322 | ||
321 | /* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board | 323 | /* On LPDDR4 board, USDHC1 is for eMMC, USDHC2 is for SD on CPU board |
322 | */ | 324 | */ |
323 | #ifdef CONFIG_TARGET_IMX8DX_DDR3_ARM2 | 325 | #ifdef CONFIG_TARGET_IMX8DX_DDR3_ARM2 |
324 | #define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC1 */ | 326 | #define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC1 */ |
325 | #define CONFIG_MMCROOT "/dev/mmcblk0p2" /* USDHC1 */ | 327 | #define CONFIG_MMCROOT "/dev/mmcblk0p2" /* USDHC1 */ |
326 | #define CONFIG_SYS_FSL_USDHC_NUM 1 | 328 | #define CONFIG_SYS_FSL_USDHC_NUM 1 |
327 | #else | 329 | #else |
328 | #define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC2 */ | 330 | #define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC2 */ |
329 | #define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */ | 331 | #define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */ |
330 | #define CONFIG_SYS_FSL_USDHC_NUM 2 | 332 | #define CONFIG_SYS_FSL_USDHC_NUM 2 |
331 | #endif | 333 | #endif |
332 | 334 | ||
333 | /* Size of malloc() pool */ | 335 | /* Size of malloc() pool */ |
334 | #define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (32*1024)) * 1024) | 336 | #define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (32*1024)) * 1024) |
335 | 337 | ||
336 | #define CONFIG_SYS_SDRAM_BASE 0x80000000 | 338 | #define CONFIG_SYS_SDRAM_BASE 0x80000000 |
337 | #define CONFIG_NR_DRAM_BANKS 4 | 339 | #define CONFIG_NR_DRAM_BANKS 4 |
338 | #define PHYS_SDRAM_1 0x80000000 | 340 | #define PHYS_SDRAM_1 0x80000000 |
339 | #define PHYS_SDRAM_2 0x880000000 | 341 | #define PHYS_SDRAM_2 0x880000000 |
340 | #if defined(CONFIG_TARGET_IMX8QXP_DDR3_ARM2) || defined(CONFIG_TARGET_IMX8DX_DDR3_ARM2) | 342 | #if defined(CONFIG_TARGET_IMX8QXP_DDR3_ARM2) || defined(CONFIG_TARGET_IMX8DX_DDR3_ARM2) |
341 | #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1 GB */ | 343 | #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1 GB */ |
342 | /* LPDDR4 board total DDR is 3GB */ | 344 | /* LPDDR4 board total DDR is 3GB */ |
343 | #define PHYS_SDRAM_2_SIZE 0x00000000 | 345 | #define PHYS_SDRAM_2_SIZE 0x00000000 |
344 | #else | 346 | #else |
345 | #define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */ | 347 | #define PHYS_SDRAM_1_SIZE 0x80000000 /* 2 GB */ |
346 | /* LPDDR4 board total DDR is 3GB */ | 348 | /* LPDDR4 board total DDR is 3GB */ |
347 | #define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */ | 349 | #define PHYS_SDRAM_2_SIZE 0x40000000 /* 1 GB */ |
348 | #endif | 350 | #endif |
349 | 351 | ||
350 | #define CONFIG_SYS_MEMTEST_START 0xA0000000 | 352 | #define CONFIG_SYS_MEMTEST_START 0xA0000000 |
351 | #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (PHYS_SDRAM_1_SIZE >> 2)) | 353 | #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (PHYS_SDRAM_1_SIZE >> 2)) |
352 | 354 | ||
353 | /* Serial */ | 355 | /* Serial */ |
354 | #define CONFIG_BAUDRATE 115200 | 356 | #define CONFIG_BAUDRATE 115200 |
355 | 357 | ||
356 | /* Monitor Command Prompt */ | 358 | /* Monitor Command Prompt */ |
357 | #define CONFIG_HUSH_PARSER | 359 | #define CONFIG_HUSH_PARSER |
358 | #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " | 360 | #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " |
359 | #define CONFIG_SYS_CBSIZE 1024 | 361 | #define CONFIG_SYS_CBSIZE 1024 |
360 | #define CONFIG_SYS_MAXARGS 64 | 362 | #define CONFIG_SYS_MAXARGS 64 |
361 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | 363 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
362 | #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ | 364 | #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ |
363 | sizeof(CONFIG_SYS_PROMPT) + 16) | 365 | sizeof(CONFIG_SYS_PROMPT) + 16) |
364 | 366 | ||
365 | /* Generic Timer Definitions */ | 367 | /* Generic Timer Definitions */ |
366 | #define COUNTER_FREQUENCY 8000000 /* 8MHz */ | 368 | #define COUNTER_FREQUENCY 8000000 /* 8MHz */ |
367 | 369 | ||
368 | #ifndef CONFIG_DM_PCA953X | 370 | #ifndef CONFIG_DM_PCA953X |
369 | #define CONFIG_PCA953X | 371 | #define CONFIG_PCA953X |
370 | #define CONFIG_CMD_PCA953X | 372 | #define CONFIG_CMD_PCA953X |
371 | #define CONFIG_CMD_PCA953X_INFO | 373 | #define CONFIG_CMD_PCA953X_INFO |
372 | #endif | 374 | #endif |
373 | 375 | ||
374 | #define CONFIG_IMX_SMMU | 376 | #define CONFIG_IMX_SMMU |
375 | 377 | ||
376 | /* MT35XU512ABA1G12 has only one Die, so QSPI0 B won't work */ | 378 | /* MT35XU512ABA1G12 has only one Die, so QSPI0 B won't work */ |
377 | #ifdef CONFIG_FSL_FSPI | 379 | #ifdef CONFIG_FSL_FSPI |
378 | #define CONFIG_SF_DEFAULT_BUS 0 | 380 | #define CONFIG_SF_DEFAULT_BUS 0 |
379 | #define CONFIG_SF_DEFAULT_CS 0 | 381 | #define CONFIG_SF_DEFAULT_CS 0 |
380 | #define CONFIG_SF_DEFAULT_SPEED 40000000 | 382 | #define CONFIG_SF_DEFAULT_SPEED 40000000 |
381 | #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 | 383 | #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 |
382 | #define FSL_FSPI_FLASH_SIZE SZ_64M | 384 | #define FSL_FSPI_FLASH_SIZE SZ_64M |
383 | #define FSL_FSPI_FLASH_NUM 1 | 385 | #define FSL_FSPI_FLASH_NUM 1 |
384 | #define FSPI0_BASE_ADDR 0x5d120000 | 386 | #define FSPI0_BASE_ADDR 0x5d120000 |
385 | #define FSPI0_AMBA_BASE 0 | 387 | #define FSPI0_AMBA_BASE 0 |
386 | #define CONFIG_SYS_FSL_FSPI_AHB | 388 | #define CONFIG_SYS_FSL_FSPI_AHB |
387 | #endif | 389 | #endif |
388 | 390 | ||
389 | #ifdef CONFIG_CMD_NAND | 391 | #ifdef CONFIG_CMD_NAND |
390 | #define CONFIG_NAND_MXS | 392 | #define CONFIG_NAND_MXS |
391 | #define CONFIG_CMD_NAND_TRIMFFS | 393 | #define CONFIG_CMD_NAND_TRIMFFS |
392 | 394 | ||
393 | /* NAND stuff */ | 395 | /* NAND stuff */ |
394 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 | 396 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
395 | #define CONFIG_SYS_NAND_BASE 0x40000000 | 397 | #define CONFIG_SYS_NAND_BASE 0x40000000 |
396 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE | 398 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE |
397 | #define CONFIG_SYS_NAND_ONFI_DETECTION | 399 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
398 | 400 | ||
399 | /* DMA stuff, needed for GPMI/MXS NAND support */ | 401 | /* DMA stuff, needed for GPMI/MXS NAND support */ |
400 | #define CONFIG_APBH_DMA | 402 | #define CONFIG_APBH_DMA |
401 | #define CONFIG_APBH_DMA_BURST | 403 | #define CONFIG_APBH_DMA_BURST |
402 | #define CONFIG_APBH_DMA_BURST8 | 404 | #define CONFIG_APBH_DMA_BURST8 |
403 | #endif | 405 | #endif |
404 | 406 | ||
405 | /* USB Config */ | 407 | /* USB Config */ |
406 | #ifdef CONFIG_CMD_USB | 408 | #ifdef CONFIG_CMD_USB |
407 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 | 409 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
408 | 410 | ||
409 | /* USB OTG controller configs */ | 411 | /* USB OTG controller configs */ |
410 | #ifdef CONFIG_USB_EHCI_HCD | 412 | #ifdef CONFIG_USB_EHCI_HCD |
411 | #define CONFIG_USB_HOST_ETHER | 413 | #define CONFIG_USB_HOST_ETHER |
412 | #define CONFIG_USB_ETHER_ASIX | 414 | #define CONFIG_USB_ETHER_ASIX |
413 | #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) | 415 | #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) |
414 | #endif | 416 | #endif |
415 | #endif /* CONFIG_CMD_USB */ | 417 | #endif /* CONFIG_CMD_USB */ |
416 | 418 | ||
417 | #ifdef CONFIG_USB_GADGET | 419 | #ifdef CONFIG_USB_GADGET |
418 | #define CONFIG_USBD_HS | 420 | #define CONFIG_USBD_HS |
419 | #endif | 421 | #endif |
420 | 422 | ||
421 | #if defined(CONFIG_ANDROID_SUPPORT) | 423 | #if defined(CONFIG_ANDROID_SUPPORT) |
422 | #include "imx8qxp_arm2_android.h" | 424 | #include "imx8qxp_arm2_android.h" |
423 | #endif | 425 | #endif |
424 | 426 | ||
425 | /* Framebuffer */ | 427 | /* Framebuffer */ |
426 | #ifdef CONFIG_VIDEO | 428 | #ifdef CONFIG_VIDEO |
427 | #define CONFIG_VIDEO_IMXDPUV1 | 429 | #define CONFIG_VIDEO_IMXDPUV1 |
428 | #define CONFIG_VIDEO_BMP_RLE8 | 430 | #define CONFIG_VIDEO_BMP_RLE8 |
429 | #define CONFIG_SPLASH_SCREEN | 431 | #define CONFIG_SPLASH_SCREEN |
430 | #define CONFIG_SPLASH_SCREEN_ALIGN | 432 | #define CONFIG_SPLASH_SCREEN_ALIGN |
431 | #define CONFIG_BMP_16BPP | 433 | #define CONFIG_BMP_16BPP |
432 | #define CONFIG_VIDEO_LOGO | 434 | #define CONFIG_VIDEO_LOGO |
433 | #define CONFIG_VIDEO_BMP_LOGO | 435 | #define CONFIG_VIDEO_BMP_LOGO |
434 | #define CONFIG_IMX_VIDEO_SKIP | 436 | #define CONFIG_IMX_VIDEO_SKIP |
435 | #endif | 437 | #endif |
436 | 438 | ||
437 | #define CONFIG_OF_SYSTEM_SETUP | 439 | #define CONFIG_OF_SYSTEM_SETUP |
438 | #define BOOTAUX_RESERVED_MEM_BASE 0x88000000 | 440 | #define BOOTAUX_RESERVED_MEM_BASE 0x88000000 |
439 | #define BOOTAUX_RESERVED_MEM_SIZE 0x08000000 /* Reserve from second 128MB */ | 441 | #define BOOTAUX_RESERVED_MEM_SIZE 0x08000000 /* Reserve from second 128MB */ |
440 | 442 | ||
441 | #define CONFIG_CMD_READ | 443 | #define CONFIG_CMD_READ |
442 | #define CONFIG_SERIAL_TAG | 444 | #define CONFIG_SERIAL_TAG |