xref: /rk3399_rockchip-uboot/board/rockchip/evb_rk3399/evb-rk3399.c (revision bd218ab8e4e8b5283f4a94bc96b713b46f6d9f89)
1 /*
2  * (C) Copyright 2016 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 #include <common.h>
7 #include <dm.h>
8 #include <dm/pinctrl.h>
9 #include <asm/arch/periph.h>
10 
11 DECLARE_GLOBAL_DATA_PTR;
12 
13 int board_init(void)
14 {
15 	struct udevice *pinctrl;
16 	int ret;
17 
18 	/*
19 	 * The PWM do not have decicated interrupt number in dts and can
20 	 * not get periph_id by pinctrl framework, so let's init them here.
21 	 * The PWM2 and PWM3 are for pwm regulater.
22 	 */
23 	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
24 	if (ret) {
25 		debug("%s: Cannot find pinctrl device\n", __func__);
26 		goto out;
27 	}
28 
29 	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
30 	if (ret) {
31 		debug("%s PWM2 pinctrl init fail!\n", __func__);
32 		goto out;
33 	}
34 
35 	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
36 	if (ret) {
37 		debug("%s PWM3 pinctrl init fail!\n", __func__);
38 		goto out;
39 	}
40 
41 out:
42 	return 0;
43 }
44 
45 int dram_init(void)
46 {
47 	gd->ram_size = 0x80000000;
48 	return 0;
49 }
50 
51 void dram_init_banksize(void)
52 {
53 	/* Reserve 0x200000 for ATF bl31 */
54 	gd->bd->bi_dram[0].start = 0x200000;
55 	gd->bd->bi_dram[0].size = 0x80000000;
56 }
57