xref: /openbmc/u-boot/board/samsung/arndale/arndale.c (revision e183a174)
1 /*
2  * Copyright (C) 2013 Samsung Electronics
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <usb.h>
9 #include <asm/arch/pinmux.h>
10 #include <asm/arch/dwmmc.h>
11 #include <asm/arch/gpio.h>
12 #include <asm/arch/power.h>
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
16 #ifdef CONFIG_USB_EHCI_EXYNOS
17 int board_usb_init(int index, enum usb_init_type init)
18 {
19 	struct exynos5_gpio_part1 *gpio = (struct exynos5_gpio_part1 *)
20 						samsung_get_base_gpio_part1();
21 
22 	/* Configure gpios for usb 3503 hub:
23 	 * disconnect, toggle reset and connect
24 	 */
25 	s5p_gpio_direction_output(&gpio->d1, 7, 0);
26 	s5p_gpio_direction_output(&gpio->x3, 5, 0);
27 
28 	s5p_gpio_direction_output(&gpio->x3, 5, 1);
29 	s5p_gpio_direction_output(&gpio->d1, 7, 1);
30 
31 	return 0;
32 }
33 #endif
34 
35 int board_init(void)
36 {
37 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
38 	return 0;
39 }
40 
41 int dram_init(void)
42 {
43 	int i;
44 	u32 addr;
45 
46 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
47 		addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
48 		gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE);
49 	}
50 	return 0;
51 }
52 
53 int power_init_board(void)
54 {
55 	set_ps_hold_ctrl();
56 	return 0;
57 }
58 
59 void dram_init_banksize(void)
60 {
61 	int i;
62 	u32 addr, size;
63 
64 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
65 		addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE);
66 		size = get_ram_size((long *)addr, SDRAM_BANK_SIZE);
67 
68 		gd->bd->bi_dram[i].start = addr;
69 		gd->bd->bi_dram[i].size = size;
70 	}
71 }
72 
73 #ifdef CONFIG_GENERIC_MMC
74 int board_mmc_init(bd_t *bis)
75 {
76 	int ret;
77 	/* dwmmc initializattion for available channels */
78 	ret = exynos_dwmmc_init(gd->fdt_blob);
79 	if (ret)
80 		debug("dwmmc init failed\n");
81 
82 	return ret;
83 }
84 #endif
85 
86 static int board_uart_init(void)
87 {
88 	int err = 0, uart_id;
89 
90 	for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) {
91 		err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE);
92 		if (err) {
93 			debug("UART%d not configured\n",
94 			      (uart_id - PERIPH_ID_UART0));
95 			return err;
96 		}
97 	}
98 	return err;
99 }
100 
101 #ifdef CONFIG_BOARD_EARLY_INIT_F
102 int board_early_init_f(void)
103 {
104 	int err;
105 
106 	err = board_uart_init();
107 	if (err) {
108 		debug("UART init failed\n");
109 		return err;
110 	}
111 	return err;
112 }
113 #endif
114 
115 #ifdef CONFIG_DISPLAY_BOARDINFO
116 int checkboard(void)
117 {
118 	printf("\nBoard: Arndale\n");
119 
120 	return 0;
121 }
122 #endif
123