xref: /openbmc/u-boot/board/samsung/origen/origen.c (revision 977a39e6)
1 /*
2  * Copyright (C) 2011 Samsung Electronics
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22 
23 #include <common.h>
24 #include <asm/io.h>
25 #include <asm/arch/cpu.h>
26 #include <asm/arch/gpio.h>
27 #include <asm/arch/mmc.h>
28 
29 DECLARE_GLOBAL_DATA_PTR;
30 struct exynos4_gpio_part1 *gpio1;
31 struct exynos4_gpio_part2 *gpio2;
32 
33 int board_init(void)
34 {
35 	gpio1 = (struct exynos4_gpio_part1 *) EXYNOS4_GPIO_PART1_BASE;
36 	gpio2 = (struct exynos4_gpio_part2 *) EXYNOS4_GPIO_PART2_BASE;
37 
38 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
39 	return 0;
40 }
41 
42 int dram_init(void)
43 {
44 	gd->ram_size	= get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
45 			+ get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
46 			+ get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
47 			+ get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
48 
49 	return 0;
50 }
51 
52 void dram_init_banksize(void)
53 {
54 	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
55 	gd->bd->bi_dram[0].size = get_ram_size((long *)PHYS_SDRAM_1, \
56 							PHYS_SDRAM_1_SIZE);
57 	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
58 	gd->bd->bi_dram[1].size = get_ram_size((long *)PHYS_SDRAM_2, \
59 							PHYS_SDRAM_2_SIZE);
60 	gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
61 	gd->bd->bi_dram[2].size = get_ram_size((long *)PHYS_SDRAM_3, \
62 							PHYS_SDRAM_3_SIZE);
63 	gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
64 	gd->bd->bi_dram[3].size = get_ram_size((long *)PHYS_SDRAM_4, \
65 							PHYS_SDRAM_4_SIZE);
66 }
67 
68 #ifdef CONFIG_DISPLAY_BOARDINFO
69 int checkboard(void)
70 {
71 	printf("\nBoard: ORIGEN\n");
72 	return 0;
73 }
74 #endif
75 
76 #ifdef CONFIG_GENERIC_MMC
77 int board_mmc_init(bd_t *bis)
78 {
79 	int i, err;
80 
81 	/*
82 	 * MMC2 SD card GPIO:
83 	 *
84 	 * GPK2[0]	SD_2_CLK(2)
85 	 * GPK2[1]	SD_2_CMD(2)
86 	 * GPK2[2]	SD_2_CDn
87 	 * GPK2[3:6]	SD_2_DATA[0:3](2)
88 	 */
89 	for (i = 0; i < 7; i++) {
90 		/* GPK2[0:6] special function 2 */
91 		s5p_gpio_cfg_pin(&gpio2->k2, i, GPIO_FUNC(0x2));
92 
93 		/* GPK2[0:6] drv 4x */
94 		s5p_gpio_set_drv(&gpio2->k2, i, GPIO_DRV_4X);
95 
96 		/* GPK2[0:1] pull disable */
97 		if (i == 0 || i == 1) {
98 			s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_NONE);
99 			continue;
100 		}
101 
102 		/* GPK2[2:6] pull up */
103 		s5p_gpio_set_pull(&gpio2->k2, i, GPIO_PULL_UP);
104 	}
105 
106 	err = s5p_mmc_init(2, 4);
107 	return err;
108 }
109 #endif
110