Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2016 Rockchip Electronics Co., Ltd |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | #include <common.h> |
Kever Yang | ad05138 | 2016-08-16 17:58:13 +0800 | [diff] [blame] | 7 | #include <dm.h> |
| 8 | #include <dm/pinctrl.h> |
| 9 | #include <asm/arch/periph.h> |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 10 | |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | |
| 13 | int board_init(void) |
| 14 | { |
Kever Yang | ad05138 | 2016-08-16 17:58:13 +0800 | [diff] [blame] | 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: |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 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 | { |
Kever Yang | 633fdab | 2016-07-25 11:45:54 +0800 | [diff] [blame] | 53 | /* Reserve 0x200000 for ATF bl31 */ |
| 54 | gd->bd->bi_dram[0].start = 0x200000; |
Kever Yang | a381bcf | 2016-07-19 21:16:59 +0800 | [diff] [blame] | 55 | gd->bd->bi_dram[0].size = 0x80000000; |
| 56 | } |