Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 2 | /* |
Stefan Roese | 44e7ebd | 2016-01-07 14:09:09 +0100 | [diff] [blame] | 3 | * Copyright (C) 2014-2016 Stefan Roese <sr@denx.de> |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Stefan Roese | 83097cf | 2015-11-25 07:37:00 +0100 | [diff] [blame] | 7 | #include <dm.h> |
Stefan Roese | 83097cf | 2015-11-25 07:37:00 +0100 | [diff] [blame] | 8 | #include <fdtdec.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 9 | #include <hang.h> |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 10 | #include <image.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 11 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 12 | #include <log.h> |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 13 | #include <spl.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 14 | #include <asm/global_data.h> |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 15 | #include <asm/io.h> |
| 16 | #include <asm/arch/cpu.h> |
| 17 | #include <asm/arch/soc.h> |
| 18 | |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 19 | #if defined(CONFIG_SPL_SPI_FLASH_SUPPORT) || defined(CONFIG_SPL_MMC) || \ |
Simon Glass | 081a45a | 2021-08-08 12:20:17 -0600 | [diff] [blame] | 20 | defined(CONFIG_SPL_SATA) |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * When loading U-Boot via SPL from SPI NOR, CONFIG_SYS_SPI_U_BOOT_OFFS must |
| 24 | * point to the offset of kwbimage main header which is always at offset zero |
| 25 | * (defined by BootROM). Therefore other values of CONFIG_SYS_SPI_U_BOOT_OFFS |
| 26 | * makes U-Boot non-bootable. |
| 27 | */ |
| 28 | #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT |
| 29 | #if defined(CONFIG_SYS_SPI_U_BOOT_OFFS) && CONFIG_SYS_SPI_U_BOOT_OFFS != 0 |
| 30 | #error CONFIG_SYS_SPI_U_BOOT_OFFS must be set to 0 |
| 31 | #endif |
| 32 | #endif |
| 33 | |
| 34 | /* |
| 35 | * When loading U-Boot via SPL from eMMC (in Marvell terminology SDIO), the |
| 36 | * kwbimage main header is stored at sector 0. U-Boot SPL needs to parse this |
| 37 | * header and figure out at which sector the U-Boot proper binary is stored. |
| 38 | * Partition booting is therefore not supported and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR |
| 39 | * and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET need to point to the |
| 40 | * kwbimage main header. |
| 41 | */ |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 42 | #ifdef CONFIG_SPL_MMC |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 43 | #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION |
| 44 | #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is unsupported |
| 45 | #endif |
| 46 | #if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) && CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR != 0 |
| 47 | #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0 |
| 48 | #endif |
| 49 | #if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) && CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 |
| 50 | #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to 0 |
| 51 | #endif |
| 52 | #endif |
| 53 | |
| 54 | /* |
| 55 | * When loading U-Boot via SPL from SATA disk, the kwbimage main header is |
| 56 | * stored at sector 1. Therefore CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR must be |
| 57 | * set to 1. Otherwise U-Boot SPL would not be able to load U-Boot proper. |
| 58 | */ |
Simon Glass | 081a45a | 2021-08-08 12:20:17 -0600 | [diff] [blame] | 59 | #ifdef CONFIG_SPL_SATA |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 60 | #if !defined(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR) || !defined(CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR) || CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR != 1 |
| 61 | #error CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR must be set to 1 |
| 62 | #endif |
| 63 | #endif |
| 64 | |
| 65 | /* Boot Type - block ID */ |
| 66 | #define IBR_HDR_I2C_ID 0x4D |
| 67 | #define IBR_HDR_SPI_ID 0x5A |
| 68 | #define IBR_HDR_NAND_ID 0x8B |
| 69 | #define IBR_HDR_SATA_ID 0x78 |
| 70 | #define IBR_HDR_PEX_ID 0x9C |
| 71 | #define IBR_HDR_UART_ID 0x69 |
| 72 | #define IBR_HDR_SDIO_ID 0xAE |
| 73 | |
Pali Rohár | 0f7df22 | 2021-10-22 12:41:10 +0200 | [diff] [blame] | 74 | /* Structure of the main header, version 1 (Armada 370/XP/375/38x/39x) */ |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 75 | struct kwbimage_main_hdr_v1 { |
| 76 | uint8_t blockid; /* 0x0 */ |
| 77 | uint8_t flags; /* 0x1 */ |
Pali Rohár | 7fea884 | 2021-10-22 12:37:48 +0200 | [diff] [blame] | 78 | uint16_t nandpagesize; /* 0x2-0x3 */ |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 79 | uint32_t blocksize; /* 0x4-0x7 */ |
| 80 | uint8_t version; /* 0x8 */ |
| 81 | uint8_t headersz_msb; /* 0x9 */ |
| 82 | uint16_t headersz_lsb; /* 0xA-0xB */ |
| 83 | uint32_t srcaddr; /* 0xC-0xF */ |
| 84 | uint32_t destaddr; /* 0x10-0x13 */ |
| 85 | uint32_t execaddr; /* 0x14-0x17 */ |
| 86 | uint8_t options; /* 0x18 */ |
| 87 | uint8_t nandblocksize; /* 0x19 */ |
| 88 | uint8_t nandbadblklocation; /* 0x1A */ |
| 89 | uint8_t reserved4; /* 0x1B */ |
| 90 | uint16_t reserved5; /* 0x1C-0x1D */ |
| 91 | uint8_t ext; /* 0x1E */ |
| 92 | uint8_t checksum; /* 0x1F */ |
| 93 | } __packed; |
| 94 | |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 95 | #ifdef CONFIG_SPL_MMC |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 96 | u32 spl_mmc_boot_mode(const u32 boot_device) |
| 97 | { |
| 98 | return MMCSD_MODE_RAW; |
| 99 | } |
| 100 | #endif |
| 101 | |
Pali Rohár | 8242056 | 2022-01-14 14:31:41 +0100 | [diff] [blame] | 102 | static u32 checksum32(void *start, u32 len) |
| 103 | { |
| 104 | u32 csum = 0; |
| 105 | u32 *p = start; |
| 106 | |
| 107 | while (len > 0) { |
| 108 | csum += *p++; |
| 109 | len -= sizeof(u32); |
| 110 | }; |
| 111 | |
| 112 | return csum; |
| 113 | } |
| 114 | |
| 115 | int spl_check_board_image(struct spl_image_info *spl_image, |
| 116 | const struct spl_boot_device *bootdev) |
| 117 | { |
| 118 | u32 csum = *(u32 *)(spl_image->load_addr + spl_image->size - 4); |
| 119 | |
| 120 | if (checksum32((void *)spl_image->load_addr, |
| 121 | spl_image->size - 4) != csum) { |
| 122 | printf("ERROR: Invalid data checksum in kwbimage\n"); |
| 123 | return -EINVAL; |
| 124 | } |
| 125 | |
| 126 | return 0; |
| 127 | } |
| 128 | |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 129 | int spl_parse_board_header(struct spl_image_info *spl_image, |
Pali Rohár | dda8f88 | 2022-01-14 14:31:38 +0100 | [diff] [blame] | 130 | const struct spl_boot_device *bootdev, |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 131 | const void *image_header, size_t size) |
| 132 | { |
| 133 | const struct kwbimage_main_hdr_v1 *mhdr = image_header; |
| 134 | |
| 135 | if (size < sizeof(*mhdr)) { |
| 136 | /* This should be compile time assert */ |
| 137 | printf("FATAL ERROR: Image header size is too small\n"); |
| 138 | hang(); |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * Very basic check for image validity. We cannot check mhdr->checksum |
| 143 | * as it is calculated also from variable length extended headers |
| 144 | * (including SPL content) which is not included in U-Boot image_header. |
| 145 | */ |
| 146 | if (mhdr->version != 1 || |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 147 | ((mhdr->headersz_msb << 16) | mhdr->headersz_lsb) < sizeof(*mhdr)) { |
| 148 | printf("ERROR: Invalid kwbimage v1\n"); |
| 149 | return -EINVAL; |
| 150 | } |
| 151 | |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 152 | #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 153 | if (bootdev->boot_device == BOOT_DEVICE_SPI && |
| 154 | mhdr->blockid != IBR_HDR_SPI_ID) { |
| 155 | printf("ERROR: Wrong blockid (0x%x) in SPI kwbimage\n", |
| 156 | mhdr->blockid); |
| 157 | return -EINVAL; |
| 158 | } |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 159 | #endif |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 160 | |
Simon Glass | 081a45a | 2021-08-08 12:20:17 -0600 | [diff] [blame] | 161 | #ifdef CONFIG_SPL_SATA |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 162 | if (bootdev->boot_device == BOOT_DEVICE_SATA && |
| 163 | mhdr->blockid != IBR_HDR_SATA_ID) { |
| 164 | printf("ERROR: Wrong blockid (0x%x) in SATA kwbimage\n", |
| 165 | mhdr->blockid); |
| 166 | return -EINVAL; |
| 167 | } |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 168 | #endif |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 169 | |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 170 | #ifdef CONFIG_SPL_MMC |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 171 | if ((bootdev->boot_device == BOOT_DEVICE_MMC1 || |
| 172 | bootdev->boot_device == BOOT_DEVICE_MMC2 || |
| 173 | bootdev->boot_device == BOOT_DEVICE_MMC2_2) && |
| 174 | mhdr->blockid != IBR_HDR_SDIO_ID) { |
| 175 | printf("ERROR: Wrong blockid (0x%x) in SDIO kwbimage\n", |
| 176 | mhdr->blockid); |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 177 | return -EINVAL; |
| 178 | } |
Pali Rohár | a157e12 | 2022-01-14 14:31:39 +0100 | [diff] [blame] | 179 | #endif |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 180 | |
| 181 | spl_image->offset = mhdr->srcaddr; |
| 182 | |
Simon Glass | 081a45a | 2021-08-08 12:20:17 -0600 | [diff] [blame] | 183 | #ifdef CONFIG_SPL_SATA |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 184 | /* |
| 185 | * For SATA srcaddr is specified in number of sectors. |
| 186 | * The main header is must be stored at sector number 1. |
| 187 | * This expects that sector size is 512 bytes and recalculates |
| 188 | * data offset to bytes relative to the main header. |
| 189 | */ |
| 190 | if (mhdr->blockid == IBR_HDR_SATA_ID) { |
| 191 | if (spl_image->offset < 1) { |
Marek Behún | 46c871a | 2022-01-14 14:31:42 +0100 | [diff] [blame^] | 192 | printf("ERROR: Wrong srcaddr (0x%08x) in SATA kwbimage\n", |
| 193 | spl_image->offset); |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 194 | return -EINVAL; |
| 195 | } |
| 196 | spl_image->offset -= 1; |
| 197 | spl_image->offset *= 512; |
| 198 | } |
| 199 | #endif |
| 200 | |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 201 | #ifdef CONFIG_SPL_MMC |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 202 | /* |
| 203 | * For SDIO (eMMC) srcaddr is specified in number of sectors. |
| 204 | * This expects that sector size is 512 bytes and recalculates |
| 205 | * data offset to bytes. |
| 206 | */ |
| 207 | if (mhdr->blockid == IBR_HDR_SDIO_ID) |
| 208 | spl_image->offset *= 512; |
| 209 | #endif |
| 210 | |
Pali Rohár | eb7e1fc | 2022-01-14 14:31:37 +0100 | [diff] [blame] | 211 | if (spl_image->offset % 4 != 0) { |
| 212 | printf("ERROR: Wrong srcaddr (0x%08x) in kwbimage\n", |
| 213 | spl_image->offset); |
| 214 | return -EINVAL; |
| 215 | } |
| 216 | |
| 217 | if (mhdr->blocksize <= 4 || mhdr->blocksize % 4 != 0) { |
| 218 | printf("ERROR: Wrong blocksize (0x%08x) in kwbimage\n", |
| 219 | mhdr->blocksize); |
| 220 | return -EINVAL; |
| 221 | } |
| 222 | |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 223 | spl_image->size = mhdr->blocksize; |
| 224 | spl_image->entry_point = mhdr->execaddr; |
| 225 | spl_image->load_addr = mhdr->destaddr; |
| 226 | spl_image->os = IH_OS_U_BOOT; |
| 227 | spl_image->name = "U-Boot"; |
| 228 | |
| 229 | return 0; |
| 230 | } |
| 231 | |
Stefan Roese | 44e7ebd | 2016-01-07 14:09:09 +0100 | [diff] [blame] | 232 | u32 spl_boot_device(void) |
| 233 | { |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 234 | u32 boot_device = get_boot_device(); |
| 235 | |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 236 | switch (boot_device) { |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 237 | /* |
| 238 | * Return to the BootROM to continue the Marvell xmodem |
| 239 | * UART boot protocol. As initiated by the kwboot tool. |
| 240 | * |
| 241 | * This can only be done by the BootROM since the beginning |
| 242 | * of the image is already read and interpreted by the BootROM. |
| 243 | * SPL has no chance to receive this information. So we |
| 244 | * need to return to the BootROM to enable this xmodem |
| 245 | * UART download. Use SPL infrastructure to return to BootROM. |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 246 | */ |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 247 | case BOOT_DEVICE_UART: |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 248 | return BOOT_DEVICE_BOOTROM; |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 249 | |
| 250 | /* |
| 251 | * If SPL is compiled with chosen boot_device support |
| 252 | * then use SPL driver for loading U-Boot proper. |
| 253 | */ |
Simon Glass | b58bfe0 | 2021-08-08 12:20:09 -0600 | [diff] [blame] | 254 | #ifdef CONFIG_SPL_MMC |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 255 | case BOOT_DEVICE_MMC1: |
| 256 | return BOOT_DEVICE_MMC1; |
| 257 | #endif |
Simon Glass | 081a45a | 2021-08-08 12:20:17 -0600 | [diff] [blame] | 258 | #ifdef CONFIG_SPL_SATA |
Pali Rohár | 90a8898 | 2021-10-29 14:09:48 +0200 | [diff] [blame] | 259 | case BOOT_DEVICE_SATA: |
| 260 | return BOOT_DEVICE_SATA; |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 261 | #endif |
| 262 | #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT |
| 263 | case BOOT_DEVICE_SPI: |
| 264 | return BOOT_DEVICE_SPI; |
| 265 | #endif |
| 266 | |
| 267 | /* |
| 268 | * If SPL is not compiled with chosen boot_device support |
| 269 | * then return to the BootROM. BootROM supports loading |
| 270 | * U-Boot proper from any valid boot_device present in SAR |
| 271 | * register. |
| 272 | */ |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 273 | default: |
Pali Rohár | cf97b82 | 2021-07-23 11:14:29 +0200 | [diff] [blame] | 274 | return BOOT_DEVICE_BOOTROM; |
Pali Rohár | da1be86 | 2021-07-23 11:14:26 +0200 | [diff] [blame] | 275 | } |
Stefan Roese | 6396213 | 2015-07-20 11:20:36 +0200 | [diff] [blame] | 276 | } |
| 277 | |
Marek Behún | ee76b4a | 2021-08-16 15:19:37 +0200 | [diff] [blame] | 278 | #else |
| 279 | |
| 280 | u32 spl_boot_device(void) |
| 281 | { |
| 282 | return BOOT_DEVICE_BOOTROM; |
| 283 | } |
| 284 | |
| 285 | #endif |
| 286 | |
Pali Rohár | a3a38e5 | 2021-07-23 11:14:25 +0200 | [diff] [blame] | 287 | int board_return_to_bootrom(struct spl_image_info *spl_image, |
| 288 | struct spl_boot_device *bootdev) |
| 289 | { |
| 290 | u32 *regs = *(u32 **)CONFIG_SPL_BOOTROM_SAVE; |
| 291 | |
| 292 | printf("Returning to BootROM (return address 0x%08x)...\n", regs[13]); |
| 293 | return_to_bootrom(); |
| 294 | |
| 295 | /* NOTREACHED - return_to_bootrom() does not return */ |
| 296 | hang(); |
| 297 | } |
| 298 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 299 | void board_init_f(ulong dummy) |
| 300 | { |
Stefan Roese | 83097cf | 2015-11-25 07:37:00 +0100 | [diff] [blame] | 301 | int ret; |
| 302 | |
Stefan Roese | d7f2c12 | 2015-04-17 18:13:06 +0200 | [diff] [blame] | 303 | /* |
| 304 | * Pin muxing needs to be done before UART output, since |
| 305 | * on A38x the UART pins need some re-muxing for output |
| 306 | * to work. |
| 307 | */ |
| 308 | board_early_init_f(); |
| 309 | |
Stefan Roese | 85bddff | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 310 | /* |
| 311 | * Use special translation offset for SPL. This needs to be |
| 312 | * configured *before* spl_init() is called as this function |
| 313 | * calls dm_init() which calls the bind functions of the |
| 314 | * device drivers. Here the base address needs to be configured |
| 315 | * (translated) correctly. |
| 316 | */ |
| 317 | gd->translation_offset = 0xd0000000 - 0xf1000000; |
| 318 | |
Stefan Roese | 83097cf | 2015-11-25 07:37:00 +0100 | [diff] [blame] | 319 | ret = spl_init(); |
| 320 | if (ret) { |
Pali Rohár | 6e86351 | 2021-12-17 18:31:14 +0100 | [diff] [blame] | 321 | printf("spl_init() failed: %d\n", ret); |
Stefan Roese | 83097cf | 2015-11-25 07:37:00 +0100 | [diff] [blame] | 322 | hang(); |
| 323 | } |
| 324 | |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 325 | preloader_console_init(); |
| 326 | |
Stefan Roese | d04fe8b | 2015-07-15 15:36:52 +0200 | [diff] [blame] | 327 | timer_init(); |
| 328 | |
Stefan Roese | 479f9af | 2016-02-10 07:23:00 +0100 | [diff] [blame] | 329 | /* Armada 375 does not support SerDes and DDR3 init yet */ |
| 330 | #if !defined(CONFIG_ARMADA_375) |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 331 | /* First init the serdes PHY's */ |
| 332 | serdes_phy_config(); |
| 333 | |
| 334 | /* Setup DDR */ |
Pali Rohár | c87978a | 2021-08-09 17:44:35 +0200 | [diff] [blame] | 335 | ret = ddr3_init(); |
| 336 | if (ret) { |
Pali Rohár | 6e86351 | 2021-12-17 18:31:14 +0100 | [diff] [blame] | 337 | printf("ddr3_init() failed: %d\n", ret); |
Pali Rohár | c87978a | 2021-08-09 17:44:35 +0200 | [diff] [blame] | 338 | hang(); |
| 339 | } |
Stefan Roese | 479f9af | 2016-02-10 07:23:00 +0100 | [diff] [blame] | 340 | #endif |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 341 | |
Baruch Siach | 056e107 | 2019-07-10 18:23:04 +0300 | [diff] [blame] | 342 | /* Initialize Auto Voltage Scaling */ |
| 343 | mv_avs_init(); |
| 344 | |
Chris Packham | 3667bec | 2020-02-26 19:53:50 +1300 | [diff] [blame] | 345 | /* Update read timing control for PCIe */ |
| 346 | mv_rtc_config(); |
Stefan Roese | e463bf3 | 2015-01-19 11:33:42 +0100 | [diff] [blame] | 347 | } |