blob: b43242fd3f40678572b4adca340ff1942862e716 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Chander Kashyapa2ac68f2013-08-21 10:38:56 +05302/*
3 * Copyright (C) 2013 Samsung Electronics
Chander Kashyapa2ac68f2013-08-21 10:38:56 +05304 */
5
6#include <common.h>
Simon Glass62270f42019-11-14 12:57:35 -07007#include <cpu_func.h>
Simon Glass9b4a2052019-12-28 10:45:05 -07008#include <init.h>
Simon Glassf7ae49f2020-05-10 11:40:05 -06009#include <log.h>
Inderpal Singh7da76512014-01-08 09:19:57 +053010#include <usb.h>
Simon Glass401d1c42020-10-30 21:38:53 -060011#include <asm/global_data.h>
Simon Glass903fd792014-10-20 19:48:37 -060012#include <asm/gpio.h>
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053013#include <asm/arch/pinmux.h>
Inderpal Singhcc2b1012013-08-21 10:38:57 +053014#include <asm/arch/dwmmc.h>
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053015#include <asm/arch/power.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
Inderpal Singh7da76512014-01-08 09:19:57 +053019#ifdef CONFIG_USB_EHCI_EXYNOS
20int board_usb_init(int index, enum usb_init_type init)
21{
Inderpal Singh7da76512014-01-08 09:19:57 +053022 /* Configure gpios for usb 3503 hub:
23 * disconnect, toggle reset and connect
24 */
Simon Glass7f196102014-10-20 19:48:39 -060025 gpio_request(EXYNOS5_GPIO_D17, "usb_connect");
26 gpio_request(EXYNOS5_GPIO_X35, "usb_reset");
Akshay Saraswatf6ae1ca2014-05-13 10:30:14 +053027 gpio_direction_output(EXYNOS5_GPIO_D17, 0);
28 gpio_direction_output(EXYNOS5_GPIO_X35, 0);
Inderpal Singh7da76512014-01-08 09:19:57 +053029
Akshay Saraswatf6ae1ca2014-05-13 10:30:14 +053030 gpio_direction_output(EXYNOS5_GPIO_X35, 1);
31 gpio_direction_output(EXYNOS5_GPIO_D17, 1);
Inderpal Singh7da76512014-01-08 09:19:57 +053032
33 return 0;
34}
35#endif
36
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053037int board_init(void)
38{
39 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
40 return 0;
41}
42
43int dram_init(void)
44{
45 int i;
46 u32 addr;
47
48 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
49 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
50 gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE);
51 }
52 return 0;
53}
54
55int power_init_board(void)
56{
57 set_ps_hold_ctrl();
58 return 0;
59}
60
Simon Glass76b00ac2017-03-31 08:40:32 -060061int dram_init_banksize(void)
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053062{
63 int i;
64 u32 addr, size;
65
66 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
67 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
68 size = get_ram_size((long *)addr, SDRAM_BANK_SIZE);
69
70 gd->bd->bi_dram[i].start = addr;
71 gd->bd->bi_dram[i].size = size;
72 }
Simon Glass76b00ac2017-03-31 08:40:32 -060073
74 return 0;
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053075}
76
Chander Kashyapa2ac68f2013-08-21 10:38:56 +053077static int board_uart_init(void)
78{
79 int err = 0, uart_id;
80
81 for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) {
82 err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE);
83 if (err) {
84 debug("UART%d not configured\n",
85 (uart_id - PERIPH_ID_UART0));
86 return err;
87 }
88 }
89 return err;
90}
91
92#ifdef CONFIG_BOARD_EARLY_INIT_F
93int board_early_init_f(void)
94{
95 int err;
96
97 err = board_uart_init();
98 if (err) {
99 debug("UART init failed\n");
100 return err;
101 }
102 return err;
103}
104#endif
105
106#ifdef CONFIG_DISPLAY_BOARDINFO
107int checkboard(void)
108{
109 printf("\nBoard: Arndale\n");
110
111 return 0;
112}
113#endif
Andre Przywarafafbc6c2014-08-01 13:35:44 +0200114
115#ifdef CONFIG_S5P_PA_SYSRAM
116void smp_set_core_boot_addr(unsigned long addr, int corenr)
117{
118 writel(addr, CONFIG_S5P_PA_SYSRAM);
119
120 /* make sure this write is really executed */
121 __asm__ volatile ("dsb\n");
122}
123#endif