blob: 10398e7f71264ee11ab3993be315d48ebc23cee7 [file] [log] [blame]
Otavio Salvadorb1ad0472018-12-01 12:05:54 -02001// 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
Tom Riniabb9a042024-05-18 20:20:43 -06007#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Kever Yang32e39832020-02-19 09:46:05 +08009#include <syscon.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Kever Yang32e39832020-02-19 09:46:05 +080011#include <asm/arch-rockchip/clock.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080012#include <asm/arch-rockchip/grf_rv1108.h>
13#include <asm/arch-rockchip/hardware.h>
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020014#include <asm/gpio.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
Kever Yang8fdd8882020-04-13 09:38:30 +080018int board_early_init_f(void)
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020019{
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020020 struct rv1108_grf *grf;
21 enum {
22 GPIO3C3_SHIFT = 6,
23 GPIO3C3_MASK = 3 << GPIO3C3_SHIFT,
24
25 GPIO3C2_SHIFT = 4,
26 GPIO3C2_MASK = 3 << GPIO3C2_SHIFT,
27
28 GPIO2D2_SHIFT = 4,
29 GPIO2D2_MASK = 3 << GPIO2D2_SHIFT,
30 GPIO2D2_GPIO = 0,
31 GPIO2D2_UART2_SOUT_M0,
32
33 GPIO2D1_SHIFT = 2,
34 GPIO2D1_MASK = 3 << GPIO2D1_SHIFT,
35 GPIO2D1_GPIO = 0,
36 GPIO2D1_UART2_SIN_M0,
37 };
38
Kever Yang32e39832020-02-19 09:46:05 +080039 grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020040
41 /* Elgin board use UART2 m0 for debug*/
42 rk_clrsetreg(&grf->gpio2d_iomux,
43 GPIO2D2_MASK | GPIO2D1_MASK,
44 GPIO2D2_UART2_SOUT_M0 << GPIO2D2_SHIFT |
45 GPIO2D1_UART2_SIN_M0 << GPIO2D1_SHIFT);
46 rk_clrreg(&grf->gpio3c_iomux, GPIO3C3_MASK | GPIO3C2_MASK);
47
48 return 0;
49}
50
51#define MODEM_ENABLE_GPIO 111
52
Otavio Salvador809d1ef2020-03-13 14:42:46 -030053int rk_board_late_init(void)
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020054{
55 gpio_request(MODEM_ENABLE_GPIO, "modem_enable");
56 gpio_direction_output(MODEM_ENABLE_GPIO, 0);
57
Kever Yang4690edd2019-07-22 20:02:20 +080058 return 0;
59}
60
Otavio Salvadorb1ad0472018-12-01 12:05:54 -020061int dram_init(void)
62{
63 gd->ram_size = 0x8000000;
64
65 return 0;
66}
67
68int dram_init_banksize(void)
69{
70 gd->bd->bi_dram[0].start = 0x60000000;
71 gd->bd->bi_dram[0].size = 0x8000000;
72
73 return 0;
74}