blob: 3f402cfeee8c1a3a0e06c98418bb96d9b140780b [file] [log] [blame]
Stefan Roesea71e2f92019-04-02 10:57:27 +02001// 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>
Simon Glass9fb625c2019-08-01 09:46:51 -06009#include <env.h>
Simon Glass52559322019-11-14 12:57:46 -070010#include <init.h>
Stefan Roesea71e2f92019-04-02 10:57:27 +020011#include <led.h>
12#include <asm/arch/at91_common.h>
13#include <asm/arch/clk.h>
Simon Glass401d1c42020-10-30 21:38:53 -060014#include <asm/global_data.h>
Stefan Roesea71e2f92019-04-02 10:57:27 +020015
16DECLARE_GLOBAL_DATA_PTR;
17
18static void at91_prepare_cpu_var(void)
19{
20 env_set("cpu", get_cpu_name());
21}
22
23int board_late_init(void)
24{
25 at91_prepare_cpu_var();
26
27 if (IS_ENABLED(CONFIG_LED))
28 led_default_state();
29
30 return 0;
31}
32
33#ifdef CONFIG_DEBUG_UART_BOARD_INIT
34void board_debug_uart_init(void)
35{
36 at91_seriald_hw_init();
37}
38#endif
39
40int board_early_init_f(void)
41{
42#ifdef CONFIG_DEBUG_UART
43 debug_uart_init();
44#endif
45 return 0;
46}
47
48int board_init(void)
49{
50 /* Address of boot parameters */
51 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
52
53 return 0;
54}
55
56int dram_init(void)
57{
58 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
59 CONFIG_SYS_SDRAM_SIZE);
60
61 return 0;
62}