blob: d39427671ce4e423b045a874ed696926ba21f856 [file] [log] [blame]
Kever Yanga381bcf2016-07-19 21:16:59 +08001/*
2 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6#include <common.h>
Kever Yangad051382016-08-16 17:58:13 +08007#include <dm.h>
8#include <dm/pinctrl.h>
9#include <asm/arch/periph.h>
Kever Yanga381bcf2016-07-19 21:16:59 +080010
11DECLARE_GLOBAL_DATA_PTR;
12
13int board_init(void)
14{
Kever Yangad051382016-08-16 17:58:13 +080015 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
41out:
Kever Yanga381bcf2016-07-19 21:16:59 +080042 return 0;
43}
44
45int dram_init(void)
46{
47 gd->ram_size = 0x80000000;
48 return 0;
49}
50
51void dram_init_banksize(void)
52{
Kever Yang633fdab2016-07-25 11:45:54 +080053 /* Reserve 0x200000 for ATF bl31 */
54 gd->bd->bi_dram[0].start = 0x200000;
Kever Yanga381bcf2016-07-19 21:16:59 +080055 gd->bd->bi_dram[0].size = 0x80000000;
56}