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