nuke old 2.6.23 code for brcm47xx
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1028-gta02-core.patch.patch
1 From 330ac25864dd0a71f2d1cd7d58db103ee93f9125 Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Wed, 16 Jul 2008 14:46:52 +0100
4 Subject: [PATCH] gta02-core.patch
5
6 ---
7 arch/arm/mach-s3c2440/Kconfig | 15 +
8 arch/arm/mach-s3c2440/Makefile | 3 +
9 arch/arm/mach-s3c2440/mach-gta02.c | 826 ++++++++++++++++++++++++++++++++++
10 drivers/leds/leds-neo1973-vibrator.c | 2 +-
11 include/asm-arm/arch-s3c2410/gta02.h | 99 ++++
12 sound/soc/s3c24xx/neo1973_wm8753.c | 8 +
13 6 files changed, 952 insertions(+), 1 deletions(-)
14 create mode 100644 arch/arm/mach-s3c2440/mach-gta02.c
15 create mode 100644 include/asm-arm/arch-s3c2410/gta02.h
16
17 diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
18 index f1915bd..6b317d1 100644
19 --- a/arch/arm/mach-s3c2440/Kconfig
20 +++ b/arch/arm/mach-s3c2440/Kconfig
21 @@ -68,5 +68,20 @@ config SMDK2440_CPU2440
22 select CPU_S3C2440
23
24
25 +config MACH_NEO1973_GTA02
26 + bool "FIC Neo1973 GSM Phone (GTA02 Hardware)"
27 + select CPU_S3C2442
28 + select SENSORS_PCF50633
29 + help
30 + Say Y here if you are using the FIC Neo1973 GSM Phone
31 +
32 +config NEO1973_GTA02_2440
33 + bool "Old FIC Neo1973 GTA02 hardware using S3C2440 CPU"
34 + depends on MACH_NEO1973_GTA02
35 + select CPU_S3C2440
36 + help
37 + Say Y here if you are using an early hardware revision
38 + of the FIC/OpenMoko Neo1973 GTA02 GSM Phone.
39 +
40 endmenu
41
42 diff --git a/arch/arm/mach-s3c2440/Makefile b/arch/arm/mach-s3c2440/Makefile
43 index c81ed62..1a4defd 100644
44 --- a/arch/arm/mach-s3c2440/Makefile
45 +++ b/arch/arm/mach-s3c2440/Makefile
46 @@ -21,3 +21,6 @@ obj-$(CONFIG_MACH_OSIRIS) += mach-osiris.o
47 obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
48 obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
49 obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
50 +obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
51 +obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
52 +
53 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
54 new file mode 100644
55 index 0000000..f72a5ae
56 --- /dev/null
57 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
58 @@ -0,0 +1,826 @@
59 +/*
60 + * linux/arch/arm/mach-s3c2440/mach-gta02.c
61 + *
62 + * S3C2440 Machine Support for the FIC GTA02 (Neo1973)
63 + *
64 + * Copyright (C) 2006-2007 by OpenMoko, Inc.
65 + * Author: Harald Welte <laforge@openmoko.org>
66 + * All rights reserved.
67 + *
68 + * This program is free software; you can redistribute it and/or
69 + * modify it under the terms of the GNU General Public License as
70 + * published by the Free Software Foundation; either version 2 of
71 + * the License, or (at your option) any later version.
72 + *
73 + * This program is distributed in the hope that it will be useful,
74 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
75 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76 + * GNU General Public License for more details.
77 + *
78 + * You should have received a copy of the GNU General Public License
79 + * along with this program; if not, write to the Free Software
80 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
81 + * MA 02111-1307 USA
82 + *
83 + */
84 +
85 +#include <linux/kernel.h>
86 +#include <linux/types.h>
87 +#include <linux/interrupt.h>
88 +#include <linux/list.h>
89 +#include <linux/delay.h>
90 +#include <linux/timer.h>
91 +#include <linux/init.h>
92 +#include <linux/workqueue.h>
93 +#include <linux/platform_device.h>
94 +#include <linux/serial_core.h>
95 +#include <linux/spi/spi.h>
96 +#include <linux/spi/glamo.h>
97 +#include <linux/spi/spi_bitbang.h>
98 +#include <linux/mmc/host.h>
99 +
100 +#include <linux/mtd/mtd.h>
101 +#include <linux/mtd/nand.h>
102 +#include <linux/mtd/nand_ecc.h>
103 +#include <linux/mtd/partitions.h>
104 +#include <linux/mtd/physmap.h>
105 +
106 +#include <linux/pcf50633.h>
107 +
108 +#include <asm/mach/arch.h>
109 +#include <asm/mach/map.h>
110 +#include <asm/mach/irq.h>
111 +
112 +#include <asm/hardware.h>
113 +#include <asm/io.h>
114 +#include <asm/irq.h>
115 +#include <asm/mach-types.h>
116 +
117 +#include <asm/arch/regs-gpio.h>
118 +#include <asm/arch/regs-gpioj.h>
119 +#include <asm/arch/fb.h>
120 +#include <asm/arch/mci.h>
121 +#include <asm/arch/ts.h>
122 +#include <asm/arch/spi.h>
123 +#include <asm/arch/spi-gpio.h>
124 +#include <asm/arch/usb-control.h>
125 +
126 +#include <asm/arch/gta01.h>
127 +#include <asm/arch/gta02.h>
128 +
129 +#include <asm/plat-s3c/regs-serial.h>
130 +#include <asm/plat-s3c/nand.h>
131 +#include <asm/plat-s3c24xx/devs.h>
132 +#include <asm/plat-s3c24xx/cpu.h>
133 +#include <asm/plat-s3c24xx/pm.h>
134 +#include <asm/plat-s3c24xx/udc.h>
135 +
136 +#include <linux/glamofb.h>
137 +
138 +static struct map_desc gta02_iodesc[] __initdata = {
139 + {
140 + .virtual = 0xe0000000,
141 + .pfn = __phys_to_pfn(S3C2410_CS3+0x01000000),
142 + .length = SZ_1M,
143 + .type = MT_DEVICE
144 + },
145 +};
146 +
147 +#define UCON S3C2410_UCON_DEFAULT
148 +#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
149 +#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
150 +
151 +static struct s3c2410_uartcfg gta02_uartcfgs[] = {
152 + [0] = {
153 + .hwport = 0,
154 + .flags = 0,
155 + .ucon = UCON,
156 + .ulcon = ULCON,
157 + .ufcon = UFCON,
158 + },
159 + [1] = {
160 + .hwport = 1,
161 + .flags = 0,
162 + .ucon = UCON,
163 + .ulcon = ULCON,
164 + .ufcon = UFCON,
165 + },
166 + [2] = {
167 + .hwport = 2,
168 + .flags = 0,
169 + .ucon = UCON,
170 + .ulcon = ULCON,
171 + .ufcon = UFCON,
172 + },
173 +
174 +};
175 +
176 +/* PMU driver info */
177 +
178 +static int pmu_callback(struct device *dev, unsigned int feature,
179 + enum pmu_event event)
180 +{
181 + switch (feature) {
182 + case PCF50633_FEAT_MBC:
183 + switch (event) {
184 + case PMU_EVT_INSERT:
185 + case PMU_EVT_USB_INSERT:
186 + pcf50633_charge_enable(pcf50633_global, 1);
187 + break;
188 + case PMU_EVT_REMOVE:
189 + case PMU_EVT_USB_REMOVE:
190 + pcf50633_charge_enable(pcf50633_global, 0);
191 + break;
192 + default:
193 + break;
194 + }
195 + break;
196 + default:
197 + break;
198 + }
199 +
200 + return 0;
201 +}
202 +
203 +static struct pcf50633_platform_data gta02_pcf_pdata = {
204 + .used_features = PCF50633_FEAT_MBC |
205 + PCF50633_FEAT_BBC |
206 + PCF50633_FEAT_RTC |
207 + PCF50633_FEAT_CHGCUR |
208 + PCF50633_FEAT_BATVOLT |
209 + PCF50633_FEAT_BATTEMP |
210 + PCF50633_FEAT_PWM_BL,
211 + .onkey_seconds_sig_init = 4,
212 + .onkey_seconds_shutdown = 8,
213 + .cb = &pmu_callback,
214 + .r_fix_batt = 10000,
215 + .r_fix_batt_par = 10000,
216 + .r_sense_milli = 220,
217 + .rails = {
218 + [PCF50633_REGULATOR_AUTO] = {
219 + .name = "io_3v3",
220 + .flags = PMU_VRAIL_F_SUSPEND_ON,
221 + .voltage = {
222 + .init = 3300,
223 + .max = 3300,
224 + },
225 + },
226 + [PCF50633_REGULATOR_DOWN1] = {
227 + .name = "core_1v3",
228 + .voltage = {
229 + .init = 1300,
230 + .max = 1600,
231 + },
232 + },
233 + [PCF50633_REGULATOR_DOWN2] = {
234 + .name = "core_1v8",
235 + .voltage = {
236 + .init = 1800,
237 + .max = 1800,
238 + },
239 + },
240 + [PCF50633_REGULATOR_HCLDO] = {
241 + .name = "sd_3v3",
242 + .voltage = {
243 + .init = 3300,
244 + .max = 3300,
245 + },
246 + },
247 + [PCF50633_REGULATOR_LDO1] = {
248 + .name = "stby_1v3",
249 + .flags = PMU_VRAIL_F_SUSPEND_ON,
250 + .voltage = {
251 + .init = 1300,
252 + .max = 1330,
253 + },
254 + },
255 + [PCF50633_REGULATOR_LDO2] = {
256 + .name = "codec_3v3",
257 + .voltage = {
258 + .init = 3300,
259 + .max = 3300,
260 + },
261 + },
262 + [PCF50633_REGULATOR_LDO3] = {
263 + .name = "lcm_3v",
264 + .voltage = {
265 + .init = 3000,
266 + .max = 3000,
267 + },
268 + },
269 + [PCF50633_REGULATOR_LDO4] = {
270 + .name = "gl_2v5",
271 + .voltage = {
272 + .init = 2500,
273 + .max = 2500,
274 + },
275 + },
276 + [PCF50633_REGULATOR_LDO5] = {
277 + .name = "gl_1v5",
278 + .voltage = {
279 + .init = 1500,
280 + .max = 1500,
281 + },
282 + },
283 + [PCF50633_REGULATOR_LDO6] = {
284 + .name = "user1",
285 + .voltage = {
286 + .init = 0,
287 + .max = 3300,
288 + },
289 + },
290 + },
291 +};
292 +
293 +#if 0 /* currently unused */
294 +static void cfg_pmu_vrail(struct pmu_voltage_rail *vrail, char *name,
295 + unsigned int flags, unsigned int init,
296 + unsigned int max)
297 +{
298 + vrail->name = name;
299 + vrail->flags = flags;
300 + vrail->voltage.init = init;
301 + vrail->voltage.max = max;
302 +}
303 +#endif
304 +
305 +static void mangle_pmu_pdata_by_system_rev(void)
306 +{
307 + switch (system_rev) {
308 + case GTA02v1_SYSTEM_REV:
309 + /* FIXME: this is only in v1 due to wrong PMU variant */
310 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].flags =
311 + PMU_VRAIL_F_SUSPEND_ON;
312 + break;
313 + case GTA02v2_SYSTEM_REV:
314 + case GTA02v3_SYSTEM_REV:
315 + case GTA02v4_SYSTEM_REV:
316 + case GTA02v5_SYSTEM_REV:
317 + case GTA02v6_SYSTEM_REV:
318 + /* we need to keep the 1.8V going since this is the SDRAM
319 + * self-refresh voltage */
320 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].flags =
321 + PMU_VRAIL_F_SUSPEND_ON;
322 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_DOWN2].name =
323 + "io_1v8",
324 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].name =
325 + "gsensor_3v3",
326 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].voltage.init =
327 + 3300;
328 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].voltage.max =
329 + 3300;
330 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO1].flags &=
331 + ~PMU_VRAIL_F_SUSPEND_ON;
332 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO3].flags =
333 + PMU_VRAIL_F_UNUSED;
334 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO5] = ((struct pmu_voltage_rail) {
335 + .name = "rf_3v",
336 + .voltage = {
337 + .init = 0,
338 + .max = 3000,
339 + }
340 + });
341 + gta02_pcf_pdata.rails[PCF50633_REGULATOR_LDO6] = ((struct pmu_voltage_rail) {
342 + .name = "lcm_3v",
343 + .voltage = {
344 + .init = 3000,
345 + .max = 3000,
346 + }
347 + });
348 + break;
349 + default:
350 + break;
351 + }
352 +}
353 +
354 +static struct resource gta02_pmu_resources[] = {
355 + [0] = {
356 + .flags = IORESOURCE_IRQ,
357 + .start = GTA02_IRQ_PCF50633,
358 + .end = GTA02_IRQ_PCF50633,
359 + },
360 +};
361 +
362 +struct platform_device gta02_pmu_dev = {
363 + .name = "pcf50633",
364 + .num_resources = ARRAY_SIZE(gta02_pmu_resources),
365 + .resource = gta02_pmu_resources,
366 + .dev = {
367 + .platform_data = &gta02_pcf_pdata,
368 + },
369 +};
370 +
371 +
372 +/* NOR Flash */
373 +
374 +#define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
375 +#define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */
376 +
377 +static struct physmap_flash_data gta02_nor_flash_data = {
378 + .width = 2,
379 +};
380 +
381 +static struct resource gta02_nor_flash_resource = {
382 + .start = GTA02_FLASH_BASE,
383 + .end = GTA02_FLASH_BASE + GTA02_FLASH_SIZE - 1,
384 + .flags = IORESOURCE_MEM,
385 +};
386 +
387 +static struct platform_device gta02_nor_flash = {
388 + .name = "physmap-flash",
389 + .id = 0,
390 + .dev = {
391 + .platform_data = &gta02_nor_flash_data,
392 + },
393 + .resource = &gta02_nor_flash_resource,
394 + .num_resources = 1,
395 +};
396 +
397 +
398 +
399 +static struct resource gta02_sdio_resources[] = {
400 + [0] = {
401 + .flags = IORESOURCE_IRQ,
402 + .start = IRQ_SDI,
403 + .end = IRQ_SDI,
404 + },
405 + [1] = {
406 + .flags = IORESOURCE_MEM,
407 + .start = S3C2410_PA_SDI,
408 + .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
409 + },
410 + [2] = {
411 + .flags = IORESOURCE_DMA,
412 + .start = 0, /* Channel 0 for SDI */
413 + .end = 0,
414 + },
415 +};
416 +
417 +
418 +static struct platform_device gta02_sdio_dev = {
419 + .name = "s3c24xx-sdio",
420 + .id = -1,
421 + .dev = {
422 + .coherent_dma_mask = 0xffffffff,
423 + },
424 + .resource = gta02_sdio_resources,
425 + .num_resources = ARRAY_SIZE(gta02_sdio_resources),
426 +};
427 +
428 +static struct platform_device *gta02_devices[] __initdata = {
429 + &s3c_device_usb,
430 + &s3c_device_wdt,
431 + &s3c_device_i2c,
432 + &s3c_device_iis,
433 + // &s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
434 + &s3c_device_usbgadget,
435 + &s3c_device_nand,
436 + &s3c_device_ts,
437 + &s3c_device_spi0,
438 + &s3c_device_spi1,
439 + &gta02_nor_flash,
440 +};
441 +
442 +static struct s3c2410_nand_set gta02_nand_sets[] = {
443 + [0] = {
444 + .name = "neo1973-nand",
445 + .nr_chips = 1,
446 + .flags = S3C2410_NAND_BBT,
447 + },
448 +};
449 +
450 +/* choose a set of timings which should suit most 512Mbit
451 + * chips and beyond.
452 + */
453 +
454 +static struct s3c2410_platform_nand gta02_nand_info = {
455 + .tacls = 20,
456 + .twrph0 = 60,
457 + .twrph1 = 20,
458 + .nr_sets = ARRAY_SIZE(gta02_nand_sets),
459 + .sets = gta02_nand_sets,
460 +};
461 +
462 +static struct s3c24xx_mci_pdata gta02_mmc_cfg = {
463 + .gpio_detect = GTA02v1_GPIO_nSD_DETECT,
464 + .set_power = NULL,
465 + .ocr_avail = MMC_VDD_32_33,
466 +};
467 +
468 +static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd)
469 +{
470 + printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
471 +
472 + switch (cmd) {
473 + case S3C2410_UDC_P_ENABLE:
474 + s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP, 1);
475 + break;
476 + case S3C2410_UDC_P_DISABLE:
477 + s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP, 0);
478 + break;
479 + case S3C2410_UDC_P_RESET:
480 + /* FIXME! */
481 + break;
482 + default:
483 + break;
484 + }
485 +}
486 +
487 +/* use a work queue, since I2C API inherently schedules
488 + * and we get called in hardirq context from UDC driver */
489 +
490 +struct vbus_draw {
491 + struct work_struct work;
492 + int ma;
493 +};
494 +static struct vbus_draw gta02_udc_vbus_drawer;
495 +
496 +static void __gta02_udc_vbus_draw(struct work_struct *work)
497 +{
498 + if (!pcf50633_global) {
499 + printk(KERN_ERR "pcf50633 not initialized yet, can't change "
500 + "vbus_draw\n");
501 + return;
502 + }
503 + pcf50633_usb_curlim_set(pcf50633_global, gta02_udc_vbus_drawer.ma);
504 +}
505 +
506 +static void gta02_udc_vbus_draw(unsigned int ma)
507 +{
508 + gta02_udc_vbus_drawer.ma = ma;
509 + schedule_work(&gta02_udc_vbus_drawer.work);
510 +}
511 +
512 +static struct s3c2410_udc_mach_info gta02_udc_cfg = {
513 + .vbus_draw = gta02_udc_vbus_draw,
514 + .udc_command = gta02_udc_command,
515 +
516 +};
517 +
518 +static struct s3c2410_ts_mach_info gta02_ts_cfg = {
519 + .delay = 10000,
520 + .presc = 65,
521 + .oversampling_shift = 5,
522 +};
523 +
524 +/* SPI */
525 +
526 +static struct spi_board_info gta02_spi_board_info[] = {
527 + {
528 + .modalias = "jbt6k74",
529 + /* platform_data */
530 + /* controller_data */
531 + /* irq */
532 + .max_speed_hz = 10 * 1000 * 1000,
533 + .bus_num = 2,
534 + /* chip_select */
535 + },
536 +};
537 +
538 +static struct glamo_spi_info glamo_spi_cfg = {
539 + .board_size = ARRAY_SIZE(gta02_spi_board_info),
540 + .board_info = gta02_spi_board_info,
541 +};
542 +
543 +static struct glamo_spigpio_info glamo_spigpio_cfg = {
544 + .pin_clk = GLAMO_GPIO10_OUTPUT,
545 + .pin_mosi = GLAMO_GPIO11_OUTPUT,
546 + .pin_cs = GLAMO_GPIO12_OUTPUT,
547 + .pin_miso = 0,
548 + .board_size = ARRAY_SIZE(gta02_spi_board_info),
549 + .board_info = gta02_spi_board_info,
550 +};
551 +
552 +static struct resource gta01_led_resources[] = {
553 + [0] = {
554 + .start = GTA02_GPIO_VIBRATOR_ON,
555 + .end = GTA02_GPIO_VIBRATOR_ON,
556 + },
557 +};
558 +
559 +static struct platform_device gta01_led_dev = {
560 + .name = "neo1973-vibrator",
561 + .num_resources = ARRAY_SIZE(gta01_led_resources),
562 + .resource = gta01_led_resources,
563 +};
564 +
565 +static struct resource gta02_led_resources[] = {
566 + {
567 + .name = "gta02-power:orange",
568 + .start = GTA02_GPIO_PWR_LED1,
569 + .end = GTA02_GPIO_PWR_LED1,
570 + }, {
571 + .name = "gta02-power:blue",
572 + .start = GTA02_GPIO_PWR_LED2,
573 + .end = GTA02_GPIO_PWR_LED2,
574 + }, {
575 + .name = "gta02-aux:red",
576 + .start = GTA02_GPIO_AUX_LED,
577 + .end = GTA02_GPIO_AUX_LED,
578 + },
579 +};
580 +
581 +struct platform_device gta02_led_dev = {
582 + .name = "gta02-led",
583 + .num_resources = ARRAY_SIZE(gta02_led_resources),
584 + .resource = gta02_led_resources,
585 +};
586 +
587 +static struct resource gta01_button_resources[] = {
588 + [0] = {
589 + .start = GTA02_GPIO_AUX_KEY,
590 + .end = GTA02_GPIO_AUX_KEY,
591 + },
592 + [1] = {
593 + .start = GTA02_GPIO_HOLD_KEY,
594 + .end = GTA02_GPIO_HOLD_KEY,
595 + },
596 + [2] = {
597 + .start = GTA02_GPIO_JACK_INSERT,
598 + .end = GTA02_GPIO_JACK_INSERT,
599 + },
600 +};
601 +
602 +static struct platform_device gta01_button_dev = {
603 + .name = "neo1973-button",
604 + .num_resources = ARRAY_SIZE(gta01_button_resources),
605 + .resource = gta01_button_resources,
606 +};
607 +
608 +static struct platform_device gta01_pm_gsm_dev = {
609 + .name = "neo1973-pm-gsm",
610 +};
611 +
612 +/* USB */
613 +static struct s3c2410_hcd_info gta02_usb_info = {
614 + .port[0] = {
615 + .flags = S3C_HCDFLG_USED,
616 + },
617 + .port[1] = {
618 + .flags = 0,
619 + },
620 +};
621 +
622 +static int glamo_irq_is_wired(void)
623 +{
624 + int rc;
625 + int count = 0;
626 +
627 + /*
628 + * GTA02 S-Media IRQs prior to A5 are broken due to a lack of
629 + * a pullup on the INT# line. Check for the bad behaviour.
630 + */
631 + s3c2410_gpio_setpin(S3C2410_GPG4, 0);
632 + s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_OUTP);
633 + s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP);
634 + /*
635 + * we force it low ourselves for a moment and resume being input.
636 + * If there is a pullup, it won't stay low for long. But if the
637 + * level converter is there as on < A5 revision, the weak keeper
638 + * on the input of the LC will hold the line low indefinitiely
639 + */
640 + do
641 + rc = s3c2410_gpio_getpin(S3C2410_GPG4);
642 + while ((!rc) && ((count++) < 10));
643 + if (rc) { /* it got pulled back up, it's good */
644 + printk(KERN_INFO "Detected S-Media IRQ# pullup, "
645 + "enabling interrupt\n");
646 + return 0;
647 + } else /* Gah we can't work with this level converter */
648 + printk(KERN_WARNING "** Detected bad IRQ# circuit found"
649 + " on pre-A5 GTA02: S-Media interrupt disabled **\n");
650 + return -ENODEV;
651 +}
652 +
653 +
654 +static void
655 +gta02_glamo_mmc_set_power(unsigned char power_mode, unsigned short vdd)
656 +{
657 + int mv = 1650;
658 +
659 + printk(KERN_DEBUG "mmc_set_power(power_mode=%u, vdd=%u\n",
660 + power_mode, vdd);
661 +
662 + switch (system_rev) {
663 + case GTA02v1_SYSTEM_REV:
664 + case GTA02v2_SYSTEM_REV:
665 + break;
666 + case GTA02v3_SYSTEM_REV:
667 + case GTA02v4_SYSTEM_REV:
668 + case GTA02v5_SYSTEM_REV:
669 + case GTA02v6_SYSTEM_REV:
670 + /* depend on pcf50633 driver init */
671 + if (!pcf50633_global)
672 + while (!pcf50633_global)
673 + msleep(10);
674 + switch (power_mode) {
675 + case MMC_POWER_ON:
676 + case MMC_POWER_UP:
677 + /* select and set the voltage */
678 + if (vdd > 7) {
679 + mv += 300 + 100 * (vdd - 8);
680 + if (mv > 3500)
681 + mv = 3500;
682 + }
683 + pcf50633_voltage_set(pcf50633_global,
684 + PCF50633_REGULATOR_HCLDO, mv);
685 + msleep(10);
686 + pcf50633_onoff_set(pcf50633_global,
687 + PCF50633_REGULATOR_HCLDO, 1);
688 + msleep(1);
689 + break;
690 + case MMC_POWER_OFF:
691 + pcf50633_onoff_set(pcf50633_global,
692 + PCF50633_REGULATOR_HCLDO, 0);
693 + msleep(1);
694 + break;
695 + }
696 + break;
697 + }
698 +}
699 +
700 +/* Smedia Glamo 3362 */
701 +
702 +static struct glamofb_platform_data gta02_glamo_pdata = {
703 + .width = 43,
704 + .height = 58,
705 + /* 24.5MHz --> 40.816ns */
706 + .pixclock = 40816,
707 + .left_margin = 8,
708 + .right_margin = 16,
709 + .upper_margin = 2,
710 + .lower_margin = 16,
711 + .hsync_len = 8,
712 + .vsync_len = 2,
713 + .fb_mem_size = 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
714 + .xres = {
715 + .min = 240,
716 + .max = 640,
717 + .defval = 480,
718 + },
719 + .yres = {
720 + .min = 320,
721 + .max = 640,
722 + .defval = 640,
723 + },
724 + .bpp = {
725 + .min = 16,
726 + .max = 16,
727 + .defval = 16,
728 + },
729 + //.spi_info = &glamo_spi_cfg,
730 + .spigpio_info = &glamo_spigpio_cfg,
731 +
732 + /* glamo MMC function platform data */
733 + .glamo_set_mci_power = gta02_glamo_mmc_set_power,
734 + .glamo_irq_is_wired = glamo_irq_is_wired,
735 +};
736 +
737 +static struct resource gta02_glamo_resources[] = {
738 + [0] = {
739 + .start = S3C2410_CS1,
740 + .end = S3C2410_CS1 + 0x1000000 - 1,
741 + .flags = IORESOURCE_MEM,
742 + },
743 + [1] = {
744 + .start = GTA02_IRQ_3D,
745 + .end = GTA02_IRQ_3D,
746 + .flags = IORESOURCE_IRQ,
747 + },
748 + [2] = {
749 + .start = GTA02v1_GPIO_3D_RESET,
750 + .end = GTA02v1_GPIO_3D_RESET,
751 + },
752 +};
753 +
754 +static struct platform_device gta02_glamo_dev = {
755 + .name = "glamo3362",
756 + .num_resources = ARRAY_SIZE(gta02_glamo_resources),
757 + .resource = gta02_glamo_resources,
758 + .dev = {
759 + .platform_data = &gta02_glamo_pdata,
760 + },
761 +};
762 +
763 +static void mangle_glamo_res_by_system_rev(void)
764 +{
765 + switch (system_rev) {
766 + case GTA02v1_SYSTEM_REV:
767 + break;
768 + default:
769 + gta02_glamo_resources[2].start = GTA02_GPIO_3D_RESET;
770 + gta02_glamo_resources[2].end = GTA02_GPIO_3D_RESET;
771 + break;
772 + }
773 +
774 + switch (system_rev) {
775 + case GTA02v1_SYSTEM_REV:
776 + case GTA02v2_SYSTEM_REV:
777 + case GTA02v3_SYSTEM_REV:
778 + /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
779 + /* The hardware is missing a pull-up resistor and thus can't
780 + * support the Smedia Glamo IRQ */
781 + gta02_glamo_resources[1].start = 0;
782 + gta02_glamo_resources[1].end = 0;
783 + break;
784 + }
785 +}
786 +
787 +static void __init gta02_map_io(void)
788 +{
789 + s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
790 + s3c24xx_init_clocks(12000000);
791 + s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
792 +}
793 +
794 +static irqreturn_t gta02_modem_irq(int irq, void *param)
795 +{
796 + printk(KERN_DEBUG "modem wakeup interrupt\n");
797 + return IRQ_HANDLED;
798 +}
799 +
800 +static void __init gta02_machine_init(void)
801 +{
802 + int rc;
803 +
804 + s3c_device_usb.dev.platform_data = &gta02_usb_info;
805 + s3c_device_nand.dev.platform_data = &gta02_nand_info;
806 + s3c_device_sdi.dev.platform_data = &gta02_mmc_cfg;
807 +
808 + /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not
809 + * hot-pluggable, this is not required anyway */
810 + switch (system_rev) {
811 + case GTA02v1_SYSTEM_REV:
812 + break;
813 + default:
814 + gta02_mmc_cfg.gpio_detect = 0;
815 + break;
816 + }
817 +
818 + INIT_WORK(&gta02_udc_vbus_drawer.work, __gta02_udc_vbus_draw);
819 + s3c24xx_udc_set_platdata(&gta02_udc_cfg);
820 + set_s3c2410ts_info(&gta02_ts_cfg);
821 +
822 + /* FIXME: hardcoded WLAN module power-up */
823 + s3c2410_gpio_cfgpin(GTA02_CHIP_PWD, S3C2410_GPIO_OUTPUT);
824 +
825 + /* Power is down */
826 + s3c2410_gpio_setpin(GTA02_CHIP_PWD, 1);
827 + mdelay(100);
828 +
829 + switch (system_rev) {
830 + case GTA02v1_SYSTEM_REV:
831 + s3c2410_gpio_setpin(GTA02_CHIP_PWD, 0);
832 + break;
833 + default:
834 + s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET, S3C2410_GPIO_OUTPUT);
835 + /* Chip is in reset state */
836 + s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 0);
837 + mdelay(100);
838 + /* Power is up */
839 + s3c2410_gpio_setpin(GTA02_CHIP_PWD, 0);
840 + mdelay(100);
841 + /* Chip is out of reset */
842 + s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 1);
843 + break;
844 + }
845 +
846 + platform_device_register(&gta01_button_dev);
847 + platform_device_register(&gta01_pm_gsm_dev);
848 +
849 + mangle_pmu_pdata_by_system_rev();
850 + platform_device_register(&gta02_pmu_dev);
851 + platform_device_register(&gta01_led_dev);
852 + platform_device_register(&gta02_led_dev);
853 +
854 + mangle_glamo_res_by_system_rev();
855 + platform_device_register(&gta02_glamo_dev);
856 +
857 + platform_device_register(&gta02_sdio_dev);
858 +
859 + platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
860 +
861 + s3c2410_pm_init();
862 +
863 + /* Set LCD_RESET / XRES to high */
864 + s3c2410_gpio_cfgpin(GTA01_GPIO_LCD_RESET, S3C2410_GPIO_OUTPUT);
865 + s3c2410_gpio_setpin(GTA01_GPIO_LCD_RESET, 1);
866 +
867 + /* Make sure the modem can wake us up */
868 + set_irq_type(GTA02_IRQ_MODEM, IRQT_RISING);
869 + rc = request_irq(GTA02_IRQ_MODEM, gta02_modem_irq, IRQF_DISABLED,
870 + "modem", NULL);
871 + if (rc < 0)
872 + printk(KERN_ERR "GTA02: can't request GSM modem wakeup IRQ\n");
873 + enable_irq_wake(GTA02_IRQ_MODEM);
874 +}
875 +
876 +MACHINE_START(NEO1973_GTA02, "GTA02")
877 + .phys_io = S3C2410_PA_UART,
878 + .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
879 + .boot_params = S3C2410_SDRAM_PA + 0x100,
880 + .map_io = gta02_map_io,
881 + .init_irq = s3c24xx_init_irq,
882 + .init_machine = gta02_machine_init,
883 + .timer = &s3c24xx_timer,
884 +MACHINE_END
885 diff --git a/drivers/leds/leds-neo1973-vibrator.c b/drivers/leds/leds-neo1973-vibrator.c
886 index 0336e36..c943a6a 100644
887 --- a/drivers/leds/leds-neo1973-vibrator.c
888 +++ b/drivers/leds/leds-neo1973-vibrator.c
889 @@ -113,7 +113,7 @@ static int __init neo1973_vib_probe(struct platform_device *pdev)
890 struct resource *r;
891 int rc;
892
893 - if (!machine_is_neo1973_gta01())
894 + if (!machine_is_neo1973_gta01() && !machine_is_neo1973_gta02())
895 return -EIO;
896
897 r = platform_get_resource(pdev, 0, 0);
898 diff --git a/include/asm-arm/arch-s3c2410/gta02.h b/include/asm-arm/arch-s3c2410/gta02.h
899 new file mode 100644
900 index 0000000..fa49d93
901 --- /dev/null
902 +++ b/include/asm-arm/arch-s3c2410/gta02.h
903 @@ -0,0 +1,99 @@
904 +#ifndef _GTA02_H
905 +#define _GTA02_H
906 +
907 +#include <asm/arch/regs-gpio.h>
908 +#include <asm/arch/irqs.h>
909 +
910 +/* Different hardware revisions, passed in ATAG_REVISION by u-boot */
911 +#define GTA02v1_SYSTEM_REV 0x00000310
912 +#define GTA02v2_SYSTEM_REV 0x00000320
913 +#define GTA02v3_SYSTEM_REV 0x00000330
914 +#define GTA02v4_SYSTEM_REV 0x00000340
915 +#define GTA02v5_SYSTEM_REV 0x00000350
916 +#define GTA02v6_SYSTEM_REV 0x00000360
917 +
918 +#define GTA02_GPIO_n3DL_GSM S3C2410_GPA13 /* v1 + v2 + v3 only */
919 +
920 +#define GTA02_GPIO_PWR_LED1 S3C2410_GPB0
921 +#define GTA02_GPIO_PWR_LED2 S3C2410_GPB1
922 +#define GTA02_GPIO_AUX_LED S3C2410_GPB2
923 +#define GTA02_GPIO_VIBRATOR_ON S3C2410_GPB3
924 +#define GTA02v1_GPIO_GPS_PWRON S3C2410_GPB4 /* v1 only */
925 +#define GTA02_GPIO_MODEM_RST S3C2410_GPB5
926 +#define GTA02_GPIO_BT_EN S3C2410_GPB6
927 +#define GTA02_GPIO_MODEM_ON S3C2410_GPB7
928 +#define GTA02v1_GPIO_EN_AGPS3V S3C2410_GPB8 /* v1 only */
929 +#define GTA02_GPIO_EXTINT8 S3C2410_GPB8
930 +#define GTA02_GPIO_USB_PULLUP S3C2410_GPB9
931 +
932 +#define GTA02v1_GPIO_nGPS_RST S3C2410_GPC0 /* v1 only */
933 +#define GTA02v12_GPIO_PIO3 S3C2410_GPC5 /* v1 + v2 only */
934 +#define GTA02_GPIO_PIO5 S3C2410_GPC5 /* v3 + v4 only */
935 +#define GTA02_GPIO_LCD_RESET S3C2410_GPC6 /* v1 + v2 only */
936 +#define GTA02v12_GPIO_PIO2 S3C2410_GPC7 /* v1 + v2 only */
937 +#define GTA02v2_nUSB_FLT S3C2410_GPC9 /* v2 only */
938 +#define GTA02v2_nUSB_OC S3C2410_GPC10 /* v2 only */
939 +#define GTA02v2_nGSM_OC S3C2410_GPC12 /* v2 only */
940 +
941 +#define GTA02v3_GPIO_nG1_CS S3C2410_GPD12 /* v3 + v4 only */
942 +#define GTA02v3_GPIO_nG2_CS S3C2410_GPD13 /* v3 + v4 only */
943 +
944 +#define GTA02_GPIO_nG1_INT S3C2410_GPF0
945 +#define GTA02_GPIO_IO1 S3C2410_GPF1
946 +#define GTA02v1_GPIO_nG2_INT S3C2410_GPF2 /* v1 only */
947 +#define GTA02_GPIO_PIO_2 S3C2410_GPF2 /* v2 + v3 + v4 only */
948 +#define GTA02_GPIO_JACK_INSERT S3C2410_GPF4
949 +#define GTA02v1_GPIO_nSD_DETECT S3C2410_GPF5 /* v1 only */
950 +#define GTA02_GPIO_WLAN_GPIO1 S3C2410_GPF5 /* v2 + v3 + v4 only */
951 +#define GTA02_GPIO_AUX_KEY S3C2410_GPF6
952 +#define GTA02_GPIO_HOLD_KEY S3C2410_GPF7
953 +
954 +#define GTA02_GPIO_3D_IRQ S3C2410_GPG4
955 +#define GTA02v1_GPIO_nG1_CS S3C2410_GPG8 /* v1 only */
956 +#define GTA02v2_GPIO_nG2_INT S3C2410_GPG8 /* v2 + v3 + v4 only */
957 +#define GTA02v3_GPIO_nUSB_OC S3C2410_GPG9 /* v3 + v4 only */
958 +#define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG10 /* v3 + v4 only */
959 +#define GTA02v1_GPIO_nG2_CS S3C2410_GPG11 /* v1 only */
960 +#define GTA02v3_GPIO_nGSM_OC S3C2410_GPG11 /* v3 + v4 only */
961 +
962 +#define GTA02v1_GPIO_3D_RESET S3C2440_GPJ0 /* v1 only */
963 +#define GTA02v2_GPIO_BAT_ID S3C2440_GPJ0 /* v2 only */
964 +#define GTA02v1_GPIO_WLAN_GPIO8 S3C2440_GPJ1 /* v1 only */
965 +#define GTA02_GPIO_AMP_SHUT S3C2440_GPJ1 /* v2 + v3 + v4 only */
966 +#define GTA02v1_GPIO_WLAN_GPIO10 S3C2440_GPJ2
967 +#define GTA02_GPIO_HP_IN S3C2440_GPJ2 /* v2 + v3 + v4 only */
968 +#define GTA02v1_GPIO_KEEPACT S3C2440_GPJ3 /* v1 only */
969 +#define GTA02_GPIO_INT0 S3C2440_GPJ3 /* v2 + v3 + v4 only */
970 +#define GTA02_GPIO_nGSM_EN S3C2440_GPJ4
971 +#define GTA02_GPIO_3D_RESET S3C2440_GPJ5
972 +#define GTA02_GPIO_nDL_GSM S3C2440_GPJ6 /* v4 + v5 only */
973 +#define GTA02_GPIO_WLAN_GPIO0 S3C2440_GPJ7
974 +#define GTA02v1_GPIO_BAT_ID S3C2440_GPJ8
975 +#define GTA02_GPIO_KEEPACT S3C2440_GPJ8
976 +#define GTA02v1_GPIO_AMP_SHUT S3C2440_GPJ9 /* v1 only */
977 +#define GTA02v2_nG1_CS S3C2440_GPJ9 /* v2 only */
978 +#define GTA02v1_GPIO_HP_IN S3C2440_GPJ10
979 +#define GTA02v2_nG2_CS S3C2440_GPJ10 /* v2 only */
980 +#define GTA02v1_GPIO_INT0 S3C2440_GPJ11 /* v1 only */
981 +#define GTA02_CHIP_PWD S3C2440_GPJ11 /* v2 + v3 + v4 only */
982 +#define GTA02v1_GPIO_nGSM_EN S3C2440_GPJ12 /* v1 only */
983 +#define GTA02_GPIO_nWLAN_RESET S3C2440_GPJ12 /* v2 + v3 + v4 only */
984 +
985 +#define GTA02_IRQ_GSENSOR_1 IRQ_EINT0
986 +#define GTA02_IRQ_MODEM IRQ_EINT1
987 +#define GTA02v1_IRQ_GSENSOR_2 IRQ_EINT2 /* v1 only */
988 +#define GTA02_IRQ_PIO_2 IRQ_EINT2 /* v2 + v3 + v4 only */
989 +#define GTA02_IRQ_nJACK_INSERT IRQ_EINT4
990 +#define GTA02v1_IRQ_nSD_CD IRQ_EINT5 /* v1 only */
991 +#define GTA02_IRQ_WLAN_GPIO1 IRQ_EINT5
992 +#define GTA02_IRQ_AUX IRQ_EINT6
993 +#define GTA02_IRQ_nHOLD IRQ_EINT7
994 +#define GTA02v1_IRQ_nSIM_CD IRQ_EINT8 /* v1 only */
995 +#define GTA02_IRQ_PCF50633 IRQ_EINT9
996 +#define GTA02_IRQ_3D IRQ_EINT12
997 +#define GTA02_IRQ_GSENSOR_2 IRQ_EINT16 /* v2 + v3 + v4 only */
998 +#define GTA02v3_IRQ_nUSB_OC IRQ_EINT17 /* v3 + v4 only */
999 +#define GTA02v3_IRQ_nUSB_FLT IRQ_EINT18 /* v3 + v4 only */
1000 +#define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */
1001 +
1002 +#endif /* _GTA02_H */
1003 diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
1004 index 0e9d1c5..4ab6f63 100644
1005 --- a/sound/soc/s3c24xx/neo1973_wm8753.c
1006 +++ b/sound/soc/s3c24xx/neo1973_wm8753.c
1007 @@ -671,6 +671,14 @@ static int __init neo1973_init(void)
1008 {
1009 int ret;
1010
1011 + DBG("Entered %s\n", __func__);
1012 +
1013 + if (!machine_is_neo1973_gta01()) {
1014 + printk(KERN_INFO
1015 + "Only GTA01 hardware supported by ASoc driver\n");
1016 + return -ENODEV;
1017 + }
1018 +
1019 neo1973_snd_device = platform_device_alloc("soc-audio", -1);
1020 if (!neo1973_snd_device)
1021 return -ENOMEM;
1022 --
1023 1.5.6.3
1024
This page took 0.081152 seconds and 5 git commands to generate.