blob: 70d23d90f4ca7d181ecb2ea7971a8091a1f80aa6 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Patrice Chotard73ef2f02017-12-12 09:49:44 +01002/*
3 * Copyright (C) STMicroelectronics SA 2017
4 * Author(s): Patrice CHOTARD, <patrice.chotard@st.com> for STMicroelectronics.
Patrice Chotard73ef2f02017-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
Siva Durga Prasad Paladugub3d55ea2018-07-16 15:56:11 +053026 if (fdtdec_setup_mem_size_base() != 0)
Patrice Chotard73ef2f02017-12-12 09:49:44 +010027 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{
Patrice Chotarda66c1b42018-08-03 11:46:11 +020051 gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
Patrice Chotard73ef2f02017-12-12 09:49:44 +010052
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