blob: 04bf2bb5c96faf2c30e90db573dee7bc96144696 [file] [log] [blame]
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +00001// 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>
Simon Glass8e16b1e2019-12-28 10:45:05 -07009#include <init.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000011#include <asm/io.h>
Tudor Ambaruse76c66a2019-09-27 13:09:07 +000012#include <asm/arch/at91sam9_smc.h>
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000013#include <asm/arch/at91_common.h>
14#include <asm/arch/at91_rstc.h>
Tudor Ambaruse76c66a2019-09-27 13:09:07 +000015#include <asm/arch/at91_sfr.h>
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000016#include <asm/arch/clk.h>
17#include <asm/arch/gpio.h>
18#include <debug_uart.h>
19#include <asm/mach-types.h>
20
Eugen Hristevf9990dc2019-09-30 07:29:01 +000021extern void at91_pda_detect(void);
22
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000023DECLARE_GLOBAL_DATA_PTR;
24
25void at91_prepare_cpu_var(void);
26
27#ifdef CONFIG_BOARD_LATE_INIT
28int board_late_init(void)
29{
30 at91_prepare_cpu_var();
Eugen Hristevf9990dc2019-09-30 07:29:01 +000031
32 at91_pda_detect();
33
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000034 return 0;
35}
36#endif
37
38#ifdef CONFIG_DEBUG_UART_BOARD_INIT
39void board_debug_uart_init(void)
40{
41 at91_seriald_hw_init();
42}
43#endif
44
45#ifdef CONFIG_BOARD_EARLY_INIT_F
46int board_early_init_f(void)
47{
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000048 return 0;
49}
50#endif
51
Eugen Hristeva4f51ce2019-10-09 09:23:43 +000052#define MAC24AA_MAC_OFFSET 0xfa
53
54#ifdef CONFIG_MISC_INIT_R
55int misc_init_r(void)
56{
57#ifdef CONFIG_I2C_EEPROM
58 at91_set_ethaddr(MAC24AA_MAC_OFFSET);
59#endif
60 return 0;
61}
62#endif
63
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000064int board_init(void)
65{
66 /* address of boot parameters */
Tom Rinibb4dd962022-11-16 13:10:37 -050067 gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000068
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000069 return 0;
70}
71
72int dram_init(void)
73{
Tom Rinibb4dd962022-11-16 13:10:37 -050074 gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE,
75 CFG_SYS_SDRAM_SIZE);
Sandeep Sheriker Mallikarjun641b3352019-09-27 13:08:52 +000076 return 0;
77}