Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C)Copyright 2016 Rockchip Electronics Co., Ltd |
| 4 | * Authors: Andy Yan <andy.yan@rock-chips.com> |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 7 | #include <init.h> |
Kever Yang | f6b6d94 | 2020-02-19 09:46:06 +0800 | [diff] [blame] | 8 | #include <syscon.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 9 | #include <asm/global_data.h> |
Kever Yang | f6b6d94 | 2020-02-19 09:46:06 +0800 | [diff] [blame] | 10 | #include <asm/arch-rockchip/clock.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 11 | #include <asm/arch-rockchip/grf_rv1108.h> |
| 12 | #include <asm/arch-rockchip/hardware.h> |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
Kever Yang | 8fdd888 | 2020-04-13 09:38:30 +0800 | [diff] [blame] | 16 | int board_early_init_f(void) |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 17 | { |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 18 | struct rv1108_grf *grf; |
David Wu | 5a04e0c | 2018-01-13 13:53:57 +0800 | [diff] [blame] | 19 | enum { |
| 20 | GPIO3C3_SHIFT = 6, |
| 21 | GPIO3C3_MASK = 3 << GPIO3C3_SHIFT, |
| 22 | |
| 23 | GPIO3C2_SHIFT = 4, |
| 24 | GPIO3C2_MASK = 3 << GPIO3C2_SHIFT, |
| 25 | |
| 26 | GPIO2D2_SHIFT = 4, |
| 27 | GPIO2D2_MASK = 3 << GPIO2D2_SHIFT, |
| 28 | GPIO2D2_GPIO = 0, |
| 29 | GPIO2D2_UART2_SOUT_M0, |
| 30 | |
| 31 | GPIO2D1_SHIFT = 2, |
| 32 | GPIO2D1_MASK = 3 << GPIO2D1_SHIFT, |
| 33 | GPIO2D1_GPIO = 0, |
| 34 | GPIO2D1_UART2_SIN_M0, |
| 35 | }; |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 36 | |
Kever Yang | f6b6d94 | 2020-02-19 09:46:06 +0800 | [diff] [blame] | 37 | grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 38 | |
| 39 | /*evb board use UART2 m0 for debug*/ |
| 40 | rk_clrsetreg(&grf->gpio2d_iomux, |
| 41 | GPIO2D2_MASK | GPIO2D1_MASK, |
| 42 | GPIO2D2_UART2_SOUT_M0 << GPIO2D2_SHIFT | |
| 43 | GPIO2D1_UART2_SIN_M0 << GPIO2D1_SHIFT); |
| 44 | rk_clrreg(&grf->gpio3c_iomux, GPIO3C3_MASK | GPIO3C2_MASK); |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | |
Andy Yan | d6e658c | 2017-06-01 18:01:31 +0800 | [diff] [blame] | 49 | int dram_init(void) |
| 50 | { |
| 51 | gd->ram_size = 0x8000000; |
| 52 | |
| 53 | return 0; |
| 54 | } |