env: Move env_set() to env.h
[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 <env.h>
10 #include <led.h>
11 #include <asm/arch/at91_common.h>
12 #include <asm/arch/clk.h>
13
14 DECLARE_GLOBAL_DATA_PTR;
15
16 static void at91_prepare_cpu_var(void)
17 {
18         env_set("cpu", get_cpu_name());
19 }
20
21 int board_late_init(void)
22 {
23         at91_prepare_cpu_var();
24
25         if (IS_ENABLED(CONFIG_LED))
26                 led_default_state();
27
28         return 0;
29 }
30
31 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
32 void board_debug_uart_init(void)
33 {
34         at91_seriald_hw_init();
35 }
36 #endif
37
38 int board_early_init_f(void)
39 {
40 #ifdef CONFIG_DEBUG_UART
41         debug_uart_init();
42 #endif
43         return 0;
44 }
45
46 int board_init(void)
47 {
48         /* Address of boot parameters */
49         gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
50
51         return 0;
52 }
53
54 int dram_init(void)
55 {
56         gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
57                                     CONFIG_SYS_SDRAM_SIZE);
58
59         return 0;
60 }