1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries 4 * 5 * Author: Sandeep Sheriker M <sandeep.sheriker@microchip.com> 6 */ 7 8#include <common.h> 9#include <init.h> 10#include <asm/global_data.h> 11#include <asm/io.h> 12#include <asm/arch/at91sam9_smc.h> 13#include <asm/arch/at91_common.h> 14#include <asm/arch/at91_rstc.h> 15#include <asm/arch/at91_sfr.h> 16#include <asm/arch/clk.h> 17#include <asm/arch/gpio.h> 18#include <debug_uart.h> 19#include <asm/mach-types.h> 20 21extern void at91_pda_detect(void); 22 23DECLARE_GLOBAL_DATA_PTR; 24 25void at91_prepare_cpu_var(void); 26 27static void board_leds_init(void) 28{ 29 at91_set_pio_output(AT91_PIO_PORTB, 11, 0); /* LED RED */ 30 at91_set_pio_output(AT91_PIO_PORTB, 12, 0); /* LED GREEN */ 31 at91_set_pio_output(AT91_PIO_PORTB, 13, 1); /* LED BLUE */ 32} 33 34#ifdef CONFIG_BOARD_LATE_INIT 35int board_late_init(void) 36{ 37 at91_prepare_cpu_var(); 38 39 at91_pda_detect(); 40 41 return 0; 42} 43#endif 44 45#ifdef CONFIG_DEBUG_UART_BOARD_INIT 46void board_debug_uart_init(void) 47{ 48 at91_seriald_hw_init(); 49} 50#endif 51 52#ifdef CONFIG_BOARD_EARLY_INIT_F 53int board_early_init_f(void) 54{ 55 return 0; 56} 57#endif 58 59#define MAC24AA_MAC_OFFSET 0xfa 60 61#ifdef CONFIG_MISC_INIT_R 62int misc_init_r(void) 63{ 64#ifdef CONFIG_I2C_EEPROM 65 at91_set_ethaddr(MAC24AA_MAC_OFFSET); 66#endif 67 return 0; 68} 69#endif 70 71int board_init(void) 72{ 73 /* address of boot parameters */ 74 gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100; 75 76 board_leds_init(); 77 78 return 0; 79} 80 81int dram_init(void) 82{ 83 gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, 84 CFG_SYS_SDRAM_SIZE); 85 return 0; 86} 87