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>
10 #include <asm/arch/sys_proto.h>
15 DECLARE_GLOBAL_DATA_PTR;
17 #ifdef CONFIG_ENV_IS_IN_MMC
18 static void mmc_late_init(void)
22 u32 dev_no = mmc_get_env_dev();
24 env_set_ulong("mmcdev", dev_no);
27 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
28 env_set("mmcroot", mmcblk);
30 sprintf(cmd, "mmc dev %d", dev_no);
35 static void setenv_fdt_file(void)
37 const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
39 if (!strcmp(cmp_dtb, "imx6q-icore")) {
41 env_set("fdt_file", "imx6q-icore.dtb");
42 else if (is_mx6dl() || is_mx6solo())
43 env_set("fdt_file", "imx6dl-icore.dtb");
44 } else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
46 env_set("fdt_file", "imx6q-icore-mipi.dtb");
47 else if (is_mx6dl() || is_mx6solo())
48 env_set("fdt_file", "imx6dl-icore-mipi.dtb");
49 } else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
51 env_set("fdt_file", "imx6q-icore-rqs.dtb");
52 else if (is_mx6dl() || is_mx6solo())
53 env_set("fdt_file", "imx6dl-icore-rqs.dtb");
54 } else if (!strcmp(cmp_dtb, "imx6ul-geam"))
55 env_set("fdt_file", "imx6ul-geam.dtb");
56 else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
57 env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
58 else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
59 env_set("fdt_file", "imx6ul-isiot-nand.dtb");
62 int board_late_init(void)
64 switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
70 #ifdef CONFIG_ENV_IS_IN_MMC
73 env_set("modeboot", "mmcboot");
75 case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
76 env_set("modeboot", "nandboot");
79 env_set("modeboot", "");
84 env_set("console", "ttymxc0");
86 env_set("console", "ttymxc3");
90 #ifdef CONFIG_HW_WATCHDOG
99 /* Address of boot parameters */
100 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
102 #ifdef CONFIG_NAND_MXS
106 #ifdef CONFIG_VIDEO_IPUV3
115 gd->ram_size = imx_ddr_size();