Stefan Roese | dadede5 | 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 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 7 | #include <config.h> |
Stefan Roese | dadede5 | 2019-04-02 10:57:27 +0200 | [diff] [blame] | 8 | #include <debug_uart.h> |
Simon Glass | 5e6201b | 2019-08-01 09:46:51 -0600 | [diff] [blame] | 9 | #include <env.h> |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 10 | #include <init.h> |
Stefan Roese | dadede5 | 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> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 14 | #include <asm/global_data.h> |
Stefan Roese | dadede5 | 2019-04-02 10:57:27 +0200 | [diff] [blame] | 15 | |
| 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
| 18 | static void at91_prepare_cpu_var(void) |
| 19 | { |
| 20 | env_set("cpu", get_cpu_name()); |
| 21 | } |
| 22 | |
| 23 | int board_late_init(void) |
| 24 | { |
| 25 | at91_prepare_cpu_var(); |
| 26 | |
Stefan Roese | dadede5 | 2019-04-02 10:57:27 +0200 | [diff] [blame] | 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 */ |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 48 | gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100; |
Stefan Roese | dadede5 | 2019-04-02 10:57:27 +0200 | [diff] [blame] | 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | int dram_init(void) |
| 54 | { |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 55 | gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, |
| 56 | CFG_SYS_SDRAM_SIZE); |
Stefan Roese | dadede5 | 2019-04-02 10:57:27 +0200 | [diff] [blame] | 57 | |
| 58 | return 0; |
| 59 | } |