2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-05-06 21:13:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Amarula Solutions B.V.
|
|
|
|
* Copyright (C) 2016 Engicam S.r.l.
|
|
|
|
* Author: Jagan Teki <jagan@amarulasolutions.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <mmc.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
2019-02-06 07:53:35 +00:00
|
|
|
#include <watchdog.h>
|
2017-05-06 21:13:14 +00:00
|
|
|
|
|
|
|
#include "board.h"
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
#ifdef CONFIG_ENV_IS_IN_MMC
|
2017-05-06 21:13:15 +00:00
|
|
|
static void mmc_late_init(void)
|
2017-05-06 21:13:14 +00:00
|
|
|
{
|
|
|
|
char cmd[32];
|
|
|
|
char mmcblk[32];
|
|
|
|
u32 dev_no = mmc_get_env_dev();
|
|
|
|
|
2017-08-03 18:22:10 +00:00
|
|
|
env_set_ulong("mmcdev", dev_no);
|
2017-05-06 21:13:14 +00:00
|
|
|
|
|
|
|
/* Set mmcblk env */
|
|
|
|
sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("mmcroot", mmcblk);
|
2017-05-06 21:13:14 +00:00
|
|
|
|
|
|
|
sprintf(cmd, "mmc dev %d", dev_no);
|
|
|
|
run_command(cmd, 0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-20 18:32:10 +00:00
|
|
|
static void setenv_fdt_file(void)
|
|
|
|
{
|
|
|
|
const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
|
|
|
|
|
|
|
|
if (!strcmp(cmp_dtb, "imx6q-icore")) {
|
|
|
|
if (is_mx6dq())
|
|
|
|
env_set("fdt_file", "imx6q-icore.dtb");
|
2018-01-05 18:32:04 +00:00
|
|
|
else if (is_mx6dl() || is_mx6solo())
|
2017-11-20 18:32:10 +00:00
|
|
|
env_set("fdt_file", "imx6dl-icore.dtb");
|
2018-01-05 18:32:04 +00:00
|
|
|
} else if (!strcmp(cmp_dtb, "imx6q-icore-mipi")) {
|
|
|
|
if (is_mx6dq())
|
|
|
|
env_set("fdt_file", "imx6q-icore-mipi.dtb");
|
|
|
|
else if (is_mx6dl() || is_mx6solo())
|
|
|
|
env_set("fdt_file", "imx6dl-icore-mipi.dtb");
|
2017-11-20 18:32:10 +00:00
|
|
|
} else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
|
|
|
|
if (is_mx6dq())
|
|
|
|
env_set("fdt_file", "imx6q-icore-rqs.dtb");
|
2018-01-05 18:32:04 +00:00
|
|
|
else if (is_mx6dl() || is_mx6solo())
|
2017-11-20 18:32:10 +00:00
|
|
|
env_set("fdt_file", "imx6dl-icore-rqs.dtb");
|
2018-06-18 05:42:19 +00:00
|
|
|
} else if (!strcmp(cmp_dtb, "imx6ul-geam"))
|
|
|
|
env_set("fdt_file", "imx6ul-geam.dtb");
|
2017-11-20 18:32:10 +00:00
|
|
|
else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
|
|
|
|
env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
|
|
|
|
else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
|
|
|
|
env_set("fdt_file", "imx6ul-isiot-nand.dtb");
|
|
|
|
}
|
|
|
|
|
2017-05-06 21:13:15 +00:00
|
|
|
int board_late_init(void)
|
|
|
|
{
|
|
|
|
switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
|
|
|
|
IMX6_BMODE_SHIFT) {
|
|
|
|
case IMX6_BMODE_SD:
|
|
|
|
case IMX6_BMODE_ESD:
|
|
|
|
case IMX6_BMODE_MMC:
|
|
|
|
case IMX6_BMODE_EMMC:
|
|
|
|
#ifdef CONFIG_ENV_IS_IN_MMC
|
|
|
|
mmc_late_init();
|
|
|
|
#endif
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("modeboot", "mmcboot");
|
2017-05-06 21:13:15 +00:00
|
|
|
break;
|
2017-12-14 18:20:02 +00:00
|
|
|
case IMX6_BMODE_NAND_MIN ... IMX6_BMODE_NAND_MAX:
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("modeboot", "nandboot");
|
2017-05-06 21:13:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("modeboot", "");
|
2017-05-06 21:13:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-05-12 11:48:26 +00:00
|
|
|
if (is_mx6ul())
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("console", "ttymxc0");
|
2017-05-12 11:48:26 +00:00
|
|
|
else
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("console", "ttymxc3");
|
2017-05-12 11:48:26 +00:00
|
|
|
|
2017-05-06 21:13:15 +00:00
|
|
|
setenv_fdt_file();
|
|
|
|
|
2019-02-06 07:53:35 +00:00
|
|
|
#ifdef CONFIG_HW_WATCHDOG
|
|
|
|
hw_watchdog_init();
|
|
|
|
#endif
|
|
|
|
|
2017-05-06 21:13:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-05-06 21:13:14 +00:00
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
/* Address of boot parameters */
|
|
|
|
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
|
|
|
|
|
|
|
|
#ifdef CONFIG_NAND_MXS
|
|
|
|
setup_gpmi_nand();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_VIDEO_IPUV3
|
|
|
|
setup_display();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
|
|
|
gd->ram_size = imx_ddr_size();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|