1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2013 Samsung Electronics 4 */ 5 6 #include <common.h> 7 #include <usb.h> 8 #include <asm/gpio.h> 9 #include <asm/arch/pinmux.h> 10 #include <asm/arch/dwmmc.h> 11 #include <asm/arch/power.h> 12 13 DECLARE_GLOBAL_DATA_PTR; 14 15 #ifdef CONFIG_USB_EHCI_EXYNOS 16 int board_usb_init(int index, enum usb_init_type init) 17 { 18 /* Configure gpios for usb 3503 hub: 19 * disconnect, toggle reset and connect 20 */ 21 gpio_request(EXYNOS5_GPIO_D17, "usb_connect"); 22 gpio_request(EXYNOS5_GPIO_X35, "usb_reset"); 23 gpio_direction_output(EXYNOS5_GPIO_D17, 0); 24 gpio_direction_output(EXYNOS5_GPIO_X35, 0); 25 26 gpio_direction_output(EXYNOS5_GPIO_X35, 1); 27 gpio_direction_output(EXYNOS5_GPIO_D17, 1); 28 29 return 0; 30 } 31 #endif 32 33 int board_init(void) 34 { 35 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); 36 return 0; 37 } 38 39 int dram_init(void) 40 { 41 int i; 42 u32 addr; 43 44 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { 45 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); 46 gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE); 47 } 48 return 0; 49 } 50 51 int power_init_board(void) 52 { 53 set_ps_hold_ctrl(); 54 return 0; 55 } 56 57 int dram_init_banksize(void) 58 { 59 int i; 60 u32 addr, size; 61 62 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { 63 addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); 64 size = get_ram_size((long *)addr, SDRAM_BANK_SIZE); 65 66 gd->bd->bi_dram[i].start = addr; 67 gd->bd->bi_dram[i].size = size; 68 } 69 70 return 0; 71 } 72 73 #ifdef CONFIG_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 124 #ifdef CONFIG_S5P_PA_SYSRAM 125 void smp_set_core_boot_addr(unsigned long addr, int corenr) 126 { 127 writel(addr, CONFIG_S5P_PA_SYSRAM); 128 129 /* make sure this write is really executed */ 130 __asm__ volatile ("dsb\n"); 131 } 132 #endif 133