2 * (C) Copyright 2015 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <debug_uart.h>
11 #include <asm/arch/bootrom.h>
12 #include <asm/arch/pmu_rk3188.h>
14 DECLARE_GLOBAL_DATA_PTR;
16 /* track how often we were entered */
17 static int rk3188_num_entries __attribute__ ((section(".data")));
19 #define PMU_BASE 0x20004000
20 #define SPL_ENTRY 0x10080C00
22 static void jump_to_spl(void)
24 typedef void __noreturn (*image_entry_noargs_t)(void);
26 struct rk3188_pmu * const pmu = (void *)PMU_BASE;
27 image_entry_noargs_t tpl_entry =
28 (image_entry_noargs_t)(unsigned long)SPL_ENTRY;
30 /* Store the SAVE_SP_ADDR in a location shared with SPL. */
31 writel(SAVE_SP_ADDR, &pmu->sys_reg[2]);
35 void board_init_f(ulong dummy)
37 /* Example code showing how to enable the debug UART on RK3188 */
39 #include <asm/arch/grf_rk3188.h>
40 /* Enable early UART on the RK3188 */
41 #define GRF_BASE 0x20008000
42 struct rk3188_grf * const grf = (void *)GRF_BASE;
44 rk_clrsetreg(&grf->gpio1b_iomux,
45 GPIO1B1_MASK << GPIO1B1_SHIFT |
46 GPIO1B0_MASK << GPIO1B0_SHIFT,
47 GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT |
48 GPIO1B0_UART2_SIN << GPIO1B0_SHIFT);
50 * Debug UART can be used from here if required:
55 * printascii("string");
63 printch(rk3188_num_entries + 1 + '0');
69 if (rk3188_num_entries == 1) {
71 * The original loader did some very basic integrity
72 * checking at this point, but the remaining few bytes
73 * could be used for any improvement making sense
80 * TPL part of the loader should now wait for us
81 * at offset 0xC00 in the sram. Should never return