1 /* 2 * (C) Copyright 2015 Google, Inc 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <clk.h> 9 #include <dm.h> 10 #include <ram.h> 11 #include <syscon.h> 12 #include <asm/io.h> 13 #include <asm/arch/clock.h> 14 #include <asm/arch/periph.h> 15 #include <asm/arch/pmu_rk3288.h> 16 #include <asm/arch/boot_mode.h> 17 #include <asm/gpio.h> 18 #include <dm/pinctrl.h> 19 20 DECLARE_GLOBAL_DATA_PTR; 21 22 int board_init(void) 23 { 24 #if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM) 25 struct udevice *pinctrl; 26 int ret; 27 28 /* 29 * We need to implement sdcard iomux here for the further 30 * initialization, otherwise, it'll hit sdcard command sending 31 * timeout exception. 32 */ 33 ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); 34 if (ret) { 35 debug("%s: Cannot find pinctrl device\n", __func__); 36 goto err; 37 } 38 ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD); 39 if (ret) { 40 debug("%s: Failed to set up SD card\n", __func__); 41 goto err; 42 } 43 44 return 0; 45 err: 46 printf("board_init: Error %d\n", ret); 47 48 /* No way to report error here */ 49 hang(); 50 51 return -1; 52 #else 53 return 0; 54 #endif 55 } 56 57 int dram_init(void) 58 { 59 /* FIXME: read back ram size from sys_reg2 */ 60 gd->ram_size = 0x40000000; 61 62 return 0; 63 } 64 65 #ifndef CONFIG_SYS_DCACHE_OFF 66 void enable_caches(void) 67 { 68 /* Enable D-cache. I-cache is already enabled in start.S */ 69 dcache_enable(); 70 } 71 #endif 72