2 * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <debug_uart.h>
10 #include <dm/pinctrl.h>
14 #include <asm/arch/cru_rk3368.h>
15 #include <asm/arch/grf_rk3368.h>
16 #include <asm/arch/hardware.h>
17 #include <asm/arch/periph.h>
18 #include <asm/arch/timer.h>
20 DECLARE_GLOBAL_DATA_PTR;
23 * The ARMv8 generic timer uses the STIMER1 as its clock-source.
24 * Set up the STIMER1 to free-running (i.e. auto-reload) to start
25 * the generic timer counting (if we don't do this, udelay will not
26 * work and block indefinitively).
28 static void secure_timer_init(void)
30 struct rk_timer * const stimer1 =
31 (struct rk_timer * const)0xff830020;
32 const u32 TIMER_EN = BIT(0);
34 writel(~0u, &stimer1->timer_load_count0);
35 writel(~0u, &stimer1->timer_load_count1);
36 writel(TIMER_EN, &stimer1->timer_ctrl_reg);
39 void board_debug_uart_init(void)
43 void board_init_f(ulong dummy)
45 struct udevice *pinctrl;
49 ret = spl_early_init();
51 debug("spl_early_init() failed: %d\n", ret);
55 /* Make sure the ARMv8 generic timer counts */
58 /* Set up our preloader console */
59 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
61 error("%s: pinctrl init failed: %d\n", __func__, ret);
65 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0);
67 error("%s: failed to set up console UART\n", __func__);
71 preloader_console_init();
73 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
75 debug("DRAM init failed: %d\n", ret);
80 u32 spl_boot_mode(const u32 boot_device)
82 return MMCSD_MODE_RAW;
85 u32 spl_boot_device(void)
87 return BOOT_DEVICE_MMC1;
90 #ifdef CONFIG_SPL_LOAD_FIT
91 int board_fit_config_name_match(const char *name)
93 /* Just empty function now - can't decide what to choose */
94 debug("%s: %s\n", __func__, name);