]>
Commit | Line | Data |
---|---|---|
1d463d67 EH |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (C) 2020 Microchip Technology, Inc. | |
4 | * Eugen Hristev <eugen.hristev@microchip.com> | |
5 | */ | |
6 | ||
d678a59d | 7 | #include <common.h> |
1d463d67 EH |
8 | #include <debug_uart.h> |
9 | #include <init.h> | |
401d1c4f | 10 | #include <asm/global_data.h> |
1d463d67 EH |
11 | #include <asm/io.h> |
12 | #include <asm/arch/at91_common.h> | |
13 | #include <asm/arch/atmel_pio4.h> | |
14 | #include <asm/arch/clk.h> | |
15 | #include <asm/arch/gpio.h> | |
16 | #include <asm/arch/sama7g5.h> | |
17 | ||
18 | DECLARE_GLOBAL_DATA_PTR; | |
19 | ||
93ddc09d MS |
20 | static void board_leds_init(void) |
21 | { | |
22 | atmel_pio4_set_pio_output(AT91_PIO_PORTB, 8, 0); /* LED RED */ | |
23 | atmel_pio4_set_pio_output(AT91_PIO_PORTA, 13, 0); /* LED GREEN */ | |
24 | atmel_pio4_set_pio_output(AT91_PIO_PORTD, 20, 1); /* LED BLUE */ | |
25 | } | |
26 | ||
1d463d67 EH |
27 | int board_late_init(void) |
28 | { | |
29 | return 0; | |
30 | } | |
31 | ||
32 | #if (IS_ENABLED(CONFIG_DEBUG_UART_BOARD_INIT)) | |
33 | static void board_uart0_hw_init(void) | |
34 | { | |
35 | /* FLEXCOM3 IO0 */ | |
36 | atmel_pio4_set_f_periph(AT91_PIO_PORTD, 17, ATMEL_PIO_PUEN_MASK); | |
37 | /* FLEXCOM3 IO1 */ | |
38 | atmel_pio4_set_f_periph(AT91_PIO_PORTD, 16, 0); | |
39 | ||
40 | at91_periph_clk_enable(ATMEL_ID_FLEXCOM3); | |
41 | } | |
42 | ||
43 | void board_debug_uart_init(void) | |
44 | { | |
45 | board_uart0_hw_init(); | |
46 | } | |
47 | #endif | |
48 | ||
49 | int board_early_init_f(void) | |
50 | { | |
1d463d67 EH |
51 | return 0; |
52 | } | |
53 | ||
a07d2a11 EH |
54 | #define MAC24AA_MAC_OFFSET 0xfa |
55 | ||
56 | #if (IS_ENABLED(CONFIG_MISC_INIT_R)) | |
57 | int misc_init_r(void) | |
58 | { | |
59 | #if (IS_ENABLED(CONFIG_I2C_EEPROM)) | |
60 | at91_set_ethaddr(MAC24AA_MAC_OFFSET); | |
61 | at91_set_eth1addr(MAC24AA_MAC_OFFSET); | |
62 | #endif | |
63 | return 0; | |
64 | } | |
65 | #endif | |
66 | ||
1d463d67 EH |
67 | int board_init(void) |
68 | { | |
69 | /* address of boot parameters */ | |
aa6e94de | 70 | gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100; |
1d463d67 | 71 | |
93ddc09d MS |
72 | board_leds_init(); |
73 | ||
1d463d67 EH |
74 | return 0; |
75 | } | |
76 | ||
77 | int dram_init(void) | |
78 | { | |
aa6e94de TR |
79 | gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, |
80 | CFG_SYS_SDRAM_SIZE); | |
1d463d67 EH |
81 | return 0; |
82 | } |