2 * linux/arch/arm/mach-s3c2440/mach-gta02.c
4 * S3C2440 Machine Support for the FIC GTA02 (Neo1973)
6 * Copyright (C) 2006-2007 by Openmoko, Inc.
7 * Author: Harald Welte <laforge@openmoko.org>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <linux/kernel.h>
28 #include <linux/types.h>
29 #include <linux/interrupt.h>
30 #include <linux/list.h>
31 #include <linux/delay.h>
32 #include <linux/timer.h>
33 #include <linux/init.h>
34 #include <linux/workqueue.h>
35 #include <linux/platform_device.h>
36 #include <linux/serial_core.h>
37 #include <linux/spi/spi.h>
38 #include <linux/spi/glamo.h>
39 #include <linux/spi/spi_bitbang.h>
40 #include <linux/mmc/host.h>
42 #include <linux/mtd/mtd.h>
43 #include <linux/mtd/nand.h>
44 #include <linux/mtd/nand_ecc.h>
45 #include <linux/mtd/partitions.h>
46 #include <linux/mtd/physmap.h>
48 #include <linux/pcf50633.h>
49 #include <linux/lis302dl.h>
51 #include <asm/mach/arch.h>
52 #include <asm/mach/map.h>
53 #include <asm/mach/irq.h>
55 #include <asm/hardware.h>
58 #include <asm/mach-types.h>
60 #include <asm/arch-s3c2410/regs-irq.h>
61 #include <asm/arch/regs-gpio.h>
62 #include <asm/arch/regs-gpioj.h>
63 #include <asm/arch/fb.h>
64 #include <asm/arch/mci.h>
65 #include <asm/arch/ts.h>
66 #include <asm/arch/spi.h>
67 #include <asm/arch/spi-gpio.h>
68 #include <asm/arch/usb-control.h>
70 #include <asm/arch/gta02.h>
72 #include <asm/plat-s3c/regs-serial.h>
73 #include <asm/plat-s3c/nand.h>
74 #include <asm/plat-s3c24xx/devs.h>
75 #include <asm/plat-s3c24xx/cpu.h>
76 #include <asm/plat-s3c24xx/pm.h>
77 #include <asm/plat-s3c24xx/udc.h>
78 #include <asm/plat-s3c24xx/neo1973.h>
79 #include <asm/arch-s3c2410/neo1973-pm-gsm.h>
81 #include <linux/jbt6k74.h>
83 #include <linux/glamofb.h>
85 #include <asm/arch/fiq_ipc_gta02.h>
86 #include "fiq_c_isr.h"
87 #include <linux/gta02_hdq.h>
88 #include <linux/bq27000_battery.h>
89 #include <linux/neospy.h>
91 #include "../plat-s3c24xx/neo1973_pm_gps.h"
93 /* arbitrates which sensor IRQ owns the shared SPI bus */
94 static spinlock_t motion_irq_lock
;
96 /* the dependency of jbt / LCM on pcf50633 resume */
97 struct resume_dependency resume_dep_jbt_pcf
;
98 /* the dependency of jbt / LCM on glamo resume */
99 struct resume_dependency resume_dep_jbt_glamo
;
100 /* the dependency of Glamo MCI on pcf50633 resume (has to power SD slot) */
101 struct resume_dependency resume_dep_glamo_mci_pcf
;
104 static int gta02_charger_online_status
;
105 static int gta02_charger_active_status
;
107 /* define FIQ IPC struct */
109 * contains stuff FIQ ISR modifies and normal kernel code can see and use
110 * this is defined in <asm/arch/fiq_ipc_gta02.h>, you should customize
111 * the definition in there and include the same definition in your kernel
112 * module that wants to interoperate with your FIQ code.
114 struct fiq_ipc fiq_ipc
;
115 EXPORT_SYMBOL(fiq_ipc
);
117 #define DIVISOR_FROM_US(x) ((x) << 1)
119 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
121 #ifdef CONFIG_GTA02_HDQ
123 #define HDQ_SAMPLE_PERIOD_US 20
124 /* private HDQ FSM state -- all other info interesting for caller in fiq_ipc */
125 static enum hdq_bitbang_states hdq_state
;
129 static u8 hdq_shifter
;
130 static u8 hdq_tx_data_done
;
132 #define FIQ_DIVISOR_HDQ DIVISOR_FROM_US(HDQ_SAMPLE_PERIOD_US)
137 /* define your locals here -- no initializers though */
139 FIQ_HANDLER_ENTRY(256, 512)
140 /* Your ISR here :-) */
143 /* Vibrator servicing */
145 if (fiq_ipc
.vib_pwm_latched
|| fiq_ipc
.vib_pwm
) { /* not idle */
146 if (((u8
)_fiq_count_fiqs
) == fiq_ipc
.vib_pwm_latched
)
147 neo1973_gpb_setpin(fiq_ipc
.vib_gpio_pin
, 0);
148 if (((u8
)_fiq_count_fiqs
) == 0) {
149 fiq_ipc
.vib_pwm_latched
= fiq_ipc
.vib_pwm
;
150 if (fiq_ipc
.vib_pwm_latched
)
151 neo1973_gpb_setpin(fiq_ipc
.vib_gpio_pin
, 1);
153 divisor
= FIQ_DIVISOR_VIBRATOR
;
156 #ifdef CONFIG_GTA02_HDQ
161 if (fiq_ipc
.hdq_request_ctr
== fiq_ipc
.hdq_transaction_ctr
)
163 hdq_ctr
= 210 / HDQ_SAMPLE_PERIOD_US
;
164 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 0);
165 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_OUTPUT
);
166 hdq_tx_data_done
= 0;
167 hdq_state
= HDQB_TX_BREAK
;
170 case HDQB_TX_BREAK
: /* issue low for > 190us */
171 if (--hdq_ctr
== 0) {
172 hdq_ctr
= 60 / HDQ_SAMPLE_PERIOD_US
;
173 hdq_state
= HDQB_TX_BREAK_RECOVERY
;
174 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 1);
178 case HDQB_TX_BREAK_RECOVERY
: /* issue low for > 40us */
181 hdq_shifter
= fiq_ipc
.hdq_ads
;
182 hdq_bit
= 8; /* 8 bits of ads / rw */
183 hdq_tx_data_done
= 0; /* doing ads */
184 /* fallthru on last one */
187 hdq_ctr
= 50 / HDQ_SAMPLE_PERIOD_US
;
189 hdq_ctr
= 120 / HDQ_SAMPLE_PERIOD_US
;
190 /* carefully precompute the other phase length */
191 hdq_ctr2
= (210 - (hdq_ctr
* HDQ_SAMPLE_PERIOD_US
)) /
192 HDQ_SAMPLE_PERIOD_US
;
193 hdq_state
= HDQB_ADS_LOW
;
196 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 0);
202 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 1);
203 hdq_state
= HDQB_ADS_HIGH
;
207 if (--hdq_ctr2
> 1) /* account for HDQB_ADS_CALC */
209 if (hdq_bit
) { /* more bits to do */
210 hdq_state
= HDQB_ADS_CALC
;
213 /* no more bits, wait it out until hdq_ctr2 exhausted */
216 /* ok no more bits and very last state */
217 hdq_ctr
= 60 / HDQ_SAMPLE_PERIOD_US
;
219 if (fiq_ipc
.hdq_ads
& 0x80) { /* write the byte out */
220 /* set delay before payload */
221 hdq_ctr
= 300 / HDQ_SAMPLE_PERIOD_US
;
222 /* already high, no need to write */
223 hdq_state
= HDQB_WAIT_TX
;
226 /* read the next byte */
227 hdq_bit
= 8; /* 8 bits of data */
228 hdq_ctr
= 3000 / HDQ_SAMPLE_PERIOD_US
;
229 hdq_state
= HDQB_WAIT_RX
;
230 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_INPUT
);
233 case HDQB_WAIT_TX
: /* issue low for > 40us */
236 if (!hdq_tx_data_done
) { /* was that the data sent? */
238 hdq_shifter
= fiq_ipc
.hdq_tx_data
;
239 hdq_bit
= 8; /* 8 bits of data */
240 hdq_state
= HDQB_ADS_CALC
; /* start sending */
243 fiq_ipc
.hdq_error
= 0;
244 fiq_ipc
.hdq_transaction_ctr
++;
245 hdq_state
= HDQB_IDLE
; /* all tx is done */
246 /* idle in input mode, it's pulled up by 10K */
247 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_INPUT
);
250 case HDQB_WAIT_RX
: /* wait for battery to talk to us */
251 if (s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
) == 0) {
252 /* it talks to us! */
254 hdq_bit
= 8; /* 8 bits of data */
256 hdq_ctr
= 300 / HDQ_SAMPLE_PERIOD_US
;
257 hdq_state
= HDQB_DATA_RX_LOW
;
260 if (--hdq_ctr
== 0) { /* timed out, error */
261 fiq_ipc
.hdq_error
= 1;
262 fiq_ipc
.hdq_transaction_ctr
++;
263 hdq_state
= HDQB_IDLE
; /* abort */
268 * HDQ basically works by measuring the low time of the bit cell
269 * 32-50us --> '1', 80 - 145us --> '0'
272 case HDQB_DATA_RX_LOW
:
273 if (s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
)) {
274 fiq_ipc
.hdq_rx_data
>>= 1;
275 if (hdq_ctr2
<= (65 / HDQ_SAMPLE_PERIOD_US
))
276 fiq_ipc
.hdq_rx_data
|= 0x80;
278 if (--hdq_bit
== 0) {
279 fiq_ipc
.hdq_error
= 0;
280 fiq_ipc
.hdq_transaction_ctr
++; /* done */
281 hdq_state
= HDQB_IDLE
;
283 hdq_state
= HDQB_DATA_RX_HIGH
;
285 hdq_ctr
= 1000 / HDQ_SAMPLE_PERIOD_US
;
292 /* timed out, error */
293 fiq_ipc
.hdq_error
= 2;
294 fiq_ipc
.hdq_transaction_ctr
++;
295 hdq_state
= HDQB_IDLE
; /* abort */
298 case HDQB_DATA_RX_HIGH
:
299 if (!s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
)) {
300 /* it talks to us! */
303 hdq_ctr
= 400 / HDQ_SAMPLE_PERIOD_US
;
304 hdq_state
= HDQB_DATA_RX_LOW
;
309 /* timed out, error */
310 fiq_ipc
.hdq_error
= 3;
311 fiq_ipc
.hdq_transaction_ctr
++;
312 /* we're in input mode already */
313 hdq_state
= HDQB_IDLE
; /* abort */
317 if (hdq_state
!= HDQB_IDLE
) /* ie, not idle */
318 if (divisor
> FIQ_DIVISOR_HDQ
)
319 divisor
= FIQ_DIVISOR_HDQ
; /* keep us going */
322 /* disable further timer interrupts if nobody has any work
323 * or adjust rate according to who still has work
325 * CAUTION: it means forground code must disable FIQ around
326 * its own non-atomic S3C2410_INTMSK changes... not common
327 * thankfully and taken care of by the fiq-basis patch
329 if (divisor
== 0xffff) /* mask the fiq irq source */
330 __raw_writel(__raw_readl(S3C2410_INTMSK
) | _fiq_ack_mask
,
332 else /* still working, maybe at a different rate */
333 __raw_writel(divisor
, S3C2410_TCNTB(_fiq_timer_index
));
334 _fiq_timer_divisor
= divisor
;
340 * this gets called every 1ms when we paniced.
343 static long gta02_panic_blink(long count
)
346 static long last_blink
;
349 if (count
- last_blink
< 100) /* 200ms period, fast blink */
353 s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED
, S3C2410_GPIO_OUTPUT
);
354 neo1973_gpb_setpin(GTA02_GPIO_AUX_LED
, led
);
362 * returns PCB revision information in b9,b8 and b2,b1,b0
363 * Pre-GTA02 A6 returns 0x000
364 * GTA02 A6 returns 0x101
368 int gta02_get_pcb_revision(void)
372 static unsigned long pinlist
[] = {
379 static int pin_offset
[] = {
383 for (n
= 0 ; n
< ARRAY_SIZE(pinlist
); n
++) {
385 * set the PCB version GPIO to be pulled-down input
386 * force low briefly first
388 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
389 s3c2410_gpio_setpin(pinlist
[n
], 0);
390 /* misnomer: it is a pullDOWN in 2442 */
391 s3c2410_gpio_pullup(pinlist
[n
], 1);
392 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_INPUT
);
396 if (s3c2410_gpio_getpin(pinlist
[n
]))
397 u
|= 1 << pin_offset
[n
];
400 * when not being interrogated, all of the revision GPIO
401 * are set to output HIGH without pulldown so no current flows
402 * if they are NC or pulled up.
404 s3c2410_gpio_setpin(pinlist
[n
], 1);
405 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
406 /* misnomer: it is a pullDOWN in 2442 */
407 s3c2410_gpio_pullup(pinlist
[n
], 0);
413 struct platform_device gta02_version_device
= {
414 .name
= "neo1973-version",
418 struct platform_device gta02_resume_reason_device
= {
419 .name
= "neo1973-resume",
423 struct platform_device gta02_memconfig_device
= {
424 .name
= "neo1973-memconfig",
428 static struct map_desc gta02_iodesc
[] __initdata
= {
430 .virtual = 0xe0000000,
431 .pfn
= __phys_to_pfn(S3C2410_CS3
+0x01000000),
437 #define UCON S3C2410_UCON_DEFAULT
438 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
439 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
441 static struct s3c2410_uartcfg gta02_uartcfgs
[] = {
466 /* BQ27000 Battery */
468 static int gta02_get_charger_online_status(void)
470 return gta02_charger_online_status
;
473 static int gta02_get_charger_active_status(void)
475 return gta02_charger_active_status
;
479 struct bq27000_platform_data bq27000_pdata
= {
482 .hdq_read
= gta02hdq_read
,
483 .hdq_write
= gta02hdq_write
,
484 .hdq_initialized
= gta02hdq_initialized
,
485 .get_charger_online_status
= gta02_get_charger_online_status
,
486 .get_charger_active_status
= gta02_get_charger_active_status
489 struct platform_device bq27000_battery_device
= {
490 .name
= "bq27000-battery",
492 .platform_data
= &bq27000_pdata
,
497 /* PMU driver info */
499 static int pmu_callback(struct device
*dev
, unsigned int feature
,
500 enum pmu_event event
)
503 case PCF50633_FEAT_MBC
:
505 case PMU_EVT_CHARGER_IDLE
:
506 gta02_charger_active_status
= 0;
508 case PMU_EVT_CHARGER_ACTIVE
:
509 gta02_charger_active_status
= 1;
511 case PMU_EVT_USB_INSERT
:
512 gta02_charger_online_status
= 1;
514 case PMU_EVT_USB_REMOVE
:
515 gta02_charger_online_status
= 0;
517 case PMU_EVT_INSERT
: /* adapter is unsused */
518 case PMU_EVT_REMOVE
: /* adapter is unused */
528 bq27000_charging_state_change(&bq27000_battery_device
);
532 static struct platform_device gta01_pm_gps_dev
= {
533 .name
= "neo1973-pm-gps",
536 static struct platform_device gta01_pm_bt_dev
= {
537 .name
= "neo1973-pm-bt",
540 /* this is called when pc50633 is probed, unfortunately quite late in the
541 * day since it is an I2C bus device. Here we can belatedly define some
542 * platform devices with the advantage that we can mark the pcf50633 as the
543 * parent. This makes them get suspended and resumed with their parent
544 * the pcf50633 still around.
547 static void gta02_pcf50633_attach_child_devices(struct device
*parent_device
)
549 gta01_pm_gps_dev
.dev
.parent
= parent_device
;
550 gta01_pm_bt_dev
.dev
.parent
= parent_device
;
551 platform_device_register(>a01_pm_bt_dev
);
552 platform_device_register(>a01_pm_gps_dev
);
555 static struct pcf50633_platform_data gta02_pcf_pdata
= {
556 .used_features
= PCF50633_FEAT_MBC
|
559 PCF50633_FEAT_CHGCUR
|
560 PCF50633_FEAT_BATVOLT
|
561 PCF50633_FEAT_BATTEMP
|
562 PCF50633_FEAT_PWM_BL
,
563 .onkey_seconds_sig_init
= 4,
564 .onkey_seconds_shutdown
= 8,
567 .r_fix_batt_par
= 10000,
568 .r_sense_milli
= 220,
569 .flag_use_apm_emulation
= 0,
571 [0] = PCF50633_INT1_USBINS
|
572 PCF50633_INT1_USBREM
|
574 [1] = PCF50633_INT2_ONKEYF
,
575 [2] = PCF50633_INT3_ONKEY1S
577 /* warning: these get rewritten during machine init below
578 * depending on pcb variant
581 [PCF50633_REGULATOR_AUTO
] = {
583 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
589 [PCF50633_REGULATOR_DOWN1
] = {
591 /* Wow, when we are going into suspend, after pcf50633
592 * runs its suspend (which happens real early since it
593 * is an i2c device) we are running out of the 22uF cap
594 * on core_1v3 rail !!!!
601 [PCF50633_REGULATOR_DOWN2
] = {
603 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
609 [PCF50633_REGULATOR_HCLDO
] = {
616 [PCF50633_REGULATOR_LDO1
] = {
617 .name
= "gsensor_3v3",
623 [PCF50633_REGULATOR_LDO2
] = {
630 [PCF50633_REGULATOR_LDO3
] = {
637 [PCF50633_REGULATOR_LDO4
] = {
644 [PCF50633_REGULATOR_LDO5
] = {
651 [PCF50633_REGULATOR_LDO6
] = {
653 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
659 [PCF50633_REGULATOR_MEMLDO
] = {
661 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
668 .defer_resume_backlight
= 1,
669 .resume_backlight_ramp_speed
= 5,
670 .attach_child_devices
= gta02_pcf50633_attach_child_devices
674 #if 0 /* currently unused */
675 static void cfg_pmu_vrail(struct pmu_voltage_rail
*vrail
, char *name
,
676 unsigned int flags
, unsigned int init
,
680 vrail
->flags
= flags
;
681 vrail
->voltage
.init
= init
;
682 vrail
->voltage
.max
= max
;
686 static void mangle_pmu_pdata_by_system_rev(void)
688 switch (system_rev
) {
689 case GTA02v1_SYSTEM_REV
:
690 /* FIXME: this is only in v1 due to wrong PMU variant */
691 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].flags
=
692 PMU_VRAIL_F_SUSPEND_ON
;
694 case GTA02v2_SYSTEM_REV
:
695 case GTA02v3_SYSTEM_REV
:
696 case GTA02v4_SYSTEM_REV
:
697 case GTA02v5_SYSTEM_REV
:
698 case GTA02v6_SYSTEM_REV
:
699 /* we need to keep the 1.8V going since this is the SDRAM
700 * self-refresh voltage */
701 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].flags
=
702 PMU_VRAIL_F_SUSPEND_ON
;
703 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].name
=
705 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].name
=
707 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].voltage
.init
=
709 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].voltage
.max
=
711 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].flags
&=
712 ~PMU_VRAIL_F_SUSPEND_ON
;
713 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO3
].flags
=
715 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO5
] = ((struct pmu_voltage_rail
) {
722 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO6
] =
723 ((struct pmu_voltage_rail
) {
725 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
737 static struct resource gta02_pmu_resources
[] = {
739 .flags
= IORESOURCE_IRQ
,
740 .start
= GTA02_IRQ_PCF50633
,
741 .end
= GTA02_IRQ_PCF50633
,
745 struct platform_device gta02_pmu_dev
= {
747 .num_resources
= ARRAY_SIZE(gta02_pmu_resources
),
748 .resource
= gta02_pmu_resources
,
750 .platform_data
= >a02_pcf_pdata
,
756 static struct resource sc32440_fiq_resources
[] = {
758 .flags
= IORESOURCE_IRQ
,
764 struct platform_device sc32440_fiq_device
= {
765 .name
= "sc32440_fiq",
767 .resource
= sc32440_fiq_resources
,
770 #ifdef CONFIG_GTA02_HDQ
773 static struct resource gta02_hdq_resources
[] = {
775 .start
= GTA02v5_GPIO_HDQ
,
776 .end
= GTA02v5_GPIO_HDQ
,
780 struct platform_device gta02_hdq_device
= {
783 .resource
= gta02_hdq_resources
,
790 #define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
791 #define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */
793 static struct physmap_flash_data gta02_nor_flash_data
= {
797 static struct resource gta02_nor_flash_resource
= {
798 .start
= GTA02_FLASH_BASE
,
799 .end
= GTA02_FLASH_BASE
+ GTA02_FLASH_SIZE
- 1,
800 .flags
= IORESOURCE_MEM
,
803 static struct platform_device gta02_nor_flash
= {
804 .name
= "physmap-flash",
807 .platform_data
= >a02_nor_flash_data
,
809 .resource
= >a02_nor_flash_resource
,
815 static struct resource gta02_sdio_resources
[] = {
817 .flags
= IORESOURCE_IRQ
,
822 .flags
= IORESOURCE_MEM
,
823 .start
= S3C2410_PA_SDI
,
824 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
827 .flags
= IORESOURCE_DMA
,
828 .start
= 0, /* Channel 0 for SDI */
834 static struct platform_device gta02_sdio_dev
= {
835 .name
= "s3c24xx-sdio",
838 .coherent_dma_mask
= 0xffffffff,
840 .resource
= gta02_sdio_resources
,
841 .num_resources
= ARRAY_SIZE(gta02_sdio_resources
),
844 struct platform_device s3c24xx_pwm_device
= {
845 .name
= "s3c24xx_pwm",
850 static struct platform_device
*gta02_devices
[] __initdata
= {
855 // &s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
856 &s3c_device_usbgadget
,
861 >a02_version_device
,
862 >a02_memconfig_device
,
863 >a02_resume_reason_device
,
868 static struct s3c2410_nand_set gta02_nand_sets
[] = {
870 .name
= "neo1973-nand",
872 .flags
= S3C2410_NAND_BBT
,
876 /* choose a set of timings which should suit most 512Mbit
880 static struct s3c2410_platform_nand gta02_nand_info
= {
884 .nr_sets
= ARRAY_SIZE(gta02_nand_sets
),
885 .sets
= gta02_nand_sets
,
889 static struct s3c24xx_mci_pdata gta02_mmc_cfg
= {
890 .gpio_detect
= GTA02v1_GPIO_nSD_DETECT
,
892 .ocr_avail
= MMC_VDD_32_33
,
895 static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd
)
897 printk(KERN_DEBUG
"%s(%d)\n", __func__
, cmd
);
900 case S3C2410_UDC_P_ENABLE
:
901 neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 1);
903 case S3C2410_UDC_P_DISABLE
:
904 neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 0);
906 case S3C2410_UDC_P_RESET
:
914 /* get PMU to set USB current limit accordingly */
916 static void gta02_udc_vbus_draw(unsigned int ma
)
918 if (!pcf50633_global
)
921 pcf50633_notify_usb_current_limit_change(pcf50633_global
, ma
);
924 static struct s3c2410_udc_mach_info gta02_udc_cfg
= {
925 .vbus_draw
= gta02_udc_vbus_draw
,
926 .udc_command
= gta02_udc_command
,
930 static struct s3c2410_ts_mach_info gta02_ts_cfg
= {
932 .presc
= 50000000 / 1000000, /* 50 MHz PCLK / 1MHz */
933 /* simple averaging, 2^n samples */
934 .oversampling_shift
= 5,
935 /* averaging filter length, 2^n */
936 .excursion_filter_len_bits
= 5,
937 /* flagged for beauty contest on next sample if differs from
938 * average more than this
940 .reject_threshold_vs_avg
= 2,
944 /* SPI: LCM control interface attached to Glamo3362 */
946 static void gta02_jbt6k74_reset(int devidx
, int level
)
948 glamo_lcm_reset(level
);
951 /* finally bring up deferred backlight resume now LCM is resumed itself */
953 static void gta02_jbt6k74_resuming(int devidx
)
955 pcf50633_backlight_resume(pcf50633_global
);
958 static int gta02_jbt6k74_all_dependencies_resumed(int devidx
)
960 if (!resume_dep_jbt_pcf
.called_flag
)
963 if (!resume_dep_jbt_glamo
.called_flag
)
969 /* register jbt resume action to be dependent on pcf50633 and glamo resume */
971 static void gta02_jbt6k74_suspending(int devindex
, struct spi_device
*spi
)
973 void jbt6k74_resume(void *spi
); /* little white lies about types */
975 resume_dep_jbt_pcf
.callback
= jbt6k74_resume
;
976 resume_dep_jbt_pcf
.context
= (void *)spi
;
977 pcf50633_register_resume_dependency(pcf50633_global
,
978 &resume_dep_jbt_pcf
);
979 resume_dep_jbt_glamo
.callback
= jbt6k74_resume
;
980 resume_dep_jbt_glamo
.context
= (void *)spi
;
981 glamo_register_resume_dependency(&resume_dep_jbt_glamo
);
985 const struct jbt6k74_platform_data jbt6k74_pdata
= {
986 .reset
= gta02_jbt6k74_reset
,
987 .resuming
= gta02_jbt6k74_resuming
,
988 .suspending
= gta02_jbt6k74_suspending
,
989 .all_dependencies_resumed
= gta02_jbt6k74_all_dependencies_resumed
,
992 static struct spi_board_info gta02_spi_board_info
[] = {
994 .modalias
= "jbt6k74",
996 .platform_data
= &jbt6k74_pdata
,
997 /* controller_data */
999 .max_speed_hz
= 10 * 1000 * 1000,
1005 #if 0 /* currently this is not used and we use gpio spi */
1006 static struct glamo_spi_info glamo_spi_cfg
= {
1007 .board_size
= ARRAY_SIZE(gta02_spi_board_info
),
1008 .board_info
= gta02_spi_board_info
,
1012 static struct glamo_spigpio_info glamo_spigpio_cfg
= {
1013 .pin_clk
= GLAMO_GPIO10_OUTPUT
,
1014 .pin_mosi
= GLAMO_GPIO11_OUTPUT
,
1015 .pin_cs
= GLAMO_GPIO12_OUTPUT
,
1017 .board_size
= ARRAY_SIZE(gta02_spi_board_info
),
1018 .board_info
= gta02_spi_board_info
,
1021 static struct resource gta02_vibrator_resources
[] = {
1023 .start
= GTA02_GPIO_VIBRATOR_ON
,
1024 .end
= GTA02_GPIO_VIBRATOR_ON
,
1028 static struct platform_device gta02_vibrator_dev
= {
1029 .name
= "neo1973-vibrator",
1030 .num_resources
= ARRAY_SIZE(gta02_vibrator_resources
),
1031 .resource
= gta02_vibrator_resources
,
1034 /* SPI: Accelerometers attached to SPI of s3c244x */
1037 * Situation is that Linux SPI can't work in an interrupt context, so we
1038 * implement our own bitbang here. Arbitration is needed because not only
1039 * can this interrupt happen at any time even if foreground wants to use
1040 * the bitbang API from Linux, but multiple motion sensors can be on the
1041 * same SPI bus, and multiple interrupts can happen.
1043 * Foreground / interrupt arbitration is okay because the interrupts are
1044 * disabled around all the foreground SPI code.
1046 * Interrupt / Interrupt arbitration is evidently needed, otherwise we
1047 * lose edge-triggered service after a while due to the two sensors sharing
1048 * the SPI bus having irqs at the same time eventually.
1050 * Servicing is typ 75 - 100us at 400MHz.
1053 /* #define DEBUG_SPEW_MS */
1054 #define MG_PER_SAMPLE 18
1056 struct lis302dl_platform_data lis302_pdata_top
;
1057 struct lis302dl_platform_data lis302_pdata_bottom
;
1060 * generic SPI RX and TX bitbang
1061 * only call with interrupts off!
1064 static void __gta02_lis302dl_bitbang(struct lis302dl_info
*lis
, u8
*tx
,
1065 int tx_bytes
, u8
*rx
, int rx_bytes
)
1067 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1070 unsigned long other_cs
;
1073 * Huh.. "quirk"... CS on this device is not really "CS" like you can
1074 * expect. Instead when 1 it selects I2C interface mode. Because we
1075 * have 2 devices on one interface, the "disabled" device when we talk
1076 * to an "enabled" device sees the clocks as I2C clocks, creating
1079 * I2C sees MOSI going LOW while CLK HIGH as a START action, we must
1080 * ensure this is never issued.
1083 if (&lis302_pdata_top
== pdata
)
1084 other_cs
= lis302_pdata_bottom
.pin_chip_select
;
1086 other_cs
= lis302_pdata_top
.pin_chip_select
;
1088 s3c2410_gpio_setpin(other_cs
, 1);
1089 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1090 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1091 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1093 /* send the register index, r/w and autoinc bits */
1094 for (n
= 0; n
< (tx_bytes
<< 3); n
++) {
1096 shifter
= tx
[n
>> 3];
1097 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1098 s3c2410_gpio_setpin(pdata
->pin_mosi
, (shifter
>> 7) & 1);
1099 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1100 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1101 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1105 for (n
= 0; n
< (rx_bytes
<< 3); n
++) { /* 8 bits each */
1106 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1107 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1109 if (s3c2410_gpio_getpin(pdata
->pin_miso
))
1112 rx
[n
>> 3] = shifter
;
1113 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1114 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1116 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1117 s3c2410_gpio_setpin(other_cs
, 1);
1121 static int gta02_lis302dl_bitbang_read_reg(struct lis302dl_info
*lis
, u8 reg
)
1123 u8 data
= 0xc0 | reg
; /* read, autoincrement */
1124 unsigned long flags
;
1126 local_irq_save(flags
);
1128 __gta02_lis302dl_bitbang(lis
, &data
, 1, &data
, 1);
1130 local_irq_restore(flags
);
1135 static void gta02_lis302dl_bitbang_write_reg(struct lis302dl_info
*lis
, u8 reg
,
1138 u8 data
[2] = { 0x00 | reg
, val
}; /* write, no autoincrement */
1139 unsigned long flags
;
1141 local_irq_save(flags
);
1143 __gta02_lis302dl_bitbang(lis
, &data
[0], 2, NULL
, 0);
1145 local_irq_restore(flags
);
1150 static void gta02_lis302dl_bitbang_sample(struct lis302dl_info
*lis
)
1152 u8 data
= 0xc0 | LIS302DL_REG_OUT_X
; /* read, autoincrement */
1154 unsigned long flags
;
1156 local_irq_save(flags
);
1158 __gta02_lis302dl_bitbang(lis
, &data
, 1, &read
[0], 5);
1160 local_irq_restore(flags
);
1162 input_report_rel(lis
->input_dev
, REL_X
, MG_PER_SAMPLE
* (s8
)read
[0]);
1163 input_report_rel(lis
->input_dev
, REL_Y
, MG_PER_SAMPLE
* (s8
)read
[2]);
1164 input_report_rel(lis
->input_dev
, REL_Z
, MG_PER_SAMPLE
* (s8
)read
[4]);
1166 input_sync(lis
->input_dev
);
1167 #ifdef DEBUG_SPEW_MS
1168 printk(KERN_INFO
"%s: %d %d %d\n", pdata
->name
, read
[0], read
[2],
1174 void gta02_lis302dl_suspend_io(struct lis302dl_info
*lis
, int resume
)
1176 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1180 * we don't want to power them with a high level
1181 * because GSENSOR_3V3 is not up during suspend
1183 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1184 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1185 s3c2410_gpio_setpin(pdata
->pin_mosi
, 0);
1186 /* misnomer: it is a pullDOWN in 2442 */
1187 s3c2410_gpio_pullup(pdata
->pin_miso
, 1);
1191 /* back to normal */
1192 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1193 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1194 /* misnomer: it is a pullDOWN in 2442 */
1195 s3c2410_gpio_pullup(pdata
->pin_miso
, 0);
1197 s3c2410_gpio_cfgpin(pdata
->pin_chip_select
, S3C2410_GPIO_OUTPUT
);
1198 s3c2410_gpio_cfgpin(pdata
->pin_clk
, S3C2410_GPIO_OUTPUT
);
1199 s3c2410_gpio_cfgpin(pdata
->pin_mosi
, S3C2410_GPIO_OUTPUT
);
1200 s3c2410_gpio_cfgpin(pdata
->pin_miso
, S3C2410_GPIO_INPUT
);
1206 struct lis302dl_platform_data lis302_pdata_top
= {
1207 .name
= "lis302-1 (top)",
1208 .pin_chip_select
= S3C2410_GPD12
,
1209 .pin_clk
= S3C2410_GPG7
,
1210 .pin_mosi
= S3C2410_GPG6
,
1211 .pin_miso
= S3C2410_GPG5
,
1212 .interrupt
= GTA02_IRQ_GSENSOR_1
,
1213 .open_drain
= 1, /* altered at runtime by PCB rev */
1214 .lis302dl_bitbang_read_sample
= gta02_lis302dl_bitbang_sample
,
1215 .lis302dl_bitbang_reg_read
= gta02_lis302dl_bitbang_read_reg
,
1216 .lis302dl_bitbang_reg_write
= gta02_lis302dl_bitbang_write_reg
,
1217 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1220 struct lis302dl_platform_data lis302_pdata_bottom
= {
1221 .name
= "lis302-2 (bottom)",
1222 .pin_chip_select
= S3C2410_GPD13
,
1223 .pin_clk
= S3C2410_GPG7
,
1224 .pin_mosi
= S3C2410_GPG6
,
1225 .pin_miso
= S3C2410_GPG5
,
1226 .interrupt
= GTA02_IRQ_GSENSOR_2
,
1227 .open_drain
= 1, /* altered at runtime by PCB rev */
1228 .lis302dl_bitbang_read_sample
= gta02_lis302dl_bitbang_sample
,
1229 .lis302dl_bitbang_reg_read
= gta02_lis302dl_bitbang_read_reg
,
1230 .lis302dl_bitbang_reg_write
= gta02_lis302dl_bitbang_write_reg
,
1231 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1235 static struct platform_device s3c_device_spi_acc1
= {
1239 .platform_data
= &lis302_pdata_top
,
1243 static struct platform_device s3c_device_spi_acc2
= {
1247 .platform_data
= &lis302_pdata_bottom
,
1251 static struct resource gta02_led_resources
[] = {
1253 .name
= "gta02-power:orange",
1254 .start
= GTA02_GPIO_PWR_LED1
,
1255 .end
= GTA02_GPIO_PWR_LED1
,
1257 .name
= "gta02-power:blue",
1258 .start
= GTA02_GPIO_PWR_LED2
,
1259 .end
= GTA02_GPIO_PWR_LED2
,
1261 .name
= "gta02-aux:red",
1262 .start
= GTA02_GPIO_AUX_LED
,
1263 .end
= GTA02_GPIO_AUX_LED
,
1267 struct platform_device gta02_led_dev
= {
1268 .name
= "gta02-led",
1269 .num_resources
= ARRAY_SIZE(gta02_led_resources
),
1270 .resource
= gta02_led_resources
,
1273 static struct resource gta02_button_resources
[] = {
1275 .start
= GTA02_GPIO_AUX_KEY
,
1276 .end
= GTA02_GPIO_AUX_KEY
,
1279 .start
= GTA02_GPIO_HOLD_KEY
,
1280 .end
= GTA02_GPIO_HOLD_KEY
,
1283 .start
= GTA02_GPIO_JACK_INSERT
,
1284 .end
= GTA02_GPIO_JACK_INSERT
,
1288 static struct platform_device gta02_button_dev
= {
1289 .name
= "neo1973-button",
1290 .num_resources
= ARRAY_SIZE(gta02_button_resources
),
1291 .resource
= gta02_button_resources
,
1294 static struct platform_device gta02_pm_gsm_dev
= {
1295 .name
= "neo1973-pm-gsm",
1298 static struct platform_device gta02_pm_usbhost_dev
= {
1299 .name
= "neo1973-pm-host",
1304 static struct s3c2410_hcd_info gta02_usb_info
= {
1306 .flags
= S3C_HCDFLG_USED
,
1313 static int glamo_irq_is_wired(void)
1319 * GTA02 S-Media IRQs prior to A5 are broken due to a lack of
1320 * a pullup on the INT# line. Check for the bad behaviour.
1322 s3c2410_gpio_setpin(S3C2410_GPG4
, 0);
1323 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_OUTP
);
1324 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_INP
);
1326 * we force it low ourselves for a moment and resume being input.
1327 * If there is a pullup, it won't stay low for long. But if the
1328 * level converter is there as on < A5 revision, the weak keeper
1329 * on the input of the LC will hold the line low indefinitiely
1332 rc
= s3c2410_gpio_getpin(S3C2410_GPG4
);
1333 while ((!rc
) && ((count
++) < 10));
1334 if (rc
) { /* it got pulled back up, it's good */
1335 printk(KERN_INFO
"Detected S-Media IRQ# pullup, "
1336 "enabling interrupt\n");
1338 } else /* Gah we can't work with this level converter */
1339 printk(KERN_WARNING
"** Detected bad IRQ# circuit found"
1340 " on pre-A5 GTA02: S-Media interrupt disabled **\n");
1346 gta02_glamo_mmc_set_power(unsigned char power_mode
, unsigned short vdd
)
1351 printk(KERN_DEBUG
"mmc_set_power(power_mode=%u, vdd=%u\n",
1354 switch (system_rev
) {
1355 case GTA02v1_SYSTEM_REV
:
1356 case GTA02v2_SYSTEM_REV
:
1358 case GTA02v3_SYSTEM_REV
:
1359 case GTA02v4_SYSTEM_REV
:
1360 case GTA02v5_SYSTEM_REV
:
1361 case GTA02v6_SYSTEM_REV
:
1362 switch (power_mode
) {
1365 /* depend on pcf50633 driver init + not suspended */
1366 while (pcf50633_ready(pcf50633_global
) && (timeout
--))
1370 printk(KERN_ERR
"gta02_glamo_mmc_set_power "
1371 "BAILING on timeout\n");
1374 /* select and set the voltage */
1376 mv
+= 350 + 100 * (vdd
- 8);
1377 printk(KERN_INFO
"SD power -> %dmV\n", mv
);
1378 pcf50633_voltage_set(pcf50633_global
,
1379 PCF50633_REGULATOR_HCLDO
, mv
);
1380 pcf50633_onoff_set(pcf50633_global
,
1381 PCF50633_REGULATOR_HCLDO
, 1);
1384 /* power off happens during suspend, when pcf50633 can
1385 * be already gone and not coming back... just forget
1386 * the action then because pcf50633 suspend already
1387 * dealt with it, otherwise we spin forever
1389 if (pcf50633_ready(pcf50633_global
))
1391 pcf50633_onoff_set(pcf50633_global
,
1392 PCF50633_REGULATOR_HCLDO
, 0);
1400 static int gta02_glamo_mci_all_dependencies_resumed(struct platform_device
*dev
)
1402 return resume_dep_glamo_mci_pcf
.called_flag
;
1405 /* register jbt resume action to be dependent on pcf50633 and glamo resume */
1407 static void gta02_glamo_mci_suspending(struct platform_device
*dev
)
1409 int glamo_mci_resume(struct platform_device
*dev
);
1411 #if defined(CONFIG_MFD_GLAMO_MCI) && defined(CONFIG_PM)
1412 resume_dep_glamo_mci_pcf
.callback
= (void (*)(void *))glamo_mci_resume
;
1413 resume_dep_glamo_mci_pcf
.context
= (void *)dev
;
1414 pcf50633_register_resume_dependency(pcf50633_global
,
1415 &resume_dep_glamo_mci_pcf
);
1421 /* Smedia Glamo 3362 */
1424 * we crank down SD Card clock dynamically when GPS is powered
1427 static int gta02_glamo_mci_use_slow(void)
1429 return neo1973_pm_gps_is_on();
1432 static struct glamofb_platform_data gta02_glamo_pdata
= {
1435 /* 24.5MHz --> 40.816ns */
1443 .fb_mem_size
= 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
1459 //.spi_info = &glamo_spi_cfg,
1460 .spigpio_info
= &glamo_spigpio_cfg
,
1462 /* glamo MMC function platform data */
1463 .glamo_set_mci_power
= gta02_glamo_mmc_set_power
,
1464 .glamo_mci_use_slow
= gta02_glamo_mci_use_slow
,
1465 .glamo_irq_is_wired
= glamo_irq_is_wired
,
1466 .mci_suspending
= gta02_glamo_mci_suspending
,
1467 .mci_all_dependencies_resumed
=
1468 gta02_glamo_mci_all_dependencies_resumed
,
1471 static struct resource gta02_glamo_resources
[] = {
1473 .start
= S3C2410_CS1
,
1474 .end
= S3C2410_CS1
+ 0x1000000 - 1,
1475 .flags
= IORESOURCE_MEM
,
1478 .start
= GTA02_IRQ_3D
,
1479 .end
= GTA02_IRQ_3D
,
1480 .flags
= IORESOURCE_IRQ
,
1483 .start
= GTA02v1_GPIO_3D_RESET
,
1484 .end
= GTA02v1_GPIO_3D_RESET
,
1488 static struct platform_device gta02_glamo_dev
= {
1489 .name
= "glamo3362",
1490 .num_resources
= ARRAY_SIZE(gta02_glamo_resources
),
1491 .resource
= gta02_glamo_resources
,
1493 .platform_data
= >a02_glamo_pdata
,
1497 static void mangle_glamo_res_by_system_rev(void)
1499 switch (system_rev
) {
1500 case GTA02v1_SYSTEM_REV
:
1503 gta02_glamo_resources
[2].start
= GTA02_GPIO_3D_RESET
;
1504 gta02_glamo_resources
[2].end
= GTA02_GPIO_3D_RESET
;
1508 switch (system_rev
) {
1509 case GTA02v1_SYSTEM_REV
:
1510 case GTA02v2_SYSTEM_REV
:
1511 case GTA02v3_SYSTEM_REV
:
1512 /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
1513 /* The hardware is missing a pull-up resistor and thus can't
1514 * support the Smedia Glamo IRQ */
1515 gta02_glamo_resources
[1].start
= 0;
1516 gta02_glamo_resources
[1].end
= 0;
1521 static void __init
gta02_map_io(void)
1523 s3c24xx_init_io(gta02_iodesc
, ARRAY_SIZE(gta02_iodesc
));
1524 s3c24xx_init_clocks(12000000);
1525 s3c24xx_init_uarts(gta02_uartcfgs
, ARRAY_SIZE(gta02_uartcfgs
));
1528 static irqreturn_t
gta02_modem_irq(int irq
, void *param
)
1530 printk(KERN_DEBUG
"modem wakeup interrupt\n");
1531 gta_gsm_interrupts
++;
1532 nspy_add(NSPY_TYPE_SPECIAL
, '*');
1536 static irqreturn_t
ar6000_wow_irq(int irq
, void *param
)
1538 printk(KERN_DEBUG
"ar6000_wow interrupt\n");
1545 static char hardware_ecc_str
[4] __initdata
= "";
1547 static int __init
hardware_ecc_setup(char *str
)
1550 strlcpy(hardware_ecc_str
, str
, sizeof(hardware_ecc_str
));
1554 __setup("hardware_ecc=", hardware_ecc_setup
);
1556 static void __init
gta02_machine_init(void)
1560 /* set the panic callback to make AUX blink fast */
1561 panic_blink
= gta02_panic_blink
;
1563 switch (system_rev
) {
1564 case GTA02v6_SYSTEM_REV
:
1565 /* we need push-pull interrupt from motion sensors */
1566 lis302_pdata_top
.open_drain
= 0;
1567 lis302_pdata_bottom
.open_drain
= 0;
1573 spin_lock_init(&motion_irq_lock
);
1575 /* do not force soft ecc if we are asked to use hardware_ecc */
1576 if (hardware_ecc_str
[0] == '1')
1577 gta02_nand_info
.software_ecc
= 0;
1579 s3c_device_usb
.dev
.platform_data
= >a02_usb_info
;
1580 s3c_device_nand
.dev
.platform_data
= >a02_nand_info
;
1581 s3c_device_sdi
.dev
.platform_data
= >a02_mmc_cfg
;
1583 /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not
1584 * hot-pluggable, this is not required anyway */
1585 switch (system_rev
) {
1586 case GTA02v1_SYSTEM_REV
:
1589 gta02_mmc_cfg
.gpio_detect
= 0;
1593 /* acc sensor chip selects */
1594 s3c2410_gpio_setpin(S3C2410_GPD12
, 1);
1595 s3c2410_gpio_cfgpin(S3C2410_GPD12
, S3C2410_GPIO_OUTPUT
);
1596 s3c2410_gpio_setpin(S3C2410_GPD13
, 1);
1597 s3c2410_gpio_cfgpin(S3C2410_GPD13
, S3C2410_GPIO_OUTPUT
);
1599 s3c24xx_udc_set_platdata(>a02_udc_cfg
);
1600 set_s3c2410ts_info(>a02_ts_cfg
);
1602 /* FIXME: hardcoded WLAN module power-up */
1603 s3c2410_gpio_cfgpin(GTA02_CHIP_PWD
, S3C2410_GPIO_OUTPUT
);
1606 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 1);
1609 switch (system_rev
) {
1610 case GTA02v1_SYSTEM_REV
:
1611 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 0);
1614 /* Chip is in reset state */
1615 s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET
, 0);
1616 s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET
, S3C2410_GPIO_OUTPUT
);
1619 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 0);
1621 /* Chip is out of reset */
1622 s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET
, 1);
1625 mangle_glamo_res_by_system_rev();
1626 platform_device_register(>a02_glamo_dev
);
1628 platform_device_register(&s3c_device_spi_acc1
);
1629 platform_device_register(&s3c_device_spi_acc2
);
1630 platform_device_register(>a02_button_dev
);
1631 platform_device_register(>a02_pm_gsm_dev
);
1632 platform_device_register(>a02_pm_usbhost_dev
);
1634 mangle_pmu_pdata_by_system_rev();
1635 platform_device_register(>a02_pmu_dev
);
1636 platform_device_register(>a02_vibrator_dev
);
1637 platform_device_register(>a02_led_dev
);
1640 platform_device_register(>a02_sdio_dev
);
1642 platform_add_devices(gta02_devices
, ARRAY_SIZE(gta02_devices
));
1644 #ifdef CONFIG_GTA02_HDQ
1645 switch (system_rev
) {
1646 case GTA02v5_SYSTEM_REV
:
1647 case GTA02v6_SYSTEM_REV
:
1648 platform_device_register(>a02_hdq_device
);
1649 platform_device_register(&bq27000_battery_device
);
1657 /* Make sure the modem can wake us up */
1658 set_irq_type(GTA02_IRQ_MODEM
, IRQT_RISING
);
1659 rc
= request_irq(GTA02_IRQ_MODEM
, gta02_modem_irq
, IRQF_DISABLED
,
1662 printk(KERN_ERR
"GTA02: can't request GSM modem wakeup IRQ\n");
1663 enable_irq_wake(GTA02_IRQ_MODEM
);
1665 /* Make sure the wifi module can wake us up*/
1666 set_irq_type(GTA02_IRQ_WLAN_GPIO1
, IRQT_RISING
);
1667 rc
= request_irq(GTA02_IRQ_WLAN_GPIO1
, ar6000_wow_irq
, IRQF_DISABLED
,
1671 printk(KERN_ERR
"GTA02: can't request ar6k wakeup IRQ\n");
1672 enable_irq_wake(GTA02_IRQ_WLAN_GPIO1
);
1675 MACHINE_START(NEO1973_GTA02
, "GTA02")
1676 .phys_io
= S3C2410_PA_UART
,
1677 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
1678 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
1679 .map_io
= gta02_map_io
,
1680 .init_irq
= s3c24xx_init_irq
,
1681 .init_machine
= gta02_machine_init
,
1682 .timer
= &s3c24xx_timer
,