arm: at91: Add gardena-gateway-at91sam support
[oweals/u-boot.git] / board / gardena / smart-gateway-at91sam / board.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2012 Atmel Corporation
4  * Copyright (C) 2019 Stefan Roese <sr@denx.de>
5  */
6
7 #include <common.h>
8 #include <debug_uart.h>
9 #include <led.h>
10 #include <asm/arch/at91_common.h>
11 #include <asm/arch/clk.h>
12
13 DECLARE_GLOBAL_DATA_PTR;
14
15 static void at91_prepare_cpu_var(void)
16 {
17         env_set("cpu", get_cpu_name());
18 }
19
20 int board_late_init(void)
21 {
22         at91_prepare_cpu_var();
23
24         if (IS_ENABLED(CONFIG_LED))
25                 led_default_state();
26
27         return 0;
28 }
29
30 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
31 void board_debug_uart_init(void)
32 {
33         at91_seriald_hw_init();
34 }
35 #endif
36
37 int board_early_init_f(void)
38 {
39 #ifdef CONFIG_DEBUG_UART
40         debug_uart_init();
41 #endif
42         return 0;
43 }
44
45 int board_init(void)
46 {
47         /* Address of boot parameters */
48         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
49
50         return 0;
51 }
52
53 int dram_init(void)
54 {
55         gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
56                                     CONFIG_SYS_SDRAM_SIZE);
57
58         return 0;
59 }