1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved 4 * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics. 5 */ 6 7 #include <common.h> 8 #include <dm.h> 9 10 #include <asm/io.h> 11 #include <asm/arch/stm32.h> 12 13 DECLARE_GLOBAL_DATA_PTR; 14 15 int dram_init(void) 16 { 17 int rv; 18 struct udevice *dev; 19 20 rv = uclass_get_device(UCLASS_RAM, 0, &dev); 21 if (rv) { 22 debug("DRAM init failed: %d\n", rv); 23 return rv; 24 } 25 26 if (fdtdec_setup_mem_size_base() != 0) 27 rv = -EINVAL; 28 29 return rv; 30 } 31 32 int dram_init_banksize(void) 33 { 34 fdtdec_setup_memory_banksize(); 35 36 return 0; 37 } 38 39 u32 get_board_rev(void) 40 { 41 return 0; 42 } 43 44 int board_early_init_f(void) 45 { 46 return 0; 47 } 48 49 int board_init(void) 50 { 51 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; 52 53 return 0; 54 } 55 56 #ifdef CONFIG_MISC_INIT_R 57 int misc_init_r(void) 58 { 59 char serialno[25]; 60 u32 u_id_low, u_id_mid, u_id_high; 61 62 if (!env_get("serial#")) { 63 u_id_low = readl(&STM32_U_ID->u_id_low); 64 u_id_mid = readl(&STM32_U_ID->u_id_mid); 65 u_id_high = readl(&STM32_U_ID->u_id_high); 66 sprintf(serialno, "%08x%08x%08x", 67 u_id_high, u_id_mid, u_id_low); 68 env_set("serial#", serialno); 69 } 70 71 return 0; 72 } 73 #endif 74