command: Remove the cmd_tbl_t typedef
[oweals/u-boot.git] / board / st / stm32f429-discovery / stm32f429-discovery.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2011, 2012, 2013
4  * Yuri Tikhonov, Emcraft Systems, yur@emcraft.com
5  * Alexander Potashev, Emcraft Systems, aspotashev@emcraft.com
6  * Vladimir Khusainov, Emcraft Systems, vlad@emcraft.com
7  * Pavel Boldin, Emcraft Systems, paboldin@emcraft.com
8  *
9  * (C) Copyright 2015
10  * Kamil Lulko, <kamil.lulko@gmail.com>
11  */
12
13 #include <common.h>
14 #include <dm.h>
15 #include <env.h>
16 #include <init.h>
17
18 #include <asm/io.h>
19 #include <asm/arch/stm32.h>
20
21 DECLARE_GLOBAL_DATA_PTR;
22
23 int dram_init(void)
24 {
25         int rv;
26         struct udevice *dev;
27
28         rv = uclass_get_device(UCLASS_RAM, 0, &dev);
29         if (rv) {
30                 debug("DRAM init failed: %d\n", rv);
31                 return rv;
32         }
33
34         if (fdtdec_setup_mem_size_base() != 0)
35                 rv = -EINVAL;
36
37         return rv;
38 }
39
40 int dram_init_banksize(void)
41 {
42         fdtdec_setup_memory_banksize();
43
44         return 0;
45 }
46
47 u32 get_board_rev(void)
48 {
49         return 0;
50 }
51
52 int board_early_init_f(void)
53 {
54         return 0;
55 }
56
57 int board_init(void)
58 {
59         gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
60
61         return 0;
62 }
63
64 #ifdef CONFIG_MISC_INIT_R
65 int misc_init_r(void)
66 {
67         char serialno[25];
68         uint32_t u_id_low, u_id_mid, u_id_high;
69
70         if (!env_get("serial#")) {
71                 u_id_low  = readl(&STM32_U_ID->u_id_low);
72                 u_id_mid  = readl(&STM32_U_ID->u_id_mid);
73                 u_id_high = readl(&STM32_U_ID->u_id_high);
74                 sprintf(serialno, "%08x%08x%08x",
75                         u_id_high, u_id_mid, u_id_low);
76                 env_set("serial#", serialno);
77         }
78
79         return 0;
80 }
81 #endif