xref: /openbmc/u-boot/board/samsung/arndale/arndale.c (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2a2ac68fbSChander Kashyap /*
3a2ac68fbSChander Kashyap  * Copyright (C) 2013 Samsung Electronics
4a2ac68fbSChander Kashyap  */
5a2ac68fbSChander Kashyap 
6a2ac68fbSChander Kashyap #include <common.h>
77da76512SInderpal Singh #include <usb.h>
8903fd795SSimon Glass #include <asm/gpio.h>
9a2ac68fbSChander Kashyap #include <asm/arch/pinmux.h>
10cc2b1012SInderpal Singh #include <asm/arch/dwmmc.h>
11a2ac68fbSChander Kashyap #include <asm/arch/power.h>
12a2ac68fbSChander Kashyap 
13a2ac68fbSChander Kashyap DECLARE_GLOBAL_DATA_PTR;
14a2ac68fbSChander Kashyap 
157da76512SInderpal Singh #ifdef CONFIG_USB_EHCI_EXYNOS
board_usb_init(int index,enum usb_init_type init)167da76512SInderpal Singh int board_usb_init(int index, enum usb_init_type init)
177da76512SInderpal Singh {
187da76512SInderpal Singh 	/* Configure gpios for usb 3503 hub:
197da76512SInderpal Singh 	 * disconnect, toggle reset and connect
207da76512SInderpal Singh 	 */
217f196101SSimon Glass 	gpio_request(EXYNOS5_GPIO_D17, "usb_connect");
227f196101SSimon Glass 	gpio_request(EXYNOS5_GPIO_X35, "usb_reset");
23f6ae1ca0SAkshay Saraswat 	gpio_direction_output(EXYNOS5_GPIO_D17, 0);
24f6ae1ca0SAkshay Saraswat 	gpio_direction_output(EXYNOS5_GPIO_X35, 0);
257da76512SInderpal Singh 
26f6ae1ca0SAkshay Saraswat 	gpio_direction_output(EXYNOS5_GPIO_X35, 1);
27f6ae1ca0SAkshay Saraswat 	gpio_direction_output(EXYNOS5_GPIO_D17, 1);
287da76512SInderpal Singh 
297da76512SInderpal Singh 	return 0;
307da76512SInderpal Singh }
317da76512SInderpal Singh #endif
327da76512SInderpal Singh 
board_init(void)33a2ac68fbSChander Kashyap int board_init(void)
34a2ac68fbSChander Kashyap {
35a2ac68fbSChander Kashyap 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
36a2ac68fbSChander Kashyap 	return 0;
37a2ac68fbSChander Kashyap }
38a2ac68fbSChander Kashyap 
dram_init(void)39a2ac68fbSChander Kashyap int dram_init(void)
40a2ac68fbSChander Kashyap {
41a2ac68fbSChander Kashyap 	int i;
42a2ac68fbSChander Kashyap 	u32 addr;
43a2ac68fbSChander Kashyap 
44a2ac68fbSChander Kashyap 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
45a2ac68fbSChander Kashyap 		addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
46a2ac68fbSChander Kashyap 		gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE);
47a2ac68fbSChander Kashyap 	}
48a2ac68fbSChander Kashyap 	return 0;
49a2ac68fbSChander Kashyap }
50a2ac68fbSChander Kashyap 
power_init_board(void)51a2ac68fbSChander Kashyap int power_init_board(void)
52a2ac68fbSChander Kashyap {
53a2ac68fbSChander Kashyap 	set_ps_hold_ctrl();
54a2ac68fbSChander Kashyap 	return 0;
55a2ac68fbSChander Kashyap }
56a2ac68fbSChander Kashyap 
dram_init_banksize(void)5776b00acaSSimon Glass int dram_init_banksize(void)
58a2ac68fbSChander Kashyap {
59a2ac68fbSChander Kashyap 	int i;
60a2ac68fbSChander Kashyap 	u32 addr, size;
61a2ac68fbSChander Kashyap 
62a2ac68fbSChander Kashyap 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
63a2ac68fbSChander Kashyap 		addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
64a2ac68fbSChander Kashyap 		size = get_ram_size((long *)addr, SDRAM_BANK_SIZE);
65a2ac68fbSChander Kashyap 
66a2ac68fbSChander Kashyap 		gd->bd->bi_dram[i].start = addr;
67a2ac68fbSChander Kashyap 		gd->bd->bi_dram[i].size = size;
68a2ac68fbSChander Kashyap 	}
6976b00acaSSimon Glass 
7076b00acaSSimon Glass 	return 0;
71a2ac68fbSChander Kashyap }
72a2ac68fbSChander Kashyap 
734aa2ba3aSMasahiro Yamada #ifdef CONFIG_MMC
board_mmc_init(bd_t * bis)74cc2b1012SInderpal Singh int board_mmc_init(bd_t *bis)
75cc2b1012SInderpal Singh {
76cc2b1012SInderpal Singh 	int ret;
77cc2b1012SInderpal Singh 	/* dwmmc initializattion for available channels */
78cc2b1012SInderpal Singh 	ret = exynos_dwmmc_init(gd->fdt_blob);
79cc2b1012SInderpal Singh 	if (ret)
80cc2b1012SInderpal Singh 		debug("dwmmc init failed\n");
81cc2b1012SInderpal Singh 
82cc2b1012SInderpal Singh 	return ret;
83cc2b1012SInderpal Singh }
84cc2b1012SInderpal Singh #endif
85cc2b1012SInderpal Singh 
board_uart_init(void)86a2ac68fbSChander Kashyap static int board_uart_init(void)
87a2ac68fbSChander Kashyap {
88a2ac68fbSChander Kashyap 	int err = 0, uart_id;
89a2ac68fbSChander Kashyap 
90a2ac68fbSChander Kashyap 	for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) {
91a2ac68fbSChander Kashyap 		err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE);
92a2ac68fbSChander Kashyap 		if (err) {
93a2ac68fbSChander Kashyap 			debug("UART%d not configured\n",
94a2ac68fbSChander Kashyap 			      (uart_id - PERIPH_ID_UART0));
95a2ac68fbSChander Kashyap 			return err;
96a2ac68fbSChander Kashyap 		}
97a2ac68fbSChander Kashyap 	}
98a2ac68fbSChander Kashyap 	return err;
99a2ac68fbSChander Kashyap }
100a2ac68fbSChander Kashyap 
101a2ac68fbSChander Kashyap #ifdef CONFIG_BOARD_EARLY_INIT_F
board_early_init_f(void)102a2ac68fbSChander Kashyap int board_early_init_f(void)
103a2ac68fbSChander Kashyap {
104a2ac68fbSChander Kashyap 	int err;
105a2ac68fbSChander Kashyap 
106a2ac68fbSChander Kashyap 	err = board_uart_init();
107a2ac68fbSChander Kashyap 	if (err) {
108a2ac68fbSChander Kashyap 		debug("UART init failed\n");
109a2ac68fbSChander Kashyap 		return err;
110a2ac68fbSChander Kashyap 	}
111a2ac68fbSChander Kashyap 	return err;
112a2ac68fbSChander Kashyap }
113a2ac68fbSChander Kashyap #endif
114a2ac68fbSChander Kashyap 
115a2ac68fbSChander Kashyap #ifdef CONFIG_DISPLAY_BOARDINFO
checkboard(void)116a2ac68fbSChander Kashyap int checkboard(void)
117a2ac68fbSChander Kashyap {
118a2ac68fbSChander Kashyap 	printf("\nBoard: Arndale\n");
119a2ac68fbSChander Kashyap 
120a2ac68fbSChander Kashyap 	return 0;
121a2ac68fbSChander Kashyap }
122a2ac68fbSChander Kashyap #endif
123fafbc6c0SAndre Przywara 
124fafbc6c0SAndre Przywara #ifdef CONFIG_S5P_PA_SYSRAM
smp_set_core_boot_addr(unsigned long addr,int corenr)125fafbc6c0SAndre Przywara void smp_set_core_boot_addr(unsigned long addr, int corenr)
126fafbc6c0SAndre Przywara {
127fafbc6c0SAndre Przywara 	writel(addr, CONFIG_S5P_PA_SYSRAM);
128fafbc6c0SAndre Przywara 
129fafbc6c0SAndre Przywara 	/* make sure this write is really executed */
130fafbc6c0SAndre Przywara 	__asm__ volatile ("dsb\n");
131fafbc6c0SAndre Przywara }
132fafbc6c0SAndre Przywara #endif
133