Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Amarula Solutions B.V. |
| 4 | * Copyright (C) 2016 Engicam S.r.l. |
| 5 | * Author: Jagan Teki <jagan@amarulasolutions.com> |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Simon Glass | 2dc9c34 | 2020-05-10 11:40:01 -0600 | [diff] [blame] | 9 | #include <image.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
Simon Glass | 3673618 | 2019-11-14 12:57:24 -0700 | [diff] [blame] | 11 | #include <serial.h> |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 12 | #include <spl.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 13 | #include <linux/delay.h> |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 14 | |
| 15 | #include <asm/io.h> |
| 16 | #include <asm/gpio.h> |
| 17 | #include <linux/sizes.h> |
| 18 | |
| 19 | #include <asm/arch/clock.h> |
| 20 | #include <asm/arch/crm_regs.h> |
| 21 | #include <asm/arch/iomux.h> |
| 22 | #include <asm/arch/mx6-ddr.h> |
| 23 | #include <asm/arch/mx6-pins.h> |
| 24 | #include <asm/arch/sys_proto.h> |
| 25 | |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 26 | #include <asm/mach-imx/iomux-v3.h> |
| 27 | #include <asm/mach-imx/video.h> |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 28 | |
Jagan Teki | ca5b816 | 2017-11-21 00:02:11 +0530 | [diff] [blame] | 29 | #ifdef CONFIG_SPL_LOAD_FIT |
| 30 | int board_fit_config_name_match(const char *name) |
| 31 | { |
| 32 | if (is_mx6dq() && !strcmp(name, "imx6q-icore")) |
| 33 | return 0; |
| 34 | else if (is_mx6dq() && !strcmp(name, "imx6q-icore-rqs")) |
| 35 | return 0; |
Jagan Teki | 41c7bd9 | 2018-06-02 17:25:27 +0530 | [diff] [blame] | 36 | else if (is_mx6dq() && !strcmp(name, "imx6q-icore-mipi")) |
| 37 | return 0; |
Jagan Teki | ca5b816 | 2017-11-21 00:02:11 +0530 | [diff] [blame] | 38 | else if ((is_mx6dl() || is_mx6solo()) && !strcmp(name, "imx6dl-icore")) |
| 39 | return 0; |
| 40 | else if ((is_mx6dl() || is_mx6solo()) && !strcmp(name, "imx6dl-icore-rqs")) |
| 41 | return 0; |
Jagan Teki | 41c7bd9 | 2018-06-02 17:25:27 +0530 | [diff] [blame] | 42 | else if ((is_mx6dl() || is_mx6solo()) && !strcmp(name, "imx6dl-icore-mipi")) |
| 43 | return 0; |
Jagan Teki | ca5b816 | 2017-11-21 00:02:11 +0530 | [diff] [blame] | 44 | else |
| 45 | return -1; |
| 46 | } |
| 47 | #endif |
| 48 | |
Jagan Teki | 515bd00 | 2017-11-21 00:02:16 +0530 | [diff] [blame] | 49 | #ifdef CONFIG_ENV_IS_IN_MMC |
| 50 | void board_boot_order(u32 *spl_boot_list) |
| 51 | { |
| 52 | u32 bmode = imx6_src_get_boot_mode(); |
| 53 | u8 boot_dev = BOOT_DEVICE_MMC1; |
| 54 | |
| 55 | switch ((bmode & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) { |
| 56 | case IMX6_BMODE_SD: |
| 57 | case IMX6_BMODE_ESD: |
| 58 | /* SD/eSD - BOOT_DEVICE_MMC1 */ |
| 59 | break; |
| 60 | case IMX6_BMODE_MMC: |
| 61 | case IMX6_BMODE_EMMC: |
| 62 | /* MMC/eMMC */ |
| 63 | boot_dev = BOOT_DEVICE_MMC2; |
| 64 | break; |
| 65 | default: |
| 66 | /* Default - BOOT_DEVICE_MMC1 */ |
| 67 | printf("Wrong board boot order\n"); |
| 68 | break; |
| 69 | } |
| 70 | |
| 71 | spl_boot_list[0] = boot_dev; |
| 72 | } |
| 73 | #endif |
| 74 | |
Jagan Teki | 88d8f88 | 2017-08-28 16:45:48 +0530 | [diff] [blame] | 75 | #ifdef CONFIG_SPL_OS_BOOT |
| 76 | int spl_start_uboot(void) |
| 77 | { |
| 78 | /* break into full u-boot on 'c' */ |
| 79 | if (serial_tstc() && serial_getc() == 'c') |
| 80 | return 1; |
| 81 | |
| 82 | return 0; |
| 83 | } |
| 84 | #endif |
| 85 | |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 86 | #ifdef CONFIG_MX6QDL |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 87 | /* |
| 88 | * Driving strength: |
| 89 | * 0x30 == 40 Ohm |
| 90 | * 0x28 == 48 Ohm |
| 91 | */ |
| 92 | #define IMX6DQ_DRIVE_STRENGTH 0x30 |
| 93 | #define IMX6SDL_DRIVE_STRENGTH 0x28 |
| 94 | |
| 95 | /* configure MX6Q/DUAL mmdc DDR io registers */ |
| 96 | static struct mx6dq_iomux_ddr_regs mx6dq_ddr_ioregs = { |
| 97 | .dram_sdqs0 = IMX6DQ_DRIVE_STRENGTH, |
| 98 | .dram_sdqs1 = IMX6DQ_DRIVE_STRENGTH, |
| 99 | .dram_sdqs2 = IMX6DQ_DRIVE_STRENGTH, |
| 100 | .dram_sdqs3 = IMX6DQ_DRIVE_STRENGTH, |
| 101 | .dram_sdqs4 = IMX6DQ_DRIVE_STRENGTH, |
| 102 | .dram_sdqs5 = IMX6DQ_DRIVE_STRENGTH, |
| 103 | .dram_sdqs6 = IMX6DQ_DRIVE_STRENGTH, |
| 104 | .dram_sdqs7 = IMX6DQ_DRIVE_STRENGTH, |
| 105 | .dram_dqm0 = IMX6DQ_DRIVE_STRENGTH, |
| 106 | .dram_dqm1 = IMX6DQ_DRIVE_STRENGTH, |
| 107 | .dram_dqm2 = IMX6DQ_DRIVE_STRENGTH, |
| 108 | .dram_dqm3 = IMX6DQ_DRIVE_STRENGTH, |
| 109 | .dram_dqm4 = IMX6DQ_DRIVE_STRENGTH, |
| 110 | .dram_dqm5 = IMX6DQ_DRIVE_STRENGTH, |
| 111 | .dram_dqm6 = IMX6DQ_DRIVE_STRENGTH, |
| 112 | .dram_dqm7 = IMX6DQ_DRIVE_STRENGTH, |
| 113 | .dram_cas = IMX6DQ_DRIVE_STRENGTH, |
| 114 | .dram_ras = IMX6DQ_DRIVE_STRENGTH, |
| 115 | .dram_sdclk_0 = IMX6DQ_DRIVE_STRENGTH, |
| 116 | .dram_sdclk_1 = IMX6DQ_DRIVE_STRENGTH, |
| 117 | .dram_reset = IMX6DQ_DRIVE_STRENGTH, |
| 118 | .dram_sdcke0 = IMX6DQ_DRIVE_STRENGTH, |
| 119 | .dram_sdcke1 = IMX6DQ_DRIVE_STRENGTH, |
| 120 | .dram_sdba2 = 0x00000000, |
| 121 | .dram_sdodt0 = IMX6DQ_DRIVE_STRENGTH, |
| 122 | .dram_sdodt1 = IMX6DQ_DRIVE_STRENGTH, |
| 123 | }; |
| 124 | |
| 125 | /* configure MX6Q/DUAL mmdc GRP io registers */ |
| 126 | static struct mx6dq_iomux_grp_regs mx6dq_grp_ioregs = { |
| 127 | .grp_b0ds = IMX6DQ_DRIVE_STRENGTH, |
| 128 | .grp_b1ds = IMX6DQ_DRIVE_STRENGTH, |
| 129 | .grp_b2ds = IMX6DQ_DRIVE_STRENGTH, |
| 130 | .grp_b3ds = IMX6DQ_DRIVE_STRENGTH, |
| 131 | .grp_b4ds = IMX6DQ_DRIVE_STRENGTH, |
| 132 | .grp_b5ds = IMX6DQ_DRIVE_STRENGTH, |
| 133 | .grp_b6ds = IMX6DQ_DRIVE_STRENGTH, |
| 134 | .grp_b7ds = IMX6DQ_DRIVE_STRENGTH, |
| 135 | .grp_addds = IMX6DQ_DRIVE_STRENGTH, |
| 136 | .grp_ddrmode_ctl = 0x00020000, |
| 137 | .grp_ddrpke = 0x00000000, |
| 138 | .grp_ddrmode = 0x00020000, |
| 139 | .grp_ctlds = IMX6DQ_DRIVE_STRENGTH, |
| 140 | .grp_ddr_type = 0x000c0000, |
| 141 | }; |
| 142 | |
| 143 | /* configure MX6SOLO/DUALLITE mmdc DDR io registers */ |
| 144 | struct mx6sdl_iomux_ddr_regs mx6sdl_ddr_ioregs = { |
| 145 | .dram_sdclk_0 = IMX6SDL_DRIVE_STRENGTH, |
| 146 | .dram_sdclk_1 = IMX6SDL_DRIVE_STRENGTH, |
| 147 | .dram_cas = IMX6SDL_DRIVE_STRENGTH, |
| 148 | .dram_ras = IMX6SDL_DRIVE_STRENGTH, |
| 149 | .dram_reset = IMX6SDL_DRIVE_STRENGTH, |
| 150 | .dram_sdcke0 = IMX6SDL_DRIVE_STRENGTH, |
| 151 | .dram_sdcke1 = IMX6SDL_DRIVE_STRENGTH, |
| 152 | .dram_sdba2 = 0x00000000, |
| 153 | .dram_sdodt0 = IMX6SDL_DRIVE_STRENGTH, |
| 154 | .dram_sdodt1 = IMX6SDL_DRIVE_STRENGTH, |
| 155 | .dram_sdqs0 = IMX6SDL_DRIVE_STRENGTH, |
| 156 | .dram_sdqs1 = IMX6SDL_DRIVE_STRENGTH, |
| 157 | .dram_sdqs2 = IMX6SDL_DRIVE_STRENGTH, |
| 158 | .dram_sdqs3 = IMX6SDL_DRIVE_STRENGTH, |
| 159 | .dram_sdqs4 = IMX6SDL_DRIVE_STRENGTH, |
| 160 | .dram_sdqs5 = IMX6SDL_DRIVE_STRENGTH, |
| 161 | .dram_sdqs6 = IMX6SDL_DRIVE_STRENGTH, |
| 162 | .dram_sdqs7 = IMX6SDL_DRIVE_STRENGTH, |
| 163 | .dram_dqm0 = IMX6SDL_DRIVE_STRENGTH, |
| 164 | .dram_dqm1 = IMX6SDL_DRIVE_STRENGTH, |
| 165 | .dram_dqm2 = IMX6SDL_DRIVE_STRENGTH, |
| 166 | .dram_dqm3 = IMX6SDL_DRIVE_STRENGTH, |
| 167 | .dram_dqm4 = IMX6SDL_DRIVE_STRENGTH, |
| 168 | .dram_dqm5 = IMX6SDL_DRIVE_STRENGTH, |
| 169 | .dram_dqm6 = IMX6SDL_DRIVE_STRENGTH, |
| 170 | .dram_dqm7 = IMX6SDL_DRIVE_STRENGTH, |
| 171 | }; |
| 172 | |
| 173 | /* configure MX6SOLO/DUALLITE mmdc GRP io registers */ |
| 174 | struct mx6sdl_iomux_grp_regs mx6sdl_grp_ioregs = { |
| 175 | .grp_ddr_type = 0x000c0000, |
| 176 | .grp_ddrmode_ctl = 0x00020000, |
| 177 | .grp_ddrpke = 0x00000000, |
| 178 | .grp_addds = IMX6SDL_DRIVE_STRENGTH, |
| 179 | .grp_ctlds = IMX6SDL_DRIVE_STRENGTH, |
| 180 | .grp_ddrmode = 0x00020000, |
| 181 | .grp_b0ds = IMX6SDL_DRIVE_STRENGTH, |
| 182 | .grp_b1ds = IMX6SDL_DRIVE_STRENGTH, |
| 183 | .grp_b2ds = IMX6SDL_DRIVE_STRENGTH, |
| 184 | .grp_b3ds = IMX6SDL_DRIVE_STRENGTH, |
| 185 | .grp_b4ds = IMX6SDL_DRIVE_STRENGTH, |
| 186 | .grp_b5ds = IMX6SDL_DRIVE_STRENGTH, |
| 187 | .grp_b6ds = IMX6SDL_DRIVE_STRENGTH, |
| 188 | .grp_b7ds = IMX6SDL_DRIVE_STRENGTH, |
| 189 | }; |
| 190 | |
| 191 | /* mt41j256 */ |
| 192 | static struct mx6_ddr3_cfg mt41j256 = { |
| 193 | .mem_speed = 1066, |
| 194 | .density = 2, |
| 195 | .width = 16, |
| 196 | .banks = 8, |
| 197 | .rowaddr = 13, |
| 198 | .coladdr = 10, |
| 199 | .pagesz = 2, |
| 200 | .trcd = 1375, |
| 201 | .trcmin = 4875, |
| 202 | .trasmin = 3500, |
| 203 | .SRT = 0, |
| 204 | }; |
| 205 | |
| 206 | static struct mx6_mmdc_calibration mx6dq_mmdc_calib = { |
| 207 | .p0_mpwldectrl0 = 0x000E0009, |
| 208 | .p0_mpwldectrl1 = 0x0018000E, |
| 209 | .p1_mpwldectrl0 = 0x00000007, |
| 210 | .p1_mpwldectrl1 = 0x00000000, |
| 211 | .p0_mpdgctrl0 = 0x43280334, |
| 212 | .p0_mpdgctrl1 = 0x031C0314, |
| 213 | .p1_mpdgctrl0 = 0x4318031C, |
| 214 | .p1_mpdgctrl1 = 0x030C0258, |
| 215 | .p0_mprddlctl = 0x3E343A40, |
| 216 | .p1_mprddlctl = 0x383C3844, |
| 217 | .p0_mpwrdlctl = 0x40404440, |
| 218 | .p1_mpwrdlctl = 0x4C3E4446, |
| 219 | }; |
| 220 | |
| 221 | /* DDR 64bit */ |
| 222 | static struct mx6_ddr_sysinfo mem_q = { |
| 223 | .ddr_type = DDR_TYPE_DDR3, |
| 224 | .dsize = 2, |
| 225 | .cs1_mirror = 0, |
| 226 | /* config for full 4GB range so that get_mem_size() works */ |
| 227 | .cs_density = 32, |
| 228 | .ncs = 1, |
| 229 | .bi_on = 1, |
| 230 | .rtt_nom = 2, |
| 231 | .rtt_wr = 2, |
| 232 | .ralat = 5, |
| 233 | .walat = 0, |
| 234 | .mif3_mode = 3, |
| 235 | .rst_to_cke = 0x23, |
| 236 | .sde_to_rst = 0x10, |
| 237 | }; |
| 238 | |
| 239 | static struct mx6_mmdc_calibration mx6dl_mmdc_calib = { |
| 240 | .p0_mpwldectrl0 = 0x001F0024, |
| 241 | .p0_mpwldectrl1 = 0x00110018, |
| 242 | .p1_mpwldectrl0 = 0x001F0024, |
| 243 | .p1_mpwldectrl1 = 0x00110018, |
| 244 | .p0_mpdgctrl0 = 0x4230022C, |
| 245 | .p0_mpdgctrl1 = 0x02180220, |
| 246 | .p1_mpdgctrl0 = 0x42440248, |
| 247 | .p1_mpdgctrl1 = 0x02300238, |
| 248 | .p0_mprddlctl = 0x44444A48, |
| 249 | .p1_mprddlctl = 0x46484A42, |
| 250 | .p0_mpwrdlctl = 0x38383234, |
| 251 | .p1_mpwrdlctl = 0x3C34362E, |
| 252 | }; |
| 253 | |
| 254 | /* DDR 64bit 1GB */ |
| 255 | static struct mx6_ddr_sysinfo mem_dl = { |
| 256 | .dsize = 2, |
| 257 | .cs1_mirror = 0, |
| 258 | /* config for full 4GB range so that get_mem_size() works */ |
| 259 | .cs_density = 32, |
| 260 | .ncs = 1, |
| 261 | .bi_on = 1, |
| 262 | .rtt_nom = 1, |
| 263 | .rtt_wr = 1, |
| 264 | .ralat = 5, |
| 265 | .walat = 0, |
| 266 | .mif3_mode = 3, |
| 267 | .rst_to_cke = 0x23, |
| 268 | .sde_to_rst = 0x10, |
| 269 | }; |
| 270 | |
| 271 | /* DDR 32bit 512MB */ |
| 272 | static struct mx6_ddr_sysinfo mem_s = { |
| 273 | .dsize = 1, |
| 274 | .cs1_mirror = 0, |
| 275 | /* config for full 4GB range so that get_mem_size() works */ |
| 276 | .cs_density = 32, |
| 277 | .ncs = 1, |
| 278 | .bi_on = 1, |
| 279 | .rtt_nom = 1, |
| 280 | .rtt_wr = 1, |
| 281 | .ralat = 5, |
| 282 | .walat = 0, |
| 283 | .mif3_mode = 3, |
| 284 | .rst_to_cke = 0x23, |
| 285 | .sde_to_rst = 0x10, |
| 286 | }; |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 287 | #endif /* CONFIG_MX6QDL */ |
| 288 | |
| 289 | #ifdef CONFIG_MX6UL |
| 290 | static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = { |
| 291 | .grp_addds = 0x00000030, |
| 292 | .grp_ddrmode_ctl = 0x00020000, |
| 293 | .grp_b0ds = 0x00000030, |
| 294 | .grp_ctlds = 0x00000030, |
| 295 | .grp_b1ds = 0x00000030, |
| 296 | .grp_ddrpke = 0x00000000, |
| 297 | .grp_ddrmode = 0x00020000, |
| 298 | .grp_ddr_type = 0x000c0000, |
| 299 | }; |
| 300 | |
| 301 | static struct mx6ul_iomux_ddr_regs mx6_ddr_ioregs = { |
| 302 | .dram_dqm0 = 0x00000030, |
| 303 | .dram_dqm1 = 0x00000030, |
| 304 | .dram_ras = 0x00000030, |
| 305 | .dram_cas = 0x00000030, |
| 306 | .dram_odt0 = 0x00000030, |
| 307 | .dram_odt1 = 0x00000030, |
| 308 | .dram_sdba2 = 0x00000000, |
| 309 | .dram_sdclk_0 = 0x00000008, |
| 310 | .dram_sdqs0 = 0x00000038, |
| 311 | .dram_sdqs1 = 0x00000030, |
| 312 | .dram_reset = 0x00000030, |
| 313 | }; |
| 314 | |
| 315 | static struct mx6_mmdc_calibration mx6_mmcd_calib = { |
| 316 | .p0_mpwldectrl0 = 0x00070007, |
| 317 | .p0_mpdgctrl0 = 0x41490145, |
| 318 | .p0_mprddlctl = 0x40404546, |
| 319 | .p0_mpwrdlctl = 0x4040524D, |
| 320 | }; |
| 321 | |
| 322 | struct mx6_ddr_sysinfo ddr_sysinfo = { |
| 323 | .dsize = 0, |
| 324 | .cs_density = 20, |
| 325 | .ncs = 1, |
| 326 | .cs1_mirror = 0, |
| 327 | .rtt_wr = 2, |
| 328 | .rtt_nom = 1, /* RTT_Nom = RZQ/2 */ |
| 329 | .walat = 1, /* Write additional latency */ |
| 330 | .ralat = 5, /* Read additional latency */ |
| 331 | .mif3_mode = 3, /* Command prediction working mode */ |
| 332 | .bi_on = 1, /* Bank interleaving enabled */ |
| 333 | .sde_to_rst = 0x10, /* 14 cycles, 200us (JEDEC default) */ |
| 334 | .rst_to_cke = 0x23, /* 33 cycles, 500us (JEDEC default) */ |
| 335 | .ddr_type = DDR_TYPE_DDR3, |
| 336 | }; |
| 337 | |
| 338 | static struct mx6_ddr3_cfg mem_ddr = { |
| 339 | .mem_speed = 800, |
| 340 | .density = 4, |
| 341 | .width = 16, |
| 342 | .banks = 8, |
| 343 | #ifdef TARGET_MX6UL_ISIOT |
| 344 | .rowaddr = 15, |
| 345 | #else |
| 346 | .rowaddr = 13, |
| 347 | #endif |
| 348 | .coladdr = 10, |
| 349 | .pagesz = 2, |
| 350 | .trcd = 1375, |
| 351 | .trcmin = 4875, |
| 352 | .trasmin = 3500, |
| 353 | }; |
| 354 | #endif /* CONFIG_MX6UL */ |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 355 | |
| 356 | static void ccgr_init(void) |
| 357 | { |
| 358 | struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; |
| 359 | |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 360 | #ifdef CONFIG_MX6QDL |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 361 | writel(0x00003F3F, &ccm->CCGR0); |
| 362 | writel(0x0030FC00, &ccm->CCGR1); |
| 363 | writel(0x000FC000, &ccm->CCGR2); |
| 364 | writel(0x3F300000, &ccm->CCGR3); |
| 365 | writel(0xFF00F300, &ccm->CCGR4); |
| 366 | writel(0x0F0000C3, &ccm->CCGR5); |
| 367 | writel(0x000003CC, &ccm->CCGR6); |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 368 | #elif CONFIG_MX6UL |
| 369 | writel(0x00c03f3f, &ccm->CCGR0); |
| 370 | writel(0xfcffff00, &ccm->CCGR1); |
| 371 | writel(0x0cffffcc, &ccm->CCGR2); |
| 372 | writel(0x3f3c3030, &ccm->CCGR3); |
| 373 | writel(0xff00fffc, &ccm->CCGR4); |
| 374 | writel(0x033f30ff, &ccm->CCGR5); |
| 375 | writel(0x00c00fff, &ccm->CCGR6); |
| 376 | #endif |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 377 | } |
| 378 | |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 379 | static void spl_dram_init(void) |
| 380 | { |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 381 | #ifdef CONFIG_MX6QDL |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 382 | if (is_mx6solo()) { |
| 383 | mx6sdl_dram_iocfg(32, &mx6sdl_ddr_ioregs, &mx6sdl_grp_ioregs); |
| 384 | mx6_dram_cfg(&mem_s, &mx6dl_mmdc_calib, &mt41j256); |
| 385 | } else if (is_mx6dl()) { |
| 386 | mx6sdl_dram_iocfg(64, &mx6sdl_ddr_ioregs, &mx6sdl_grp_ioregs); |
| 387 | mx6_dram_cfg(&mem_dl, &mx6dl_mmdc_calib, &mt41j256); |
| 388 | } else if (is_mx6dq()) { |
| 389 | mx6dq_dram_iocfg(64, &mx6dq_ddr_ioregs, &mx6dq_grp_ioregs); |
| 390 | mx6_dram_cfg(&mem_q, &mx6dq_mmdc_calib, &mt41j256); |
| 391 | } |
Jagan Teki | 2c67e88 | 2017-05-07 02:43:13 +0530 | [diff] [blame] | 392 | #elif CONFIG_MX6UL |
| 393 | mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs); |
| 394 | mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); |
| 395 | #endif |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 396 | |
| 397 | udelay(100); |
| 398 | } |
| 399 | |
| 400 | void board_init_f(ulong dummy) |
| 401 | { |
| 402 | ccgr_init(); |
| 403 | |
| 404 | /* setup AIPS and disable watchdog */ |
| 405 | arch_cpu_init(); |
| 406 | |
Michael Trimarchi | a97401e | 2018-06-23 16:10:07 +0200 | [diff] [blame] | 407 | if (!(is_mx6ul())) |
| 408 | gpr_init(); |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 409 | |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 410 | /* setup GP timer */ |
| 411 | timer_init(); |
| 412 | |
Michael Trimarchi | 719f982 | 2022-12-09 15:05:49 +0530 | [diff] [blame] | 413 | /* Enable device tree and early DM support*/ |
| 414 | spl_early_init(); |
| 415 | |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 416 | /* UART clocks enabled and gd valid - init serial console */ |
| 417 | preloader_console_init(); |
| 418 | |
| 419 | /* DDR initialization */ |
| 420 | spl_dram_init(); |
Jagan Teki | 215cd41 | 2017-05-07 02:43:12 +0530 | [diff] [blame] | 421 | } |