Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C)Copyright 2016 Rockchip Electronics Co., Ltd |
| 4 | * Authors: Andy Yan <andy.yan@rock-chips.com> |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 8 | #include <init.h> |
Kever Yang | 32e3983 | 2020-02-19 09:46:05 +0800 | [diff] [blame] | 9 | #include <syscon.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 10 | #include <asm/global_data.h> |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 11 | #include <asm/io.h> |
Kever Yang | 32e3983 | 2020-02-19 09:46:05 +0800 | [diff] [blame] | 12 | #include <asm/arch-rockchip/clock.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 13 | #include <asm/arch-rockchip/grf_rv1108.h> |
| 14 | #include <asm/arch-rockchip/hardware.h> |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 15 | #include <asm/gpio.h> |
| 16 | |
| 17 | DECLARE_GLOBAL_DATA_PTR; |
| 18 | |
Kever Yang | 8fdd888 | 2020-04-13 09:38:30 +0800 | [diff] [blame] | 19 | int board_early_init_f(void) |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 20 | { |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 21 | struct rv1108_grf *grf; |
| 22 | enum { |
| 23 | GPIO3C3_SHIFT = 6, |
| 24 | GPIO3C3_MASK = 3 << GPIO3C3_SHIFT, |
| 25 | |
| 26 | GPIO3C2_SHIFT = 4, |
| 27 | GPIO3C2_MASK = 3 << GPIO3C2_SHIFT, |
| 28 | |
| 29 | GPIO2D2_SHIFT = 4, |
| 30 | GPIO2D2_MASK = 3 << GPIO2D2_SHIFT, |
| 31 | GPIO2D2_GPIO = 0, |
| 32 | GPIO2D2_UART2_SOUT_M0, |
| 33 | |
| 34 | GPIO2D1_SHIFT = 2, |
| 35 | GPIO2D1_MASK = 3 << GPIO2D1_SHIFT, |
| 36 | GPIO2D1_GPIO = 0, |
| 37 | GPIO2D1_UART2_SIN_M0, |
| 38 | }; |
| 39 | |
Kever Yang | 32e3983 | 2020-02-19 09:46:05 +0800 | [diff] [blame] | 40 | grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 41 | |
| 42 | /* Elgin board use UART2 m0 for debug*/ |
| 43 | rk_clrsetreg(&grf->gpio2d_iomux, |
| 44 | GPIO2D2_MASK | GPIO2D1_MASK, |
| 45 | GPIO2D2_UART2_SOUT_M0 << GPIO2D2_SHIFT | |
| 46 | GPIO2D1_UART2_SIN_M0 << GPIO2D1_SHIFT); |
| 47 | rk_clrreg(&grf->gpio3c_iomux, GPIO3C3_MASK | GPIO3C2_MASK); |
| 48 | |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | #define MODEM_ENABLE_GPIO 111 |
| 53 | |
Otavio Salvador | 809d1ef | 2020-03-13 14:42:46 -0300 | [diff] [blame] | 54 | int rk_board_late_init(void) |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 55 | { |
| 56 | gpio_request(MODEM_ENABLE_GPIO, "modem_enable"); |
| 57 | gpio_direction_output(MODEM_ENABLE_GPIO, 0); |
| 58 | |
Kever Yang | 4690edd | 2019-07-22 20:02:20 +0800 | [diff] [blame] | 59 | return 0; |
| 60 | } |
| 61 | |
Otavio Salvador | b1ad047 | 2018-12-01 12:05:54 -0200 | [diff] [blame] | 62 | int dram_init(void) |
| 63 | { |
| 64 | gd->ram_size = 0x8000000; |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | int dram_init_banksize(void) |
| 70 | { |
| 71 | gd->bd->bi_dram[0].start = 0x60000000; |
| 72 | gd->bd->bi_dram[0].size = 0x8000000; |
| 73 | |
| 74 | return 0; |
| 75 | } |