Durai Manickam KR | 2e7bc61 | 2022-04-04 11:23:18 +0530 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries |
| 4 | * |
| 5 | * Author: Durai Manickam KR <durai.manickamkr@microchip.com> |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <debug_uart.h> |
| 10 | #include <fdtdec.h> |
| 11 | #include <init.h> |
| 12 | #include <asm/arch/at91_common.h> |
| 13 | #include <asm/arch/at91_rstc.h> |
| 14 | #include <asm/arch/at91_sfr.h> |
| 15 | #include <asm/arch/at91sam9_smc.h> |
| 16 | #include <asm/arch/clk.h> |
| 17 | #include <asm/arch/gpio.h> |
| 18 | #include <asm/global_data.h> |
| 19 | #include <asm/io.h> |
| 20 | #include <asm/mach-types.h> |
| 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | void at91_prepare_cpu_var(void); |
| 25 | |
| 26 | int board_late_init(void) |
| 27 | { |
| 28 | at91_prepare_cpu_var(); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | #ifdef CONFIG_DEBUG_UART_BOARD_INIT |
| 34 | void board_debug_uart_init(void) |
| 35 | { |
| 36 | at91_seriald_hw_init(); |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | int board_early_init_f(void) |
| 41 | { |
| 42 | #ifdef CONFIG_DEBUG_UART |
| 43 | debug_uart_init(); |
| 44 | #endif |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | #define MAC24AA_MAC_OFFSET 0xfa |
| 49 | |
| 50 | #ifdef CONFIG_MISC_INIT_R |
| 51 | int misc_init_r(void) |
| 52 | { |
| 53 | #ifdef CONFIG_I2C_EEPROM |
| 54 | at91_set_ethaddr(MAC24AA_MAC_OFFSET); |
| 55 | #endif |
| 56 | return 0; |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | int board_init(void) |
| 61 | { |
| 62 | /* address of boot parameters */ |
| 63 | gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | int dram_init_banksize(void) |
| 68 | { |
| 69 | return fdtdec_setup_memory_banksize(); |
| 70 | } |
| 71 | |
| 72 | int dram_init(void) |
| 73 | { |
| 74 | return fdtdec_setup_mem_size_base(); |
| 75 | } |