Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Samsung Electronics |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | 370382c | 2019-11-14 12:57:35 -0700 | [diff] [blame] | 7 | #include <cpu_func.h> |
Simon Glass | 8e16b1e | 2019-12-28 10:45:05 -0700 | [diff] [blame] | 8 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 9 | #include <log.h> |
Inderpal Singh | 3260bc8 | 2014-01-08 09:19:57 +0530 | [diff] [blame] | 10 | #include <usb.h> |
Simon Glass | 37f1162 | 2014-10-20 19:48:37 -0600 | [diff] [blame] | 11 | #include <asm/gpio.h> |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 12 | #include <asm/arch/pinmux.h> |
Inderpal Singh | 04bb737 | 2013-08-21 10:38:57 +0530 | [diff] [blame] | 13 | #include <asm/arch/dwmmc.h> |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 14 | #include <asm/arch/power.h> |
| 15 | |
| 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
Inderpal Singh | 3260bc8 | 2014-01-08 09:19:57 +0530 | [diff] [blame] | 18 | #ifdef CONFIG_USB_EHCI_EXYNOS |
| 19 | int board_usb_init(int index, enum usb_init_type init) |
| 20 | { |
Inderpal Singh | 3260bc8 | 2014-01-08 09:19:57 +0530 | [diff] [blame] | 21 | /* Configure gpios for usb 3503 hub: |
| 22 | * disconnect, toggle reset and connect |
| 23 | */ |
Simon Glass | 4f83d3d | 2014-10-20 19:48:39 -0600 | [diff] [blame] | 24 | gpio_request(EXYNOS5_GPIO_D17, "usb_connect"); |
| 25 | gpio_request(EXYNOS5_GPIO_X35, "usb_reset"); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 26 | gpio_direction_output(EXYNOS5_GPIO_D17, 0); |
| 27 | gpio_direction_output(EXYNOS5_GPIO_X35, 0); |
Inderpal Singh | 3260bc8 | 2014-01-08 09:19:57 +0530 | [diff] [blame] | 28 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 29 | gpio_direction_output(EXYNOS5_GPIO_X35, 1); |
| 30 | gpio_direction_output(EXYNOS5_GPIO_D17, 1); |
Inderpal Singh | 3260bc8 | 2014-01-08 09:19:57 +0530 | [diff] [blame] | 31 | |
| 32 | return 0; |
| 33 | } |
| 34 | #endif |
| 35 | |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 36 | int board_init(void) |
| 37 | { |
| 38 | gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | int dram_init(void) |
| 43 | { |
| 44 | int i; |
| 45 | u32 addr; |
| 46 | |
| 47 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 48 | addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); |
| 49 | gd->ram_size += get_ram_size((long *)addr, SDRAM_BANK_SIZE); |
| 50 | } |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | int power_init_board(void) |
| 55 | { |
| 56 | set_ps_hold_ctrl(); |
| 57 | return 0; |
| 58 | } |
| 59 | |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 60 | int dram_init_banksize(void) |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 61 | { |
| 62 | int i; |
| 63 | u32 addr, size; |
| 64 | |
| 65 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 66 | addr = CONFIG_SYS_SDRAM_BASE + (i * SDRAM_BANK_SIZE); |
| 67 | size = get_ram_size((long *)addr, SDRAM_BANK_SIZE); |
| 68 | |
| 69 | gd->bd->bi_dram[i].start = addr; |
| 70 | gd->bd->bi_dram[i].size = size; |
| 71 | } |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 72 | |
| 73 | return 0; |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 74 | } |
| 75 | |
Chander Kashyap | 0d2f277 | 2013-08-21 10:38:56 +0530 | [diff] [blame] | 76 | static int board_uart_init(void) |
| 77 | { |
| 78 | int err = 0, uart_id; |
| 79 | |
| 80 | for (uart_id = PERIPH_ID_UART0; uart_id <= PERIPH_ID_UART3; uart_id++) { |
| 81 | err = exynos_pinmux_config(uart_id, PINMUX_FLAG_NONE); |
| 82 | if (err) { |
| 83 | debug("UART%d not configured\n", |
| 84 | (uart_id - PERIPH_ID_UART0)); |
| 85 | return err; |
| 86 | } |
| 87 | } |
| 88 | return err; |
| 89 | } |
| 90 | |
| 91 | #ifdef CONFIG_BOARD_EARLY_INIT_F |
| 92 | int board_early_init_f(void) |
| 93 | { |
| 94 | int err; |
| 95 | |
| 96 | err = board_uart_init(); |
| 97 | if (err) { |
| 98 | debug("UART init failed\n"); |
| 99 | return err; |
| 100 | } |
| 101 | return err; |
| 102 | } |
| 103 | #endif |
| 104 | |
| 105 | #ifdef CONFIG_DISPLAY_BOARDINFO |
| 106 | int checkboard(void) |
| 107 | { |
| 108 | printf("\nBoard: Arndale\n"); |
| 109 | |
| 110 | return 0; |
| 111 | } |
| 112 | #endif |
Andre Przywara | 64d4c22 | 2014-08-01 13:35:44 +0200 | [diff] [blame] | 113 | |
| 114 | #ifdef CONFIG_S5P_PA_SYSRAM |
| 115 | void smp_set_core_boot_addr(unsigned long addr, int corenr) |
| 116 | { |
| 117 | writel(addr, CONFIG_S5P_PA_SYSRAM); |
| 118 | |
| 119 | /* make sure this write is really executed */ |
| 120 | __asm__ volatile ("dsb\n"); |
| 121 | } |
| 122 | #endif |