blob: 8759ff6f01acc4953a6648711d81f41a67074515 [file] [log] [blame]
Mihai Sain82923a02023-07-24 14:35:10 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
4 *
5 * Author: Mihai Sain <mihai.sain@microchip.com>
6 *
7 */
8
Mihai Sain82923a02023-07-24 14:35:10 +03009#include <debug_uart.h>
10#include <init.h>
11#include <asm/global_data.h>
12#include <asm/io.h>
13#include <asm/arch/at91_common.h>
14#include <asm/arch/atmel_pio4.h>
15#include <asm/arch/atmel_sdhci.h>
16#include <asm/arch/clk.h>
17#include <asm/arch/gpio.h>
18#include <asm/arch/sama5d2.h>
19
20extern void at91_pda_detect(void);
21
22DECLARE_GLOBAL_DATA_PTR;
23
24static void rgb_leds_init(void)
25{
26 atmel_pio4_set_pio_output(AT91_PIO_PORTA, 7, 0); /* LED RED */
27 atmel_pio4_set_pio_output(AT91_PIO_PORTA, 8, 0); /* LED GREEN */
28 atmel_pio4_set_pio_output(AT91_PIO_PORTA, 9, 1); /* LED BLUE */
29}
30
31static void board_usb_hw_init(void)
32{
33 atmel_pio4_set_pio_output(AT91_PIO_PORTA, 6, 1);
34}
35
36int board_late_init(void)
37{
38 at91_video_show_board_info();
39
40 at91_pda_detect();
41
42 return 0;
43}
44
45static void board_uart0_hw_init(void)
46{
47 atmel_pio4_set_c_periph(AT91_PIO_PORTB, 26, ATMEL_PIO_PUEN_MASK); /* URXD0 */
48 atmel_pio4_set_c_periph(AT91_PIO_PORTB, 27, 0); /* UTXD0 */
49
50 at91_periph_clk_enable(ATMEL_ID_UART0);
51}
52
53void board_debug_uart_init(void)
54{
55 board_uart0_hw_init();
56}
57
58int board_early_init_f(void)
59{
60 debug_uart_init();
61
62 return 0;
63}
64
65int board_init(void)
66{
67 /* address of boot parameters */
68 gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
69
70 rgb_leds_init();
71
72 board_usb_hw_init();
73
74 return 0;
75}
76
77int dram_init_banksize(void)
78{
79 return fdtdec_setup_memory_banksize();
80}
81
82int dram_init(void)
83{
84 return fdtdec_setup_mem_size_base();
85}