]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
ed09a554 | 2 | /* |
3 | * (C) Copyright 2011, 2012, 2013 | |
4 | * Yuri Tikhonov, Emcraft Systems, [email protected] | |
5 | * Alexander Potashev, Emcraft Systems, [email protected] | |
6 | * Vladimir Khusainov, Emcraft Systems, [email protected] | |
7 | * Pavel Boldin, Emcraft Systems, [email protected] | |
8 | * | |
9 | * (C) Copyright 2015 | |
66562414 | 10 | * Kamil Lulko, <[email protected]> |
ed09a554 | 11 | */ |
12 | ||
13 | #include <common.h> | |
9d922450 | 14 | #include <dm.h> |
09140113 | 15 | #include <env.h> |
691d719d | 16 | #include <init.h> |
4a56fd48 | 17 | |
ed09a554 | 18 | #include <asm/io.h> |
ed09a554 | 19 | #include <asm/arch/stm32.h> |
ed09a554 | 20 | |
21 | DECLARE_GLOBAL_DATA_PTR; | |
22 | ||
ed09a554 | 23 | int dram_init(void) |
24 | { | |
ed09a554 | 25 | int rv; |
7fd65ef5 | 26 | struct udevice *dev; |
ed09a554 | 27 | |
7fd65ef5 PC |
28 | rv = uclass_get_device(UCLASS_RAM, 0, &dev); |
29 | if (rv) { | |
30 | debug("DRAM init failed: %d\n", rv); | |
31 | return rv; | |
32 | } | |
ed09a554 | 33 | |
12308b12 | 34 | if (fdtdec_setup_mem_size_base() != 0) |
7fd65ef5 | 35 | rv = -EINVAL; |
ed09a554 | 36 | |
7fd65ef5 PC |
37 | return rv; |
38 | } | |
ed09a554 | 39 | |
7fd65ef5 PC |
40 | int dram_init_banksize(void) |
41 | { | |
42 | fdtdec_setup_memory_banksize(); | |
ed09a554 | 43 | |
7fd65ef5 | 44 | return 0; |
ed09a554 | 45 | } |
46 | ||
47 | u32 get_board_rev(void) | |
48 | { | |
49 | return 0; | |
50 | } | |
51 | ||
52 | int board_early_init_f(void) | |
53 | { | |
ed09a554 | 54 | return 0; |
55 | } | |
56 | ||
57 | int board_init(void) | |
58 | { | |
725e09b8 | 59 | gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; |
ed09a554 | 60 | |
61 | return 0; | |
62 | } | |
089fddfd AB |
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 | ||
00caae6d | 70 | if (!env_get("serial#")) { |
089fddfd AB |
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); | |
382bee57 | 76 | env_set("serial#", serialno); |
089fddfd AB |
77 | } |
78 | ||
79 | return 0; | |
80 | } | |
81 | #endif |