Kever Yang | 7f3eec0 | 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 | c3dc39a | 2020-05-10 11:39:55 -0600 | [diff] [blame] | 5 | |
| 6 | #include <common.h> |
Kever Yang | 7f3eec0 | 2019-03-29 09:09:00 +0800 | [diff] [blame] | 7 | #include <asm/io.h> |
| 8 | #include <asm/arch-rockchip/grf_rk3036.h> |
| 9 | #include <asm/arch-rockchip/hardware.h> |
Kever Yang | 7559f6e | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 10 | #include <asm/arch-rockchip/sdram_rk3036.h> |
| 11 | |
| 12 | DECLARE_GLOBAL_DATA_PTR; |
Kever Yang | 7f3eec0 | 2019-03-29 09:09:00 +0800 | [diff] [blame] | 13 | |
| 14 | #ifdef CONFIG_DEBUG_UART_BOARD_INIT |
| 15 | void 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 Yang | 7559f6e | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 44 | |
| 45 | #if !CONFIG_IS_ENABLED(RAM) |
| 46 | /* |
| 47 | * When CONFIG_RAM is enabled, the dram_init() function is implemented |
Kever Yang | 5d19ddf | 2019-11-15 11:04:33 +0800 | [diff] [blame] | 48 | * in sdram.c. |
Kever Yang | 7559f6e | 2019-07-22 20:02:03 +0800 | [diff] [blame] | 49 | */ |
| 50 | int dram_init(void) |
| 51 | { |
| 52 | gd->ram_size = sdram_size(); |
| 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | #endif |