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