1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Amarula Solutions B.V.
4 * Copyright (C) 2016 Engicam S.r.l.
5 * Author: Jagan Teki <jagan@amarulasolutions.com>
11 #include <asm/arch/sys_proto.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 #ifdef CONFIG_ENV_IS_IN_MMC
19 static void mmc_late_init(void)
23 u32 dev_no = mmc_get_env_dev();
25 env_set_ulong("mmcdev", dev_no);
28 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
29 env_set("mmcroot", mmcblk);
31 sprintf(cmd, "mmc dev %d", dev_no);
36 static void setenv_fdt_file(void)
38 const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
40 if (!strcmp(cmp_dtb, "imx6q-icore")) {
42 env_set("fdt_file", "imx6q-icore.dtb");
43 else if (is_mx6dl() || is_mx6solo())
44 env_set("fdt_file", "imx6dl-icore.dtb");
45 } else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
47 env_set("fdt_file", "imx6q-icore-mipi.dtb");
48 else if (is_mx6dl() || is_mx6solo())
49 env_set("fdt_file", "imx6dl-icore-mipi.dtb");
50 } else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
52 env_set("fdt_file", "imx6q-icore-rqs.dtb");
53 else if (is_mx6dl() || is_mx6solo())
54 env_set("fdt_file", "imx6dl-icore-rqs.dtb");
55 } else if (!strcmp(cmp_dtb, "imx6ul-geam"))
56 env_set("fdt_file", "imx6ul-geam.dtb");
57 else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
58 env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
59 else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
60 env_set("fdt_file", "imx6ul-isiot-nand.dtb");
63 int board_late_init(void)
65 switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
71 #ifdef CONFIG_ENV_IS_IN_MMC
74 env_set("modeboot", "mmcboot");
76 case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
77 env_set("modeboot", "nandboot");
80 env_set("modeboot", "");
85 env_set("console", "ttymxc0");
87 env_set("console", "ttymxc3");
91 #ifdef CONFIG_HW_WATCHDOG
100 /* Address of boot parameters */
101 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
103 #ifdef CONFIG_NAND_MXS
107 #ifdef CONFIG_VIDEO_IPUV3
116 gd->ram_size = imx_ddr_size();