]> Git Repo - u-boot.git/blame - board/engicam/common/board.c
board: i.MX6QDL: add Engicam i.CoreM6 1.5 QDL MIPI starter kit
[u-boot.git] / board / engicam / common / board.c
CommitLineData
ac880e77
JT
1/*
2 * Copyright (C) 2016 Amarula Solutions B.V.
3 * Copyright (C) 2016 Engicam S.r.l.
4 * Author: Jagan Teki <[email protected]>
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#include <common.h>
10#include <mmc.h>
11#include <asm/arch/sys_proto.h>
12
13#include "board.h"
14
15DECLARE_GLOBAL_DATA_PTR;
16
17#ifdef CONFIG_ENV_IS_IN_MMC
f9247569 18static void mmc_late_init(void)
ac880e77
JT
19{
20 char cmd[32];
21 char mmcblk[32];
22 u32 dev_no = mmc_get_env_dev();
23
018f5303 24 env_set_ulong("mmcdev", dev_no);
ac880e77
JT
25
26 /* Set mmcblk env */
27 sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
382bee57 28 env_set("mmcroot", mmcblk);
ac880e77
JT
29
30 sprintf(cmd, "mmc dev %d", dev_no);
31 run_command(cmd, 0);
32}
33#endif
34
409b16d3
JT
35static void setenv_fdt_file(void)
36{
37 const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
38
39 if (!strcmp(cmp_dtb, "imx6q-icore")) {
40 if (is_mx6dq())
41 env_set("fdt_file", "imx6q-icore.dtb");
04c28a78 42 else if (is_mx6dl() || is_mx6solo())
409b16d3 43 env_set("fdt_file", "imx6dl-icore.dtb");
04c28a78
JT
44 } else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
45 if (is_mx6dq())
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");
409b16d3
JT
49 } else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
50 if (is_mx6dq())
51 env_set("fdt_file", "imx6q-icore-rqs.dtb");
04c28a78 52 else if (is_mx6dl() || is_mx6solo())
409b16d3
JT
53 env_set("fdt_file", "imx6dl-icore-rqs.dtb");
54 } else if (!strcmp(cmp_dtb, "imx6ul-geam-kit"))
55 env_set("fdt_file", "imx6ul-geam-kit.dtb");
56 else if (!strcmp(cmp_dtb, "imx6ul-isiot-mmc"))
52aaddd6 57 env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
409b16d3
JT
58 else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
59 env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
60 else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
61 env_set("fdt_file", "imx6ul-isiot-nand.dtb");
62}
63
f9247569
JT
64int board_late_init(void)
65{
66 switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
67 IMX6_BMODE_SHIFT) {
68 case IMX6_BMODE_SD:
69 case IMX6_BMODE_ESD:
70 case IMX6_BMODE_MMC:
71 case IMX6_BMODE_EMMC:
72#ifdef CONFIG_ENV_IS_IN_MMC
73 mmc_late_init();
74#endif
382bee57 75 env_set("modeboot", "mmcboot");
f9247569 76 break;
af104ae5 77 case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
382bee57 78 env_set("modeboot", "nandboot");
f9247569
JT
79 break;
80 default:
382bee57 81 env_set("modeboot", "");
f9247569
JT
82 break;
83 }
84
46f9c839 85 if (is_mx6ul())
382bee57 86 env_set("console", "ttymxc0");
46f9c839 87 else
382bee57 88 env_set("console", "ttymxc3");
46f9c839 89
f9247569
JT
90 setenv_fdt_file();
91
92 return 0;
93}
94
ac880e77
JT
95int board_init(void)
96{
97 /* Address of boot parameters */
98 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
99
100#ifdef CONFIG_NAND_MXS
101 setup_gpmi_nand();
102#endif
103
104#ifdef CONFIG_VIDEO_IPUV3
105 setup_display();
106#endif
107
108 return 0;
109}
110
111int dram_init(void)
112{
113 gd->ram_size = imx_ddr_size();
114
115 return 0;
116}
This page took 0.085743 seconds and 4 git commands to generate.