Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
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...