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