blob: 0a072cf03a880261d751b3ebda3bbe7e5dc46a41 [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>
Simon Glass97589732020-05-10 11:40:02 -06007#include <init.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06008#include <asm/global_data.h>
Kever Yangb877fa02019-03-29 09:09:00 +08009#include <asm/io.h>
10#include <asm/arch-rockchip/grf_rk3036.h>
11#include <asm/arch-rockchip/hardware.h>
Kever Yang80dd6622019-07-22 20:02:03 +080012#include <asm/arch-rockchip/sdram_rk3036.h>
13
14DECLARE_GLOBAL_DATA_PTR;
Kever Yangb877fa02019-03-29 09:09:00 +080015
16#ifdef CONFIG_DEBUG_UART_BOARD_INIT
17void board_debug_uart_init(void)
18{
19#define GRF_BASE 0x20008000
20 struct rk3036_grf * const grf = (void *)GRF_BASE;
21 enum {
22 GPIO1C3_SHIFT = 6,
23 GPIO1C3_MASK = 3 << GPIO1C3_SHIFT,
24 GPIO1C3_GPIO = 0,
25 GPIO1C3_MMC0_D1,
26 GPIO1C3_UART2_SOUT,
27
28 GPIO1C2_SHIFT = 4,
29 GPIO1C2_MASK = 3 << GPIO1C2_SHIFT,
30 GPIO1C2_GPIO = 0,
31 GPIO1C2_MMC0_D0,
32 GPIO1C2_UART2_SIN,
33 };
34 /*
35 * NOTE: sd card and debug uart use same iomux in rk3036,
36 * so if you enable uart,
37 * you can not boot from sdcard
38 */
39 rk_clrsetreg(&grf->gpio1c_iomux,
40 GPIO1C3_MASK << GPIO1C3_SHIFT |
41 GPIO1C2_MASK << GPIO1C2_SHIFT,
42 GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
43 GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
44}
45#endif
Kever Yang80dd6622019-07-22 20:02:03 +080046
47#if !CONFIG_IS_ENABLED(RAM)
48/*
49 * When CONFIG_RAM is enabled, the dram_init() function is implemented
Kever Yange47db832019-11-15 11:04:33 +080050 * in sdram.c.
Kever Yang80dd6622019-07-22 20:02:03 +080051 */
52int dram_init(void)
53{
54 gd->ram_size = sdram_size();
55
56 return 0;
57}
58#endif