Kever Yang | b877fa0 | 2019-03-29 09:09:00 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2019 Rockchip Electronics Co., Ltd |
| 4 | */ |
Simon Glass | 1e26864 | 2020-05-10 11:39:55 -0600 | [diff] [blame] | 5 | |
| 6 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 7 | #include <init.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 8 | #include <asm/global_data.h> |
Kever Yang | b877fa0 | 2019-03-29 09:09:00 +0800 | [diff] [blame] | 9 | #include <asm/io.h> |
| 10 | #include <asm/arch-rockchip/grf_rk3036.h> |
| 11 | #include <asm/arch-rockchip/hardware.h> |
Kever Yang | 80dd662 | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 12 | #include <asm/arch-rockchip/sdram_rk3036.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
Kever Yang | b877fa0 | 2019-03-29 09:09:00 +0800 | [diff] [blame] | 15 | |
| 16 | #ifdef CONFIG_DEBUG_UART_BOARD_INIT |
| 17 | void 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 Yang | 80dd662 | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 46 | |
| 47 | #if !CONFIG_IS_ENABLED(RAM) |
| 48 | /* |
| 49 | * When CONFIG_RAM is enabled, the dram_init() function is implemented |
Kever Yang | e47db83 | 2019-11-15 11:04:33 +0800 | [diff] [blame] | 50 | * in sdram.c. |
Kever Yang | 80dd662 | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 51 | */ |
| 52 | int dram_init(void) |
| 53 | { |
| 54 | gd->ram_size = sdram_size(); |
| 55 | |
| 56 | return 0; |
| 57 | } |
| 58 | #endif |