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