blob: 90d7045e9ab7abff78e35271ae19fef35099bd62 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Patrice Chotardc0cdd5a2017-12-12 09:49:44 +01002/*
3 * Copyright (C) STMicroelectronics SA 2017
4 * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
Patrice Chotardc0cdd5a2017-12-12 09:49:44 +01005 */
6
7#include <common.h>
8#include <dm.h>
9
10#include <asm/io.h>
11#include <asm/arch/stm32.h>
12
13DECLARE_GLOBAL_DATA_PTR;
14
15int 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_memory_size() != 0)
27 rv = -EINVAL;
28
29 return rv;
30}
31
32int dram_init_banksize(void)
33{
34 fdtdec_setup_memory_banksize();
35
36 return 0;
37}
38
39u32 get_board_rev(void)
40{
41 return 0;
42}
43
44int board_early_init_f(void)
45{
46 return 0;
47}
48
49int 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
57int 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