blob: 83fd3bd754bdf1549a7a9fe65a8929649feb2f2a [file] [log] [blame]
Chander Kashyap0d2f2772013-08-21 10:38:56 +05301/*
2 * Copyright (C) 2013 Samsung Electronics
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
Inderpal Singh3260bc82014-01-08 09:19:57 +05308#include <usb.h>
Chander Kashyap0d2f2772013-08-21 10:38:56 +05309#include <asm/arch/pinmux.h>
Inderpal Singh04bb7372013-08-21 10:38:57 +053010#include <asm/arch/dwmmc.h>
Inderpal Singh3260bc82014-01-08 09:19:57 +053011#include <asm/arch/gpio.h>
Chander Kashyap0d2f2772013-08-21 10:38:56 +053012#include <asm/arch/power.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
Inderpal Singh3260bc82014-01-08 09:19:57 +053016#ifdef CONFIG_USB_EHCI_EXYNOS
17int board_usb_init(int index, enum usb_init_type init)
18{
Inderpal Singh3260bc82014-01-08 09:19:57 +053019 /* Configure gpios for usb 3503 hub:
20 * disconnect, toggle reset and connect
21 */
Akshay Saraswat1376cdd2014-05-13 10:30:14 +053022 gpio_direction_output(EXYNOS5_GPIO_D17, 0);
23 gpio_direction_output(EXYNOS5_GPIO_X35, 0);
Inderpal Singh3260bc82014-01-08 09:19:57 +053024
Akshay Saraswat1376cdd2014-05-13 10:30:14 +053025 gpio_direction_output(EXYNOS5_GPIO_X35, 1);
26 gpio_direction_output(EXYNOS5_GPIO_D17, 1);
Inderpal Singh3260bc82014-01-08 09:19:57 +053027
28 return 0;
29}
30#endif
31
Chander Kashyap0d2f2772013-08-21 10:38:56 +053032int board_init(void)
33{
34 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
35 return 0;
36}
37
38int dram_init(void)
39{
40 int i;
41 u32 addr;
42
43 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
44 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
45 gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE);
46 }
47 return 0;
48}
49
50int power_init_board(void)
51{
52 set_ps_hold_ctrl();
53 return 0;
54}
55
56void dram_init_banksize(void)
57{
58 int i;
59 u32 addr, size;
60
61 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
62 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
63 size = get_ram_size((long *)addr, SDRAM_BANK_SIZE);
64
65 gd->bd->bi_dram[i].start = addr;
66 gd->bd->bi_dram[i].size = size;
67 }
68}
69
Inderpal Singh04bb7372013-08-21 10:38:57 +053070#ifdef CONFIG_GENERIC_MMC
71int board_mmc_init(bd_t *bis)
72{
73 int ret;
74 /* dwmmc initializattion for available channels */
75 ret = exynos_dwmmc_init(gd->fdt_blob);
76 if (ret)
77 debug("dwmmc init failed\n");
78
79 return ret;
80}
81#endif
82
Chander Kashyap0d2f2772013-08-21 10:38:56 +053083static int board_uart_init(void)
84{
85 int err = 0, uart_id;
86
87 for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) {
88 err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE);
89 if (err) {
90 debug("UART%d not configured\n",
91 (uart_id - PERIPH_ID_UART0));
92 return err;
93 }
94 }
95 return err;
96}
97
98#ifdef CONFIG_BOARD_EARLY_INIT_F
99int board_early_init_f(void)
100{
101 int err;
102
103 err = board_uart_init();
104 if (err) {
105 debug("UART init failed\n");
106 return err;
107 }
108 return err;
109}
110#endif
111
112#ifdef CONFIG_DISPLAY_BOARDINFO
113int checkboard(void)
114{
115 printf("\nBoard: Arndale\n");
116
117 return 0;
118}
119#endif
Andre Przywara64d4c222014-08-01 13:35:44 +0200120
121#ifdef CONFIG_S5P_PA_SYSRAM
122void smp_set_core_boot_addr(unsigned long addr, int corenr)
123{
124 writel(addr, CONFIG_S5P_PA_SYSRAM);
125
126 /* make sure this write is really executed */
127 __asm__ volatile ("dsb\n");
128}
129#endif