spi: zynqmp_gqspi: fix set_speed bug on multiple runs
[platform/kernel/u-boot.git] / arch / arm / mach-aspeed / ast2500 / board_common.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) 2016 Google, Inc
4  */
5 #include <common.h>
6 #include <dm.h>
7 #include <init.h>
8 #include <log.h>
9 #include <ram.h>
10 #include <timer.h>
11 #include <asm/io.h>
12 #include <asm/arch/timer.h>
13 #include <asm/arch/wdt.h>
14 #include <linux/err.h>
15 #include <dm/uclass.h>
16
17 /*
18  * Second Watchdog Timer by default is configured
19  * to trigger secondary boot source.
20  */
21 #define AST_2ND_BOOT_WDT                1
22
23 /*
24  * Third Watchdog Timer by default is configured
25  * to toggle Flash address mode switch before reset.
26  */
27 #define AST_FLASH_ADDR_DETECT_WDT       2
28
29 DECLARE_GLOBAL_DATA_PTR;
30
31 int board_init(void)
32 {
33         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
34
35         return 0;
36 }
37
38 int dram_init(void)
39 {
40         struct udevice *dev;
41         struct ram_info ram;
42         int ret;
43
44         ret = uclass_get_device(UCLASS_RAM, 0, &dev);
45         if (ret) {
46                 debug("DRAM FAIL1\r\n");
47                 return ret;
48         }
49
50         ret = ram_get_info(dev, &ram);
51         if (ret) {
52                 debug("DRAM FAIL2\r\n");
53                 return ret;
54         }
55
56         gd->ram_size = ram.size;
57
58         return 0;
59 }