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