blob: 8ab2fa5d59abc763839b5212f9605b362e7a20dc [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Patrice Chotarde23b19f2018-01-18 13:39:32 +01002/*
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
4 * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
Patrice Chotarde23b19f2018-01-18 13:39:32 +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 Paladugu12308b12018-07-16 15:56:11 +053026 if (fdtdec_setup_mem_size_base() != 0)
Patrice Chotarde23b19f2018-01-18 13:39:32 +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 Chotard725e09b2018-08-03 11:46:11 +020051 gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
Patrice Chotarde23b19f2018-01-18 13:39:32 +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