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