xref: /rk3399_rockchip-uboot/board/engicam/common/board.c (revision ac880e774260f5e1988d173d5bf75ea10ee04aeb)
1 /*
2  * Copyright (C) 2016 Amarula Solutions B.V.
3  * Copyright (C) 2016 Engicam S.r.l.
4  * Author: Jagan Teki <jagan@amarulasolutions.com>
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 
15 DECLARE_GLOBAL_DATA_PTR;
16 
17 #ifdef CONFIG_ENV_IS_IN_MMC
18 void mmc_late_init(void)
19 {
20 	char cmd[32];
21 	char mmcblk[32];
22 	u32 dev_no = mmc_get_env_dev();
23 
24 	setenv_ulong("mmcdev", dev_no);
25 
26 	/* Set mmcblk env */
27 	sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
28 	setenv("mmcroot", mmcblk);
29 
30 	sprintf(cmd, "mmc dev %d", dev_no);
31 	run_command(cmd, 0);
32 }
33 #endif
34 
35 int board_init(void)
36 {
37 	/* Address of boot parameters */
38 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
39 
40 #ifdef CONFIG_NAND_MXS
41 	setup_gpmi_nand();
42 #endif
43 
44 #ifdef CONFIG_VIDEO_IPUV3
45 	setup_display();
46 #endif
47 
48 	return 0;
49 }
50 
51 int dram_init(void)
52 {
53 	gd->ram_size = imx_ddr_size();
54 
55 	return 0;
56 }
57