Skip to content
Snippets Groups Projects
i9100-uboot-2013.04-min.patch 54.4 KiB
Newer Older
onny's avatar
onny committed
diff --git a/board/samsung/galaxys2/Makefile b/board/samsung/galaxys2/Makefile
new file mode 100644
index 000000000..933d75c3a
--- /dev/null
+++ b/board/samsung/galaxys2/Makefile
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2011 Samsung Electronics
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+SOBJS	:= mem_setup.o
+SOBJS	+= lowlevel_init.o
+ifndef CONFIG_SPL_BUILD
+COBJS	+= galaxys2.o
+endif
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+ALL	:=	 $(obj).depend $(LIB)
+
+all:	$(ALL)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/samsung/galaxys2/galaxys2.c b/board/samsung/galaxys2/galaxys2.c
new file mode 100644
index 000000000..2de29aa78
--- /dev/null
+++ b/board/samsung/galaxys2/galaxys2.c
@@ -0,0 +1,378 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <netdev.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/sromc.h>
+#include <usb/s3c_udc.h>
+#include <pmic.h>
+#include <max8997_pmic.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+struct exynos4_gpio_part1 *gpio1;
+struct exynos4_gpio_part2 *gpio2;
+
+static int galaxys2_usb_init(void);
+
+#ifndef CONFIG_VIDEO
+//causes the camera LED to blink shortly
+static void blink_led(unsigned times) {
+	struct pmic *p = get_pmic();
+	if (pmic_probe(p)) {
+		printf("failed to get pmic\n");
+		return;
+	}
+
+	while (times --> 0) {	
+		pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+			MAX8997_LED0_FLASH_MASK, LDO_OFF);
+		
+		pmic_set_output(p, MAX8997_REG_BOOST_CNTL,
+			MAX8997_LED_BOOST_ENABLE_MASK, LDO_OFF);
+
+		pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+			0, 0);
+		
+		pmic_reg_write(p, MAX8997_REG_FLASH1_CUR,
+			(0xff) << MAX8997_LED_FLASH_SHIFT);
+		
+		pmic_set_output(p, MAX8997_REG_BOOST_CNTL,
+			MAX8997_LED_BOOST_ENABLE_MASK, LDO_ON);
+		
+		pmic_set_output(p, MAX8997_REG_LEN_CNTL,
+			MAX8997_LED0_FLASH_MASK, LDO_ON);
+		
+		mdelay(100);
+	}
+}
+#endif
+
+static void max8997_reg_update(struct pmic *p, u32 reg, int val, int mask) {
+	u32 tmp;
+	pmic_reg_read(p, reg, &tmp);
+	tmp &= ~mask;
+	tmp |= (val & mask);
+	pmic_reg_write(p, reg, tmp);
+}
+
+static void microsd_power_enable(void) {
+	struct pmic *p = get_pmic();
+	if (pmic_probe(p)) {
+		printf("failed to get pmic\n");
+		return;
+	}
+	
+	//set 2.8V
+	max8997_reg_update(p, MAX8997_REG_LDO17CTRL, 40, 0x3f);
+	pmic_set_output(p, MAX8997_REG_LDO17CTRL, MAX8997_MASK_LDO, LDO_ON);
+	mdelay(50);
+}
+
+static void max8997_init (void) {
+	struct pmic *p;
+	int i;
+
+	if (pmic_init()) {
+		printf("failed to init pmic\n");
+		return;
+	}
+	
+	p = get_pmic();
+	if (pmic_probe(p)) {
+		printf("failed to get pmic\n");
+		return;
+	}
+	
+	/* For the safety, set max voltage before setting up */
+	for (i = 0; i < 8; i++) {
+		//these regulators are 650..2225mv by 25mv steps
+		max8997_reg_update(p, MAX8997_REG_BUCK1DVS1 + i, 28, 0x3f);
+		max8997_reg_update(p, MAX8997_REG_BUCK2DVS1 + i, 20, 0x3f);
+		max8997_reg_update(p, MAX8997_REG_BUCK5DVS1 + i, 22, 0x3f);
+	}
+	pmic_reg_write(p, MAX8997_REG_BUCKRAMP, 0xf9);
+}
+
+static void init_gpio_keys() {
+	/* Home key */
+	s5p_gpio_cfg_pin(&gpio2->x3, 5, GPIO_INPUT);
+	s5p_gpio_set_pull(&gpio2->x3, 5, GPIO_PULL_NONE);
+	s5p_gpio_set_drv(&gpio2->x3, 5, GPIO_DRV_1X);
+	
+	/* Volume up key */
+	s5p_gpio_cfg_pin(&gpio2->x2, 0, GPIO_INPUT);
+	s5p_gpio_set_pull(&gpio2->x2, 0, GPIO_PULL_NONE);
+	s5p_gpio_set_drv(&gpio2->x2, 0, GPIO_DRV_1X);
+}
+
+int do_get_sgs2_bootmode(cmd_tbl_t *cmdtp, int flag,
+	int argc, char * const argv[])
+{
+	int home = !s5p_gpio_get_value(&gpio2->x3, 5);
+	int volup = !s5p_gpio_get_value(&gpio2->x2, 0);
+	int rc = (home << 1) | volup;
+	setenv("sgs2_bootmode_val", simple_itoa(rc));
+	return 0;
Loading
Loading full blame...