2 * Copyright (C) 2008-2009 Samsung Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 * Kyungmin Park <kyungmin.park@samsung.com>
6 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/gpio.h>
11 #include <asm/arch/mmc.h>
12 #include <power/pmic.h>
13 #include <usb/s3c_udc.h>
14 #include <asm/arch/cpu.h>
15 #include <power/max8998_pmic.h>
16 #include <samsung/misc.h>
18 #include <usb_mass_storage.h>
20 DECLARE_GLOBAL_DATA_PTR;
22 u32 get_board_rev(void)
29 /* Set Initial global variables */
30 gd->bd->bi_arch_number = MACH_TYPE_GONI;
31 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
36 int power_init_board(void)
41 * For PMIC the I2C bus is named as I2C5, but it is connected
42 * to logical I2C adapter 0
44 ret = pmic_init(I2C_0);
53 gd->ram_size = PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE +
59 void dram_init_banksize(void)
61 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
62 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
63 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
64 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
65 gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
66 gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
69 #ifdef CONFIG_DISPLAY_BOARDINFO
72 puts("Board:\tGoni\n");
77 #ifdef CONFIG_GENERIC_MMC
78 int board_mmc_init(bd_t *bis)
80 int i, ret, ret_sd = 0;
82 /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
83 gpio_direction_output(S5PC110_GPIO_J27, 1);
89 * GPG0[2] SD_0_CDn -> Not used
90 * GPG0[3:6] SD_0_DATA[0:3]
92 for (i = S5PC110_GPIO_G00; i < S5PC110_GPIO_G07; i++) {
93 if (i == S5PC110_GPIO_G02)
95 /* GPG0[0:6] special function 2 */
97 /* GPG0[0:6] pull disable */
98 gpio_set_pull(i, S5P_GPIO_PULL_NONE);
99 /* GPG0[0:6] drv 4x */
100 gpio_set_drv(i, S5P_GPIO_DRV_4X);
103 ret = s5p_mmc_init(0, 4);
105 error("MMC: Failed to init MMC:0.\n");
108 * SD card (T_FLASH) detect and init
109 * T_FLASH_DETECT: EINT28: GPH3[4] input mode
111 gpio_cfg_pin(S5PC110_GPIO_H34, S5P_GPIO_INPUT);
112 gpio_set_pull(S5PC110_GPIO_H34, S5P_GPIO_PULL_UP);
114 if (!gpio_get_value(S5PC110_GPIO_H34)) {
115 for (i = S5PC110_GPIO_G20; i < S5PC110_GPIO_G27; i++) {
116 if (i == S5PC110_GPIO_G22)
119 /* GPG2[0:6] special function 2 */
120 gpio_cfg_pin(i, 0x2);
121 /* GPG2[0:6] pull disable */
122 gpio_set_pull(i, S5P_GPIO_PULL_NONE);
123 /* GPG2[0:6] drv 4x */
124 gpio_set_drv(i, S5P_GPIO_DRV_4X);
127 ret_sd = s5p_mmc_init(2, 4);
129 error("MMC: Failed to init SD card (MMC:2).\n");
136 #ifdef CONFIG_USB_GADGET
137 static int s5pc1xx_phy_control(int on)
141 struct pmic *p = pmic_get("MAX8998_PMIC");
149 ret = pmic_set_output(p, MAX8998_REG_ONOFF1,
150 MAX8998_LDO3, LDO_ON);
151 ret = pmic_set_output(p, MAX8998_REG_ONOFF2,
152 MAX8998_LDO8, LDO_ON);
154 puts("MAX8998 LDO setting error!\n");
158 } else if (!on && status) {
159 ret = pmic_set_output(p, MAX8998_REG_ONOFF1,
160 MAX8998_LDO3, LDO_OFF);
161 ret = pmic_set_output(p, MAX8998_REG_ONOFF2,
162 MAX8998_LDO8, LDO_OFF);
164 puts("MAX8998 LDO setting error!\n");
174 struct s3c_plat_otg_data s5pc110_otg_data = {
175 .phy_control = s5pc1xx_phy_control,
176 .regs_phy = S5PC110_PHY_BASE,
177 .regs_otg = S5PC110_OTG_BASE,
178 .usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
181 int board_usb_init(int index, enum usb_init_type init)
183 debug("USB_udc_probe\n");
184 return s3c_udc_probe(&s5pc110_otg_data);
188 #ifdef CONFIG_MISC_INIT_R
189 int misc_init_r(void)
191 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG