blob: e0a6e4b0259d0db68a3a0cffb67b20807952ef51 [file] [log] [blame]
Kever Yangb877fa02019-03-29 09:09:00 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
4 */
Simon Glass1e268642020-05-10 11:39:55 -06005
6#include <common.h>
Kever Yangb877fa02019-03-29 09:09:00 +08007#include <asm/io.h>
8#include <asm/arch-rockchip/grf_rk3036.h>
9#include <asm/arch-rockchip/hardware.h>
Kever Yang80dd6622019-07-22 20:02:03 +080010#include <asm/arch-rockchip/sdram_rk3036.h>
11
12DECLARE_GLOBAL_DATA_PTR;
Kever Yangb877fa02019-03-29 09:09:00 +080013
14#ifdef CONFIG_DEBUG_UART_BOARD_INIT
15void board_debug_uart_init(void)
16{
17#define GRF_BASE 0x20008000
18 struct rk3036_grf * const grf = (void *)GRF_BASE;
19 enum {
20 GPIO1C3_SHIFT = 6,
21 GPIO1C3_MASK = 3 << GPIO1C3_SHIFT,
22 GPIO1C3_GPIO = 0,
23 GPIO1C3_MMC0_D1,
24 GPIO1C3_UART2_SOUT,
25
26 GPIO1C2_SHIFT = 4,
27 GPIO1C2_MASK = 3 << GPIO1C2_SHIFT,
28 GPIO1C2_GPIO = 0,
29 GPIO1C2_MMC0_D0,
30 GPIO1C2_UART2_SIN,
31 };
32 /*
33 * NOTE: sd card and debug uart use same iomux in rk3036,
34 * so if you enable uart,
35 * you can not boot from sdcard
36 */
37 rk_clrsetreg(&grf->gpio1c_iomux,
38 GPIO1C3_MASK << GPIO1C3_SHIFT |
39 GPIO1C2_MASK << GPIO1C2_SHIFT,
40 GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
41 GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
42}
43#endif
Kever Yang80dd6622019-07-22 20:02:03 +080044
45#if !CONFIG_IS_ENABLED(RAM)
46/*
47 * When CONFIG_RAM is enabled, the dram_init() function is implemented
Kever Yange47db832019-11-15 11:04:33 +080048 * in sdram.c.
Kever Yang80dd6622019-07-22 20:02:03 +080049 */
50int dram_init(void)
51{
52 gd->ram_size = sdram_size();
53
54 return 0;
55}
56#endif