[kernel] generic-2.6/2.6.28: add missing Kconfig option
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1007-gta01-core.patch.patch
1 From 821c65f3420494eadf5260e48b54b9f59e6e865c Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Wed, 16 Jul 2008 14:44:42 +0100
4 Subject: [PATCH] gta01-core.patch
5 This patch adds support for the FIC Neo1973 GTA01 machine type to the ARM port
6 of the Linux kernel.
7
8 Signed-off-by: Harald Welte <laforge@openmoko.org>
9 ---
10 MAINTAINERS | 8 +
11 arch/arm/mach-s3c2410/Kconfig | 8 +
12 arch/arm/mach-s3c2410/Makefile | 10 +
13 arch/arm/mach-s3c2410/mach-gta01.c | 658 ++++++++++++++++++++++++++++++++++
14 arch/arm/plat-s3c24xx/Kconfig | 5 +
15 include/asm-arm/arch-s3c2410/gta01.h | 70 ++++
16 6 files changed, 759 insertions(+), 0 deletions(-)
17 create mode 100644 arch/arm/mach-s3c2410/mach-gta01.c
18 create mode 100644 include/asm-arm/arch-s3c2410/gta01.h
19
20 diff --git a/MAINTAINERS b/MAINTAINERS
21 index 56a2f67..9c1a796 100644
22 --- a/MAINTAINERS
23 +++ b/MAINTAINERS
24 @@ -1664,6 +1664,14 @@ P: Akinobu Mita
25 M: akinobu.mita@gmail.com
26 S: Supported
27
28 +FIC/OPENMOKO NEO1973 GSM PHONE
29 +P: Harald Welte
30 +M: laforge@openmoko.org
31 +L: openmoko-kernel@lists.openmoko.org
32 +W: http://wiki.openmoko.org/wiki/Kernel
33 +W: http://wiki.openmoko.org/wiki/Neo1973
34 +S: Maintained
35 +
36 FRAMEBUFFER LAYER
37 P: Antonino Daplas
38 M: adaplas@gmail.com
39 diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
40 index cd3dc08..7e3a1a2 100644
41 --- a/arch/arm/mach-s3c2410/Kconfig
42 +++ b/arch/arm/mach-s3c2410/Kconfig
43 @@ -117,5 +117,13 @@ config MACH_QT2410
44 help
45 Say Y here if you are using the Armzone QT2410
46
47 +config MACH_NEO1973_GTA01
48 + bool "FIC Neo1973 GSM Phone (GTA01 Hardware)"
49 + select CPU_S3C2410
50 + select MACH_NEO1973
51 + select SENSORS_PCF50606
52 + help
53 + Say Y here if you are using the FIC Neo1973 GSM Phone
54 +
55 endmenu
56
57 diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
58 index cabc13c..b73562f 100644
59 --- a/arch/arm/mach-s3c2410/Makefile
60 +++ b/arch/arm/mach-s3c2410/Makefile
61 @@ -30,3 +30,13 @@ obj-$(CONFIG_BAST_PC104_IRQ) += bast-irq.o
62 obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
63 obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
64 obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
65 +
66 +# Common bits of machine support
67 +
68 +obj-$(CONFIG_SIMTEC_NOR) += nor-simtec.o
69 +
70 +# machine additions
71 +
72 +obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
73 +obj-$(CONFIG_MACH_NEO1973_GTA01)+= mach-gta01.o
74 +
75 diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
76 new file mode 100644
77 index 0000000..e690ed7
78 --- /dev/null
79 +++ b/arch/arm/mach-s3c2410/mach-gta01.c
80 @@ -0,0 +1,658 @@
81 +/*
82 + * linux/arch/arm/mach-s3c2410/mach-gta01.c
83 + *
84 + * S3C2410 Machine Support for the FIC Neo1973 GTA01
85 + *
86 + * Copyright (C) 2006-2007 by OpenMoko, Inc.
87 + * Author: Harald Welte <laforge@openmoko.org>
88 + * All rights reserved.
89 + *
90 + * This program is free software; you can redistribute it and/or
91 + * modify it under the terms of the GNU General Public License as
92 + * published by the Free Software Foundation; either version 2 of
93 + * the License, or (at your option) any later version.
94 + *
95 + * This program is distributed in the hope that it will be useful,
96 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
97 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 + * GNU General Public License for more details.
99 + *
100 + * You should have received a copy of the GNU General Public License
101 + * along with this program; if not, write to the Free Software
102 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
103 + * MA 02111-1307 USA
104 + *
105 + */
106 +
107 +#include <linux/kernel.h>
108 +#include <linux/types.h>
109 +#include <linux/interrupt.h>
110 +#include <linux/list.h>
111 +#include <linux/timer.h>
112 +#include <linux/init.h>
113 +#include <linux/workqueue.h>
114 +#include <linux/platform_device.h>
115 +#include <linux/serial_core.h>
116 +#include <linux/spi/spi.h>
117 +#include <linux/spi/spi_bitbang.h>
118 +#include <linux/mmc/mmc.h>
119 +#include <linux/mmc/host.h>
120 +
121 +#include <linux/mtd/mtd.h>
122 +#include <linux/mtd/nand.h>
123 +#include <linux/mtd/nand_ecc.h>
124 +#include <linux/mtd/partitions.h>
125 +
126 +#include <linux/mmc/host.h>
127 +
128 +#include <linux/pcf50606.h>
129 +
130 +#include <asm/mach/arch.h>
131 +#include <asm/mach/map.h>
132 +#include <asm/mach/irq.h>
133 +
134 +#include <asm/hardware.h>
135 +#include <asm/io.h>
136 +#include <asm/irq.h>
137 +#include <asm/mach-types.h>
138 +
139 +#include <asm/arch/regs-gpio.h>
140 +#include <asm/arch/fb.h>
141 +#include <asm/arch/spi.h>
142 +#include <asm/arch/spi-gpio.h>
143 +#include <asm/arch/usb-control.h>
144 +
145 +#include <asm/arch/gta01.h>
146 +
147 +#include <asm/plat-s3c/regs-serial.h>
148 +#include <asm/plat-s3c/nand.h>
149 +#include <asm/plat-s3c24xx/devs.h>
150 +#include <asm/plat-s3c24xx/cpu.h>
151 +#include <asm/plat-s3c24xx/pm.h>
152 +#include <asm/plat-s3c24xx/udc.h>
153 +
154 +static struct map_desc gta01_iodesc[] __initdata = {
155 + {
156 + .virtual = 0xe0000000,
157 + .pfn = __phys_to_pfn(S3C2410_CS3+0x01000000),
158 + .length = SZ_1M,
159 + .type = MT_DEVICE
160 + },
161 +};
162 +
163 +#define UCON S3C2410_UCON_DEFAULT
164 +#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
165 +#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
166 +
167 +static struct s3c2410_uartcfg gta01_uartcfgs[] = {
168 + [0] = {
169 + .hwport = 0,
170 + .flags = 0,
171 + .ucon = UCON,
172 + .ulcon = ULCON,
173 + .ufcon = UFCON,
174 + },
175 + [1] = {
176 + .hwport = 1,
177 + .flags = 0,
178 + .ucon = UCON,
179 + .ulcon = ULCON,
180 + .ufcon = UFCON,
181 + },
182 +};
183 +
184 +/* PMU driver info */
185 +
186 +static int pmu_callback(struct device *dev, unsigned int feature,
187 + enum pmu_event event)
188 +{
189 + switch (feature) {
190 + case PCF50606_FEAT_ACD:
191 + switch (event) {
192 + case PMU_EVT_INSERT:
193 + pcf50606_charge_fast(pcf50606_global, 1);
194 + break;
195 + case PMU_EVT_REMOVE:
196 + pcf50606_charge_fast(pcf50606_global, 0);
197 + break;
198 + default:
199 + break;
200 + }
201 + break;
202 + default:
203 + break;
204 + }
205 +
206 + return 0;
207 +}
208 +
209 +static struct pcf50606_platform_data gta01_pcf_pdata = {
210 + .used_features = PCF50606_FEAT_EXTON |
211 + PCF50606_FEAT_MBC |
212 + PCF50606_FEAT_BBC |
213 + PCF50606_FEAT_RTC |
214 + PCF50606_FEAT_WDT |
215 + PCF50606_FEAT_CHGCUR |
216 + PCF50606_FEAT_BATVOLT |
217 + PCF50606_FEAT_BATTEMP,
218 + .onkey_seconds_required = 3,
219 + .cb = &pmu_callback,
220 + .r_fix_batt = 10000,
221 + .r_fix_batt_par = 10000,
222 + .r_sense_milli = 220,
223 + .rails = {
224 + [PCF50606_REGULATOR_D1REG] = {
225 + .name = "bt_3v15",
226 + .voltage = {
227 + .init = 3150,
228 + .max = 3150,
229 + },
230 + },
231 + [PCF50606_REGULATOR_D2REG] = {
232 + .name = "gl_2v5",
233 + .voltage = {
234 + .init = 2500,
235 + .max = 2500,
236 + },
237 + },
238 + [PCF50606_REGULATOR_D3REG] = {
239 + .name = "stby_1v8",
240 + .flags = PMU_VRAIL_F_SUSPEND_ON,
241 + .voltage = {
242 + .init = 1800,
243 + .max = 2100,
244 + },
245 + },
246 + [PCF50606_REGULATOR_DCD] = {
247 + .name = "gl_1v5",
248 + .voltage = {
249 + .init = 1500,
250 + .max = 1500,
251 + },
252 + },
253 + [PCF50606_REGULATOR_DCDE] = {
254 + .name = "io_3v3",
255 + .flags = PMU_VRAIL_F_SUSPEND_ON,
256 + .voltage = {
257 + .init = 3300,
258 + .max = 3330,
259 + },
260 + },
261 + [PCF50606_REGULATOR_DCUD] = {
262 + .name = "core_1v8",
263 + .flags = PMU_VRAIL_F_SUSPEND_ON,
264 + .voltage = {
265 + .init = 2100,
266 + .max = 2100,
267 + },
268 + },
269 + [PCF50606_REGULATOR_IOREG] = {
270 + .name = "codec_3v3",
271 + .voltage = {
272 + .init = 3300,
273 + .max = 3300,
274 + },
275 + },
276 + [PCF50606_REGULATOR_LPREG] = {
277 + .name = "lcm_3v3",
278 + .voltage = {
279 + .init = 3300,
280 + .max = 3300,
281 + },
282 + }
283 + },
284 +};
285 +
286 +static void cfg_pmu_vrail(struct pmu_voltage_rail *vrail, char *name,
287 + unsigned int flags, unsigned int init,
288 + unsigned int max)
289 +{
290 + vrail->name = name;
291 + vrail->flags = flags;
292 + vrail->voltage.init = init;
293 + vrail->voltage.max = max;
294 +}
295 +
296 +static void mangle_pmu_pdata_by_system_rev(void)
297 +{
298 + switch (system_rev) {
299 + case GTA01Bv4_SYSTEM_REV:
300 + gta01_pcf_pdata.used_features |= PCF50606_FEAT_ACD;
301 + break;
302 + case GTA01Bv3_SYSTEM_REV:
303 + case GTA01Bv2_SYSTEM_REV:
304 + gta01_pcf_pdata.rails[PCF50606_REGULATOR_D3REG]
305 + .name = "user1";
306 + gta01_pcf_pdata.rails[PCF50606_REGULATOR_D3REG]
307 + .flags &= ~PMU_VRAIL_F_SUSPEND_ON;
308 + gta01_pcf_pdata.rails[PCF50606_REGULATOR_D3REG]
309 + .flags = PMU_VRAIL_F_UNUSED;
310 + break;
311 + case GTA01v4_SYSTEM_REV:
312 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_DCUD],
313 + "core_1v8", PMU_VRAIL_F_SUSPEND_ON, 1800, 1800);
314 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_D1REG],
315 + "vrf_3v", 0, 3000, 3000);
316 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_D3REG],
317 + "vtcxo_2v8", 0, 2800, 2800);
318 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_DCD],
319 + "gl_3v5", 0, 3500, 3500);
320 + break;
321 + case GTA01v3_SYSTEM_REV:
322 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_D1REG],
323 + "vrf_3v", 0, 3000, 3000);
324 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_D2REG],
325 + "sd_3v3", 0, 3300, 3300);
326 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_D3REG],
327 + "codec_3v3", 0, 3300, 3300);
328 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_DCD],
329 + "gpsio_3v3", 0, 3300, 3300);
330 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_DCUD],
331 + "core_1v8", PMU_VRAIL_F_SUSPEND_ON, 1800, 1800);
332 + cfg_pmu_vrail(&gta01_pcf_pdata.rails[PCF50606_REGULATOR_IOREG],
333 + "vtcxo_2v8", 0, 2800, 2800);
334 + break;
335 + }
336 +}
337 +
338 +static struct resource gta01_pmu_resources[] = {
339 + [0] = {
340 + .flags = IORESOURCE_IRQ,
341 + .start = GTA01_IRQ_PCF50606,
342 + .end = GTA01_IRQ_PCF50606,
343 + },
344 +};
345 +
346 +struct platform_device gta01_pmu_dev = {
347 + .name = "pcf50606",
348 + .num_resources = ARRAY_SIZE(gta01_pmu_resources),
349 + .resource = gta01_pmu_resources,
350 + .dev = {
351 + .platform_data = &gta01_pcf_pdata,
352 + },
353 +};
354 +
355 +/* LCD driver info */
356 +
357 +/* Configuration for 480x640 toppoly TD028TTEC1.
358 + * Do not mark this as __initdata or it will break! */
359 +static struct s3c2410fb_display gta01_displays[] = {
360 + {
361 + .type = S3C2410_LCDCON1_TFT,
362 + .width = 43,
363 + .height = 58,
364 + .xres = 480,
365 + .yres = 640,
366 + .bpp = 16,
367 +
368 + .pixclock = 40000, /* HCLK/4 */
369 + .left_margin = 104,
370 + .right_margin = 8,
371 + .hsync_len = 8,
372 + .upper_margin = 2,
373 + .lower_margin = 16,
374 + .vsync_len = 2,
375 + .lcdcon5 = S3C2410_LCDCON5_FRM565 |
376 + S3C2410_LCDCON5_INVVCLK |
377 + S3C2410_LCDCON5_INVVLINE |
378 + S3C2410_LCDCON5_INVVFRAME |
379 + S3C2410_LCDCON5_PWREN |
380 + S3C2410_LCDCON5_HWSWP,
381 + },
382 + {
383 + .type = S3C2410_LCDCON1_TFT,
384 + .width = 43,
385 + .height = 58,
386 + .xres = 480,
387 + .yres = 640,
388 + .bpp = 32,
389 +
390 + .pixclock = 40000, /* HCLK/4 */
391 + .left_margin = 104,
392 + .right_margin = 8,
393 + .hsync_len = 8,
394 + .upper_margin = 2,
395 + .lower_margin = 16,
396 + .vsync_len = 2,
397 + .lcdcon5 = S3C2410_LCDCON5_FRM565 |
398 + S3C2410_LCDCON5_INVVCLK |
399 + S3C2410_LCDCON5_INVVLINE |
400 + S3C2410_LCDCON5_INVVFRAME |
401 + S3C2410_LCDCON5_PWREN |
402 + S3C2410_LCDCON5_HWSWP,
403 + },
404 + {
405 + .type = S3C2410_LCDCON1_TFT,
406 + .width = 43,
407 + .height = 58,
408 + .xres = 240,
409 + .yres = 320,
410 + .bpp = 16,
411 +
412 + .pixclock = 40000, /* HCLK/4 */
413 + .left_margin = 104,
414 + .right_margin = 8,
415 + .hsync_len = 8,
416 + .upper_margin = 2,
417 + .lower_margin = 16,
418 + .vsync_len = 2,
419 + .lcdcon5 = S3C2410_LCDCON5_FRM565 |
420 + S3C2410_LCDCON5_INVVCLK |
421 + S3C2410_LCDCON5_INVVLINE |
422 + S3C2410_LCDCON5_INVVFRAME |
423 + S3C2410_LCDCON5_PWREN |
424 + S3C2410_LCDCON5_HWSWP,
425 + },
426 +};
427 +
428 +static struct s3c2410fb_mach_info gta01_lcd_cfg __initdata = {
429 + .displays = gta01_displays,
430 + .num_displays = ARRAY_SIZE(gta01_displays),
431 + .default_display = 0,
432 +
433 + .lpcsel = ((0xCE6) & ~7) | 1<<4,
434 +};
435 +
436 +static struct platform_device *gta01_devices[] __initdata = {
437 + &s3c_device_usb,
438 + &s3c_device_lcd,
439 + &s3c_device_wdt,
440 + &s3c_device_i2c,
441 + &s3c_device_iis,
442 + &s3c_device_sdi,
443 + &s3c_device_usbgadget,
444 + &s3c_device_nand,
445 +};
446 +
447 +static struct s3c2410_nand_set gta01_nand_sets[] = {
448 + [0] = {
449 + .name = "neo1973-nand",
450 + .nr_chips = 1,
451 + .flags = S3C2410_NAND_BBT,
452 + },
453 +};
454 +
455 +static struct s3c2410_platform_nand gta01_nand_info = {
456 + .tacls = 20,
457 + .twrph0 = 60,
458 + .twrph1 = 20,
459 + .nr_sets = ARRAY_SIZE(gta01_nand_sets),
460 + .sets = gta01_nand_sets,
461 +};
462 +
463 +static void gta01_udc_command(enum s3c2410_udc_cmd_e cmd)
464 +{
465 + printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
466 +
467 + switch (cmd) {
468 + case S3C2410_UDC_P_ENABLE:
469 + s3c2410_gpio_setpin(GTA01_GPIO_USB_PULLUP, 1);
470 + break;
471 + case S3C2410_UDC_P_DISABLE:
472 + s3c2410_gpio_setpin(GTA01_GPIO_USB_PULLUP, 0);
473 + break;
474 + default:
475 + break;
476 + }
477 +}
478 +
479 +/* use a work queue, since I2C API inherently schedules
480 + * and we get called in hardirq context from UDC driver */
481 +
482 +struct vbus_draw {
483 + struct work_struct work;
484 + int ma;
485 +};
486 +static struct vbus_draw gta01_udc_vbus_drawer;
487 +
488 +static void __gta01_udc_vbus_draw(struct work_struct *work)
489 +{
490 + /* this is a fix to work around boot-time ordering problems if the
491 + * s3c2410_udc is initialized before the pcf50606 driver has defined
492 + * pcf50606_global */
493 + if (!pcf50606_global)
494 + return;
495 +
496 + if (gta01_udc_vbus_drawer.ma >= 500) {
497 + /* enable fast charge */
498 + printk(KERN_DEBUG "udc: enabling fast charge\n");
499 + pcf50606_charge_fast(pcf50606_global, 1);
500 + } else {
501 + /* disable fast charge */
502 + printk(KERN_DEBUG "udc: disabling fast charge\n");
503 + pcf50606_charge_fast(pcf50606_global, 0);
504 + }
505 +}
506 +
507 +static void gta01_udc_vbus_draw(unsigned int ma)
508 +{
509 + gta01_udc_vbus_drawer.ma = ma;
510 + schedule_work(&gta01_udc_vbus_drawer.work);
511 +}
512 +
513 +static struct s3c2410_udc_mach_info gta01_udc_cfg = {
514 + .vbus_draw = gta01_udc_vbus_draw,
515 +};
516 +
517 +/* SPI */
518 +
519 +static struct spi_board_info gta01_spi_board_info[] = {
520 + {
521 + .modalias = "jbt6k74",
522 + /* platform_data */
523 + /* controller_data */
524 + /* irq */
525 + .max_speed_hz = 10 * 1000 * 1000,
526 + .bus_num = 1,
527 + /* chip_select */
528 + },
529 +};
530 +
531 +static void spi_gpio_cs(struct s3c2410_spigpio_info *spi, int cs)
532 +{
533 + switch (cs) {
534 + case BITBANG_CS_ACTIVE:
535 + s3c2410_gpio_setpin(S3C2410_GPG3, 0);
536 + break;
537 + case BITBANG_CS_INACTIVE:
538 + s3c2410_gpio_setpin(S3C2410_GPG3, 1);
539 + break;
540 + }
541 +}
542 +
543 +static struct s3c2410_spigpio_info spi_gpio_cfg = {
544 + .pin_clk = S3C2410_GPG7,
545 + .pin_mosi = S3C2410_GPG6,
546 + .pin_miso = S3C2410_GPG5,
547 + .board_size = ARRAY_SIZE(gta01_spi_board_info),
548 + .board_info = gta01_spi_board_info,
549 + .chip_select = &spi_gpio_cs,
550 +};
551 +
552 +static struct resource s3c_spi_lcm_resource[] = {
553 + [0] = {
554 + .start = S3C2410_GPG3,
555 + .end = S3C2410_GPG3,
556 + },
557 + [1] = {
558 + .start = S3C2410_GPG5,
559 + .end = S3C2410_GPG5,
560 + },
561 + [2] = {
562 + .start = S3C2410_GPG6,
563 + .end = S3C2410_GPG6,
564 + },
565 + [3] = {
566 + .start = S3C2410_GPG7,
567 + .end = S3C2410_GPG7,
568 + },
569 +};
570 +
571 +struct platform_device s3c_device_spi_lcm = {
572 + .name = "s3c24xx-spi-gpio",
573 + .id = 1,
574 + .num_resources = ARRAY_SIZE(s3c_spi_lcm_resource),
575 + .resource = s3c_spi_lcm_resource,
576 + .dev = {
577 + .platform_data = &spi_gpio_cfg,
578 + },
579 +};
580 +
581 +static struct gta01bl_machinfo backlight_machinfo = {
582 + .default_intensity = 1,
583 + .max_intensity = 1,
584 + .limit_mask = 1,
585 +};
586 +
587 +static struct resource gta01_bl_resources[] = {
588 + [0] = {
589 + .start = GTA01_GPIO_BACKLIGHT,
590 + .end = GTA01_GPIO_BACKLIGHT,
591 + },
592 +};
593 +
594 +struct platform_device gta01_bl_dev = {
595 + .name = "gta01-bl",
596 + .num_resources = ARRAY_SIZE(gta01_bl_resources),
597 + .resource = gta01_bl_resources,
598 + .dev = {
599 + .platform_data = &backlight_machinfo,
600 + },
601 +};
602 +
603 +static struct resource gta01_led_resources[] = {
604 + [0] = {
605 + .start = GTA01_GPIO_VIBRATOR_ON,
606 + .end = GTA01_GPIO_VIBRATOR_ON,
607 + },
608 +};
609 +
610 +struct platform_device gta01_led_dev = {
611 + .name = "neo1973-vibrator",
612 + .num_resources = ARRAY_SIZE(gta01_led_resources),
613 + .resource = gta01_led_resources,
614 +};
615 +
616 +static struct resource gta01_button_resources[] = {
617 + [0] = {
618 + .start = GTA01_GPIO_AUX_KEY,
619 + .end = GTA01_GPIO_AUX_KEY,
620 + },
621 + [1] = {
622 + .start = GTA01_GPIO_HOLD_KEY,
623 + .end = GTA01_GPIO_HOLD_KEY,
624 + },
625 + [2] = {
626 + .start = GTA01_GPIO_JACK_INSERT,
627 + .end = GTA01_GPIO_JACK_INSERT,
628 + },
629 +};
630 +
631 +struct platform_device gta01_button_dev = {
632 + .name = "neo1973-button",
633 + .num_resources = ARRAY_SIZE(gta01_button_resources),
634 + .resource = gta01_button_resources,
635 +};
636 +
637 +static struct platform_device gta01_pm_gsm_dev = {
638 + .name = "neo1973-pm-gsm",
639 +};
640 +
641 +/* USB */
642 +static struct s3c2410_hcd_info gta01_usb_info = {
643 + .port[0] = {
644 + .flags = S3C_HCDFLG_USED,
645 + },
646 + .port[1] = {
647 + .flags = 0,
648 + },
649 +};
650 +
651 +static void __init gta01_map_io(void)
652 +{
653 + s3c24xx_init_io(gta01_iodesc, ARRAY_SIZE(gta01_iodesc));
654 + s3c24xx_init_clocks(12*1000*1000);
655 + s3c24xx_init_uarts(gta01_uartcfgs, ARRAY_SIZE(gta01_uartcfgs));
656 +}
657 +
658 +static irqreturn_t gta01_modem_irq(int irq, void *param)
659 +{
660 + printk(KERN_DEBUG "modem wakeup interrupt\n");
661 + return IRQ_HANDLED;
662 +}
663 +
664 +static void __init gta01_machine_init(void)
665 +{
666 + int rc;
667 +
668 + if (system_rev == GTA01v4_SYSTEM_REV ||
669 + system_rev == GTA01Bv2_SYSTEM_REV ||
670 + system_rev == GTA01Bv3_SYSTEM_REV ||
671 + system_rev == GTA01Bv4_SYSTEM_REV) {
672 + gta01_udc_cfg.udc_command = gta01_udc_command;
673 + }
674 +
675 + s3c_device_usb.dev.platform_data = &gta01_usb_info;
676 + s3c_device_nand.dev.platform_data = &gta01_nand_info;
677 +
678 + s3c24xx_fb_set_platdata(&gta01_lcd_cfg);
679 +
680 + INIT_WORK(&gta01_udc_vbus_drawer.work, __gta01_udc_vbus_draw);
681 + s3c24xx_udc_set_platdata(&gta01_udc_cfg);
682 +
683 + /* Set LCD_RESET / XRES to high */
684 + s3c2410_gpio_cfgpin(S3C2410_GPC6, S3C2410_GPIO_OUTPUT);
685 + s3c2410_gpio_setpin(S3C2410_GPC6, 1);
686 +
687 + /* SPI chip select is gpio output */
688 + s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPIO_OUTPUT);
689 + s3c2410_gpio_setpin(S3C2410_GPG3, 1);
690 + platform_device_register(&s3c_device_spi_lcm);
691 +
692 + platform_device_register(&gta01_bl_dev);
693 + platform_device_register(&gta01_button_dev);
694 + platform_device_register(&gta01_pm_gsm_dev);
695 +
696 + switch (system_rev) {
697 + case GTA01v3_SYSTEM_REV:
698 + case GTA01v4_SYSTEM_REV:
699 + /* just use the default (GTA01_IRQ_PCF50606) */
700 + break;
701 + case GTA01Bv2_SYSTEM_REV:
702 + case GTA01Bv3_SYSTEM_REV:
703 + /* just use the default (GTA01_IRQ_PCF50606) */
704 + gta01_led_resources[0].start =
705 + gta01_led_resources[0].end = GTA01Bv2_GPIO_VIBRATOR_ON;
706 + break;
707 + case GTA01Bv4_SYSTEM_REV:
708 + gta01_pmu_resources[0].start =
709 + gta01_pmu_resources[0].end = GTA01Bv4_IRQ_PCF50606;
710 + gta01_led_resources[0].start =
711 + gta01_led_resources[0].end = GTA01Bv4_GPIO_VIBRATOR_ON;
712 + break;
713 + }
714 + mangle_pmu_pdata_by_system_rev();
715 + platform_device_register(&gta01_pmu_dev);
716 + platform_device_register(&gta01_led_dev);
717 +
718 + platform_add_devices(gta01_devices, ARRAY_SIZE(gta01_devices));
719 +
720 + s3c2410_pm_init();
721 +
722 + set_irq_type(GTA01_IRQ_MODEM, IRQT_RISING);
723 + rc = request_irq(GTA01_IRQ_MODEM, gta01_modem_irq, IRQF_DISABLED,
724 + "modem", NULL);
725 + if (!rc)
726 + printk(KERN_ERR "GTA01: can't request GSM modem wakeup IRQ\n");
727 + enable_irq_wake(GTA01_IRQ_MODEM);
728 +}
729 +
730 +MACHINE_START(NEO1973_GTA01, "GTA01")
731 + .phys_io = S3C2410_PA_UART,
732 + .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
733 + .boot_params = S3C2410_SDRAM_PA + 0x100,
734 + .map_io = gta01_map_io,
735 + .init_irq = s3c24xx_init_irq,
736 + .init_machine = gta01_machine_init,
737 + .timer = &s3c24xx_timer,
738 +MACHINE_END
739 diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
740 index b66fb3c..7ee4b82 100644
741 --- a/arch/arm/plat-s3c24xx/Kconfig
742 +++ b/arch/arm/plat-s3c24xx/Kconfig
743 @@ -46,4 +46,9 @@ config MACH_SMDK
744 help
745 Common machine code for SMDK2410 and SMDK2440
746
747 +config MACH_NEO1973
748 + bool
749 + help
750 + Common machine code for Neo1973 hardware
751 +
752 endif
753 diff --git a/include/asm-arm/arch-s3c2410/gta01.h b/include/asm-arm/arch-s3c2410/gta01.h
754 new file mode 100644
755 index 0000000..1cc2099
756 --- /dev/null
757 +++ b/include/asm-arm/arch-s3c2410/gta01.h
758 @@ -0,0 +1,70 @@
759 +#ifndef _GTA01_H
760 +#define _GTA01_H
761 +
762 +#include <asm/arch/regs-gpio.h>
763 +#include <asm/arch/irqs.h>
764 +
765 +/* Different hardware revisions, passed in ATAG_REVISION by u-boot */
766 +#define GTA01v3_SYSTEM_REV 0x00000130
767 +#define GTA01v4_SYSTEM_REV 0x00000140
768 +#define GTA01Bv2_SYSTEM_REV 0x00000220
769 +#define GTA01Bv3_SYSTEM_REV 0x00000230
770 +#define GTA01Bv4_SYSTEM_REV 0x00000240
771 +
772 +/* Backlight */
773 +struct gta01bl_machinfo {
774 + unsigned int default_intensity;
775 + unsigned int max_intensity;
776 + unsigned int limit_mask;
777 +};
778 +
779 +/* Definitions common to all revisions */
780 +#define GTA01_GPIO_BACKLIGHT S3C2410_GPB0
781 +#define GTA01_GPIO_GPS_PWRON S3C2410_GPB1
782 +#define GTA01_GPIO_MODEM_RST S3C2410_GPB6
783 +#define GTA01_GPIO_MODEM_ON S3C2410_GPB7
784 +#define GTA01_GPIO_LCD_RESET S3C2410_GPC6
785 +#define GTA01_GPIO_PMU_IRQ S3C2410_GPG8
786 +#define GTA01_GPIO_JACK_INSERT S3C2410_GPF4
787 +#define GTA01_GPIO_nSD_DETECT S3C2410_GPF5
788 +#define GTA01_GPIO_AUX_KEY S3C2410_GPF6
789 +#define GTA01_GPIO_HOLD_KEY S3C2410_GPF7
790 +#define GTA01_GPIO_VIBRATOR_ON S3C2410_GPG11
791 +
792 +#define GTA01_IRQ_MODEM IRQ_EINT1
793 +#define GTA01_IRQ_JACK_INSERT IRQ_EINT4
794 +#define GTA01_IRQ_nSD_DETECT IRQ_EINT5
795 +#define GTA01_IRQ_AUX_KEY IRQ_EINT6
796 +#define GTA01_IRQ_PCF50606 IRQ_EINT16
797 +
798 +/* GTA01v3 */
799 +#define GTA01v3_GPIO_nGSM_EN S3C2410_GPG9
800 +
801 +/* GTA01v4 */
802 +#define GTA01_GPIO_MODEM_DNLOAD S3C2410_GPG0
803 +
804 +/* GTA01Bv2 */
805 +#define GTA01Bv2_GPIO_nGSM_EN S3C2410_GPF2
806 +#define GTA01Bv2_GPIO_VIBRATOR_ON S3C2410_GPB10
807 +
808 +/* GTA01Bv3 */
809 +#define GTA01_GPIO_GPS_EN_3V3 S3C2410_GPG9
810 +
811 +#define GTA01_GPIO_SDMMC_ON S3C2410_GPB2
812 +#define GTA01_GPIO_BT_EN S3C2410_GPB5
813 +#define GTA01_GPIO_AB_DETECT S3C2410_GPB8
814 +#define GTA01_GPIO_USB_PULLUP S3C2410_GPB9
815 +#define GTA01_GPIO_USB_ATTACH S3C2410_GPB10
816 +
817 +#define GTA01_GPIO_GPS_EN_2V8 S3C2410_GPG9
818 +#define GTA01_GPIO_GPS_EN_3V S3C2410_GPG10
819 +#define GTA01_GPIO_GPS_RESET S3C2410_GPC0
820 +
821 +/* GTA01Bv4 */
822 +#define GTA01Bv4_GPIO_nNAND_WP S3C2410_GPA16
823 +#define GTA01Bv4_GPIO_VIBRATOR_ON S3C2410_GPB3
824 +#define GTA01Bv4_GPIO_PMU_IRQ S3C2410_GPG1
825 +
826 +#define GTA01Bv4_IRQ_PCF50606 IRQ_EINT9
827 +
828 +#endif /* _GTA01_H */
829 --
830 1.5.6.3
831
This page took 0.075449 seconds and 5 git commands to generate.