blob: 70b55ca8abf6c98173a5a332d4d5b81603d9bc13 [file] [log] [blame]
Johan Jonkera289fc72022-04-16 17:09:47 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2016 Rockchip Electronics Co., Ltd
4 */
5
Johan Jonkera289fc72022-04-16 17:09:47 +02006#include <asm/arch-rockchip/bootrom.h>
7#include <asm/arch-rockchip/grf_rk3066.h>
Quentin Schulz5e38edb2024-03-11 13:01:56 +01008#include <asm/arch-rockchip/hardware.h>
Johan Jonkera289fc72022-04-16 17:09:47 +02009
10#define GRF_BASE 0x20008000
11
12const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
13 [BROM_BOOTSOURCE_EMMC] = "/mmc@1021c000",
14 [BROM_BOOTSOURCE_SD] = "/mmc@10214000",
15};
16
17void board_debug_uart_init(void)
18{
19 struct rk3066_grf * const grf = (void *)GRF_BASE;
20
21 /* Enable early UART on the RK3066 */
22 rk_clrsetreg(&grf->gpio1b_iomux,
23 GPIO1B1_MASK | GPIO1B0_MASK,
24 GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT |
25 GPIO1B0_UART2_SIN << GPIO1B0_SHIFT);
26}
27
28void spl_board_init(void)
29{
30 if (!IS_ENABLED(CONFIG_SPL_BUILD))
31 return;
32
33 if (IS_ENABLED(CONFIG_SPL_DM_MMC)) {
34 struct rk3066_grf * const grf = (void *)GRF_BASE;
35
36 rk_clrsetreg(&grf->gpio3b_iomux,
37 GPIO3B0_MASK | GPIO3B1_MASK | GPIO3B2_MASK |
38 GPIO3B3_MASK | GPIO3B4_MASK | GPIO3B5_MASK |
39 GPIO3B6_MASK,
40 GPIO3B0_SDMMC0_CLKOUT << GPIO3B0_SHIFT |
41 GPIO3B1_SDMMC0_CMD << GPIO3B1_SHIFT |
42 GPIO3B2_SDMMC0_DATA0 << GPIO3B2_SHIFT |
43 GPIO3B3_SDMMC0_DATA1 << GPIO3B3_SHIFT |
44 GPIO3B4_SDMMC0_DATA2 << GPIO3B4_SHIFT |
45 GPIO3B5_SDMMC0_DATA3 << GPIO3B5_SHIFT |
46 GPIO3B6_SDMMC0_DECTN << GPIO3B6_SHIFT);
47 }
48}