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>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <mmc.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
|
|
|
|
|
|
|
#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();
|
|
|
|
|
|
|
|
setenv_ulong("mmcdev", dev_no);
|
|
|
|
|
|
|
|
/* Set mmcblk env */
|
|
|
|
sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
|
|
|
|
setenv("mmcroot", mmcblk);
|
|
|
|
|
|
|
|
sprintf(cmd, "mmc dev %d", dev_no);
|
|
|
|
run_command(cmd, 0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
setenv("modeboot", "mmcboot");
|
|
|
|
break;
|
|
|
|
case IMX6_BMODE_NAND:
|
|
|
|
setenv("modeboot", "nandboot");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
setenv("modeboot", "");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-05-12 11:48:26 +00:00
|
|
|
if (is_mx6ul())
|
|
|
|
setenv("console", "ttymxc0");
|
|
|
|
else
|
|
|
|
setenv("console", "ttymxc3");
|
|
|
|
|
2017-05-06 21:13:15 +00:00
|
|
|
setenv_fdt_file();
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|