1 /* 2 * Copyright (C) 2011 Samsung Electronics 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <common.h> 8 #include <asm/io.h> 9 #include <asm/arch/cpu.h> 10 #include <asm/arch/gpio.h> 11 #include <asm/arch/mmc.h> 12 #include <asm/arch/periph.h> 13 #include <asm/arch/pinmux.h> 14 15 DECLARE_GLOBAL_DATA_PTR; 16 struct exynos4_gpio_part1 *gpio1; 17 struct exynos4_gpio_part2 *gpio2; 18 19 int board_init(void) 20 { 21 gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE; 22 gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE; 23 24 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); 25 return 0; 26 } 27 28 static int board_uart_init(void) 29 { 30 int err; 31 32 err = exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE); 33 if (err) { 34 debug("UART0 not configured\n"); 35 return err; 36 } 37 38 err = exynos_pinmux_config(PERIPH_ID_UART1, PINMUX_FLAG_NONE); 39 if (err) { 40 debug("UART1 not configured\n"); 41 return err; 42 } 43 44 err = exynos_pinmux_config(PERIPH_ID_UART2, PINMUX_FLAG_NONE); 45 if (err) { 46 debug("UART2 not configured\n"); 47 return err; 48 } 49 50 err = exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE); 51 if (err) { 52 debug("UART3 not configured\n"); 53 return err; 54 } 55 56 return 0; 57 } 58 59 #ifdef CONFIG_BOARD_EARLY_INIT_F 60 int board_early_init_f(void) 61 { 62 int err; 63 err = board_uart_init(); 64 if (err) { 65 debug("UART init failed\n"); 66 return err; 67 } 68 return err; 69 } 70 #endif 71 72 int dram_init(void) 73 { 74 gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) 75 + get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE) 76 + get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE) 77 + get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE); 78 79 return 0; 80 } 81 82 void dram_init_banksize(void) 83 { 84 gd->bd->bi_dram[0].start = PHYS_SDRAM_1; 85 gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, \ 86 PHYS_SDRAM_1_SIZE); 87 gd->bd->bi_dram[1].start = PHYS_SDRAM_2; 88 gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \ 89 PHYS_SDRAM_2_SIZE); 90 gd->bd->bi_dram[2].start = PHYS_SDRAM_3; 91 gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \ 92 PHYS_SDRAM_3_SIZE); 93 gd->bd->bi_dram[3].start = PHYS_SDRAM_4; 94 gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \ 95 PHYS_SDRAM_4_SIZE); 96 } 97 98 #ifdef CONFIG_DISPLAY_BOARDINFO 99 int checkboard(void) 100 { 101 printf("\nBoard: ORIGEN\n"); 102 return 0; 103 } 104 #endif 105 106 #ifdef CONFIG_GENERIC_MMC 107 int board_mmc_init(bd_t *bis) 108 { 109 int i, err; 110 111 /* 112 * MMC2 SD card GPIO: 113 * 114 * GPK2[0] SD_2_CLK(2) 115 * GPK2[1] SD_2_CMD(2) 116 * GPK2[2] SD_2_CDn 117 * GPK2[3:6] SD_2_DATA[0:3](2) 118 */ 119 for (i = 0; i < 7; i++) { 120 /* GPK2[0:6] special function 2 */ 121 s5p_gpio_cfg_pin(&gpio2->k2, i, GPIO_FUNC(0x2)); 122 123 /* GPK2[0:6] drv 4x */ 124 s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X); 125 126 /* GPK2[0:1] pull disable */ 127 if (i == 0 || i == 1) { 128 s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE); 129 continue; 130 } 131 132 /* GPK2[2:6] pull up */ 133 s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP); 134 } 135 136 err = s5p_mmc_init(2, 4); 137 return err; 138 } 139 #endif 140