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 <linux/jbt6k74.h>
81 #include <linux/glamofb.h>
83 #include <asm/arch/fiq_ipc_gta02.h>
84 #include "fiq_c_isr.h"
85 #include <linux/gta02_hdq.h>
86 #include <linux/bq27000_battery.h>
88 #include "../plat-s3c24xx/neo1973_pm_gps.h"
90 /* arbitrates which sensor IRQ owns the shared SPI bus */
91 static spinlock_t motion_irq_lock
;
93 /* the dependency of jbt / LCM on pcf50633 resume */
94 struct resume_dependency resume_dep_jbt_pcf
;
95 /* the dependency of jbt / LCM on glamo resume */
96 struct resume_dependency resume_dep_jbt_glamo
;
97 /* the dependency of Glamo MCI on pcf50633 resume (has to power SD slot) */
98 struct resume_dependency resume_dep_glamo_mci_pcf
;
101 static int gta02_charger_online_status
;
102 static int gta02_charger_active_status
;
104 /* define FIQ IPC struct */
106 * contains stuff FIQ ISR modifies and normal kernel code can see and use
107 * this is defined in <asm/arch/fiq_ipc_gta02.h>, you should customize
108 * the definition in there and include the same definition in your kernel
109 * module that wants to interoperate with your FIQ code.
111 struct fiq_ipc fiq_ipc
;
112 EXPORT_SYMBOL(fiq_ipc
);
114 #define DIVISOR_FROM_US(x) ((x) << 1)
116 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
118 #ifdef CONFIG_GTA02_HDQ
120 #define HDQ_SAMPLE_PERIOD_US 20
121 /* private HDQ FSM state -- all other info interesting for caller in fiq_ipc */
122 static enum hdq_bitbang_states hdq_state
;
126 static u8 hdq_shifter
;
127 static u8 hdq_tx_data_done
;
129 #define FIQ_DIVISOR_HDQ DIVISOR_FROM_US(HDQ_SAMPLE_PERIOD_US)
134 /* define your locals here -- no initializers though */
136 FIQ_HANDLER_ENTRY(256, 512)
137 /* Your ISR here :-) */
140 /* Vibrator servicing */
142 if (fiq_ipc
.vib_pwm_latched
|| fiq_ipc
.vib_pwm
) { /* not idle */
143 if (((u8
)_fiq_count_fiqs
) == fiq_ipc
.vib_pwm_latched
)
144 neo1973_gpb_setpin(fiq_ipc
.vib_gpio_pin
, 0);
145 if (((u8
)_fiq_count_fiqs
) == 0) {
146 fiq_ipc
.vib_pwm_latched
= fiq_ipc
.vib_pwm
;
147 if (fiq_ipc
.vib_pwm_latched
)
148 neo1973_gpb_setpin(fiq_ipc
.vib_gpio_pin
, 1);
150 divisor
= FIQ_DIVISOR_VIBRATOR
;
153 #ifdef CONFIG_GTA02_HDQ
158 if (fiq_ipc
.hdq_request_ctr
== fiq_ipc
.hdq_transaction_ctr
)
160 hdq_ctr
= 210 / HDQ_SAMPLE_PERIOD_US
;
161 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 0);
162 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_OUTPUT
);
163 hdq_tx_data_done
= 0;
164 hdq_state
= HDQB_TX_BREAK
;
167 case HDQB_TX_BREAK
: /* issue low for > 190us */
168 if (--hdq_ctr
== 0) {
169 hdq_ctr
= 60 / HDQ_SAMPLE_PERIOD_US
;
170 hdq_state
= HDQB_TX_BREAK_RECOVERY
;
171 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 1);
175 case HDQB_TX_BREAK_RECOVERY
: /* issue low for > 40us */
178 hdq_shifter
= fiq_ipc
.hdq_ads
;
179 hdq_bit
= 8; /* 8 bits of ads / rw */
180 hdq_tx_data_done
= 0; /* doing ads */
181 /* fallthru on last one */
184 hdq_ctr
= 50 / HDQ_SAMPLE_PERIOD_US
;
186 hdq_ctr
= 120 / HDQ_SAMPLE_PERIOD_US
;
187 /* carefully precompute the other phase length */
188 hdq_ctr2
= (210 - (hdq_ctr
* HDQ_SAMPLE_PERIOD_US
)) /
189 HDQ_SAMPLE_PERIOD_US
;
190 hdq_state
= HDQB_ADS_LOW
;
193 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 0);
199 s3c2410_gpio_setpin(fiq_ipc
.hdq_gpio_pin
, 1);
200 hdq_state
= HDQB_ADS_HIGH
;
204 if (--hdq_ctr2
> 1) /* account for HDQB_ADS_CALC */
206 if (hdq_bit
) { /* more bits to do */
207 hdq_state
= HDQB_ADS_CALC
;
210 /* no more bits, wait it out until hdq_ctr2 exhausted */
213 /* ok no more bits and very last state */
214 hdq_ctr
= 60 / HDQ_SAMPLE_PERIOD_US
;
216 if (fiq_ipc
.hdq_ads
& 0x80) { /* write the byte out */
217 /* set delay before payload */
218 hdq_ctr
= 300 / HDQ_SAMPLE_PERIOD_US
;
219 /* already high, no need to write */
220 hdq_state
= HDQB_WAIT_TX
;
223 /* read the next byte */
224 hdq_bit
= 8; /* 8 bits of data */
225 hdq_ctr
= 3000 / HDQ_SAMPLE_PERIOD_US
;
226 hdq_state
= HDQB_WAIT_RX
;
227 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_INPUT
);
230 case HDQB_WAIT_TX
: /* issue low for > 40us */
233 if (!hdq_tx_data_done
) { /* was that the data sent? */
235 hdq_shifter
= fiq_ipc
.hdq_tx_data
;
236 hdq_bit
= 8; /* 8 bits of data */
237 hdq_state
= HDQB_ADS_CALC
; /* start sending */
240 fiq_ipc
.hdq_error
= 0;
241 fiq_ipc
.hdq_transaction_ctr
++;
242 hdq_state
= HDQB_IDLE
; /* all tx is done */
243 /* idle in input mode, it's pulled up by 10K */
244 s3c2410_gpio_cfgpin(fiq_ipc
.hdq_gpio_pin
, S3C2410_GPIO_INPUT
);
247 case HDQB_WAIT_RX
: /* wait for battery to talk to us */
248 if (s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
) == 0) {
249 /* it talks to us! */
251 hdq_bit
= 8; /* 8 bits of data */
253 hdq_ctr
= 300 / HDQ_SAMPLE_PERIOD_US
;
254 hdq_state
= HDQB_DATA_RX_LOW
;
257 if (--hdq_ctr
== 0) { /* timed out, error */
258 fiq_ipc
.hdq_error
= 1;
259 fiq_ipc
.hdq_transaction_ctr
++;
260 hdq_state
= HDQB_IDLE
; /* abort */
265 * HDQ basically works by measuring the low time of the bit cell
266 * 32-50us --> '1', 80 - 145us --> '0'
269 case HDQB_DATA_RX_LOW
:
270 if (s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
)) {
271 fiq_ipc
.hdq_rx_data
>>= 1;
272 if (hdq_ctr2
<= (65 / HDQ_SAMPLE_PERIOD_US
))
273 fiq_ipc
.hdq_rx_data
|= 0x80;
275 if (--hdq_bit
== 0) {
276 fiq_ipc
.hdq_error
= 0;
277 fiq_ipc
.hdq_transaction_ctr
++; /* done */
278 hdq_state
= HDQB_IDLE
;
280 hdq_state
= HDQB_DATA_RX_HIGH
;
282 hdq_ctr
= 1000 / HDQ_SAMPLE_PERIOD_US
;
289 /* timed out, error */
290 fiq_ipc
.hdq_error
= 2;
291 fiq_ipc
.hdq_transaction_ctr
++;
292 hdq_state
= HDQB_IDLE
; /* abort */
295 case HDQB_DATA_RX_HIGH
:
296 if (!s3c2410_gpio_getpin(fiq_ipc
.hdq_gpio_pin
)) {
297 /* it talks to us! */
300 hdq_ctr
= 400 / HDQ_SAMPLE_PERIOD_US
;
301 hdq_state
= HDQB_DATA_RX_LOW
;
306 /* timed out, error */
307 fiq_ipc
.hdq_error
= 3;
308 fiq_ipc
.hdq_transaction_ctr
++;
309 /* we're in input mode already */
310 hdq_state
= HDQB_IDLE
; /* abort */
314 if (hdq_state
!= HDQB_IDLE
) /* ie, not idle */
315 if (divisor
> FIQ_DIVISOR_HDQ
)
316 divisor
= FIQ_DIVISOR_HDQ
; /* keep us going */
319 /* disable further timer interrupts if nobody has any work
320 * or adjust rate according to who still has work
322 * CAUTION: it means forground code must disable FIQ around
323 * its own non-atomic S3C2410_INTMSK changes... not common
324 * thankfully and taken care of by the fiq-basis patch
326 if (divisor
== 0xffff) /* mask the fiq irq source */
327 __raw_writel(__raw_readl(S3C2410_INTMSK
) | _fiq_ack_mask
,
329 else /* still working, maybe at a different rate */
330 __raw_writel(divisor
, S3C2410_TCNTB(_fiq_timer_index
));
331 _fiq_timer_divisor
= divisor
;
337 * this gets called every 1ms when we paniced.
340 static long gta02_panic_blink(long count
)
343 static long last_blink
;
346 if (count
- last_blink
< 100) /* 200ms period, fast blink */
350 s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED
, S3C2410_GPIO_OUTPUT
);
351 neo1973_gpb_setpin(GTA02_GPIO_AUX_LED
, led
);
359 * returns PCB revision information in b9,b8 and b2,b1,b0
360 * Pre-GTA02 A6 returns 0x000
361 * GTA02 A6 returns 0x101
365 int gta02_get_pcb_revision(void)
369 static unsigned long pinlist
[] = {
376 static int pin_offset
[] = {
380 for (n
= 0 ; n
< ARRAY_SIZE(pinlist
); n
++) {
382 * set the PCB version GPIO to be pulled-down input
383 * force low briefly first
385 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
386 s3c2410_gpio_setpin(pinlist
[n
], 0);
387 /* misnomer: it is a pullDOWN in 2442 */
388 s3c2410_gpio_pullup(pinlist
[n
], 1);
389 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_INPUT
);
393 if (s3c2410_gpio_getpin(pinlist
[n
]))
394 u
|= 1 << pin_offset
[n
];
397 * when not being interrogated, all of the revision GPIO
398 * are set to output HIGH without pulldown so no current flows
399 * if they are NC or pulled up.
401 s3c2410_gpio_setpin(pinlist
[n
], 1);
402 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
403 /* misnomer: it is a pullDOWN in 2442 */
404 s3c2410_gpio_pullup(pinlist
[n
], 0);
410 struct platform_device gta02_version_device
= {
411 .name
= "neo1973-version",
415 struct platform_device gta02_resume_reason_device
= {
416 .name
= "neo1973-resume",
420 struct platform_device gta02_memconfig_device
= {
421 .name
= "neo1973-memconfig",
425 static struct map_desc gta02_iodesc
[] __initdata
= {
427 .virtual = 0xe0000000,
428 .pfn
= __phys_to_pfn(S3C2410_CS3
+0x01000000),
434 #define UCON S3C2410_UCON_DEFAULT
435 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
436 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
438 static struct s3c2410_uartcfg gta02_uartcfgs
[] = {
463 /* BQ27000 Battery */
465 static int gta02_get_charger_online_status(void)
467 return gta02_charger_online_status
;
470 static int gta02_get_charger_active_status(void)
472 return gta02_charger_active_status
;
476 struct bq27000_platform_data bq27000_pdata
= {
479 .hdq_read
= gta02hdq_read
,
480 .hdq_write
= gta02hdq_write
,
481 .hdq_initialized
= gta02hdq_initialized
,
482 .get_charger_online_status
= gta02_get_charger_online_status
,
483 .get_charger_active_status
= gta02_get_charger_active_status
486 struct platform_device bq27000_battery_device
= {
487 .name
= "bq27000-battery",
489 .platform_data
= &bq27000_pdata
,
494 /* PMU driver info */
496 static int pmu_callback(struct device
*dev
, unsigned int feature
,
497 enum pmu_event event
)
500 case PCF50633_FEAT_MBC
:
502 case PMU_EVT_CHARGER_IDLE
:
503 gta02_charger_active_status
= 0;
505 case PMU_EVT_CHARGER_ACTIVE
:
506 gta02_charger_active_status
= 1;
508 case PMU_EVT_USB_INSERT
:
509 gta02_charger_online_status
= 1;
511 case PMU_EVT_USB_REMOVE
:
512 gta02_charger_online_status
= 0;
514 case PMU_EVT_INSERT
: /* adapter is unsused */
515 case PMU_EVT_REMOVE
: /* adapter is unused */
525 bq27000_charging_state_change(&bq27000_battery_device
);
529 static struct platform_device gta01_pm_gps_dev
= {
530 .name
= "neo1973-pm-gps",
533 static struct platform_device gta01_pm_bt_dev
= {
534 .name
= "neo1973-pm-bt",
537 /* this is called when pc50633 is probed, unfortunately quite late in the
538 * day since it is an I2C bus device. Here we can belatedly define some
539 * platform devices with the advantage that we can mark the pcf50633 as the
540 * parent. This makes them get suspended and resumed with their parent
541 * the pcf50633 still around.
544 static void gta02_pcf50633_attach_child_devices(struct device
*parent_device
)
546 gta01_pm_gps_dev
.dev
.parent
= parent_device
;
547 gta01_pm_bt_dev
.dev
.parent
= parent_device
;
548 platform_device_register(>a01_pm_bt_dev
);
549 platform_device_register(>a01_pm_gps_dev
);
552 static struct pcf50633_platform_data gta02_pcf_pdata
= {
553 .used_features
= PCF50633_FEAT_MBC
|
556 PCF50633_FEAT_CHGCUR
|
557 PCF50633_FEAT_BATVOLT
|
558 PCF50633_FEAT_BATTEMP
|
559 PCF50633_FEAT_PWM_BL
,
560 .onkey_seconds_sig_init
= 4,
561 .onkey_seconds_shutdown
= 8,
564 .r_fix_batt_par
= 10000,
565 .r_sense_milli
= 220,
566 .flag_use_apm_emulation
= 0,
568 [0] = PCF50633_INT1_USBINS
|
569 PCF50633_INT1_USBREM
|
571 [1] = PCF50633_INT2_ONKEYF
,
572 [2] = PCF50633_INT3_ONKEY1S
574 /* warning: these get rewritten during machine init below
575 * depending on pcb variant
578 [PCF50633_REGULATOR_AUTO
] = {
580 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
586 [PCF50633_REGULATOR_DOWN1
] = {
588 /* Wow, when we are going into suspend, after pcf50633
589 * runs its suspend (which happens real early since it
590 * is an i2c device) we are running out of the 22uF cap
591 * on core_1v3 rail !!!!
598 [PCF50633_REGULATOR_DOWN2
] = {
600 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
606 [PCF50633_REGULATOR_HCLDO
] = {
613 [PCF50633_REGULATOR_LDO1
] = {
614 .name
= "gsensor_3v3",
620 [PCF50633_REGULATOR_LDO2
] = {
627 [PCF50633_REGULATOR_LDO3
] = {
634 [PCF50633_REGULATOR_LDO4
] = {
641 [PCF50633_REGULATOR_LDO5
] = {
648 [PCF50633_REGULATOR_LDO6
] = {
650 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
656 [PCF50633_REGULATOR_MEMLDO
] = {
658 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
665 .defer_resume_backlight
= 1,
666 .resume_backlight_ramp_speed
= 5,
667 .attach_child_devices
= gta02_pcf50633_attach_child_devices
671 #if 0 /* currently unused */
672 static void cfg_pmu_vrail(struct pmu_voltage_rail
*vrail
, char *name
,
673 unsigned int flags
, unsigned int init
,
677 vrail
->flags
= flags
;
678 vrail
->voltage
.init
= init
;
679 vrail
->voltage
.max
= max
;
683 static void mangle_pmu_pdata_by_system_rev(void)
685 switch (system_rev
) {
686 case GTA02v1_SYSTEM_REV
:
687 /* FIXME: this is only in v1 due to wrong PMU variant */
688 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].flags
=
689 PMU_VRAIL_F_SUSPEND_ON
;
691 case GTA02v2_SYSTEM_REV
:
692 case GTA02v3_SYSTEM_REV
:
693 case GTA02v4_SYSTEM_REV
:
694 case GTA02v5_SYSTEM_REV
:
695 case GTA02v6_SYSTEM_REV
:
696 /* we need to keep the 1.8V going since this is the SDRAM
697 * self-refresh voltage */
698 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].flags
=
699 PMU_VRAIL_F_SUSPEND_ON
;
700 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_DOWN2
].name
=
702 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].name
=
704 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].voltage
.init
=
706 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].voltage
.max
=
708 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO1
].flags
&=
709 ~PMU_VRAIL_F_SUSPEND_ON
;
710 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO3
].flags
=
712 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO5
] = ((struct pmu_voltage_rail
) {
719 gta02_pcf_pdata
.rails
[PCF50633_REGULATOR_LDO6
] =
720 ((struct pmu_voltage_rail
) {
722 .flags
= PMU_VRAIL_F_SUSPEND_ON
,
734 static struct resource gta02_pmu_resources
[] = {
736 .flags
= IORESOURCE_IRQ
,
737 .start
= GTA02_IRQ_PCF50633
,
738 .end
= GTA02_IRQ_PCF50633
,
742 struct platform_device gta02_pmu_dev
= {
744 .num_resources
= ARRAY_SIZE(gta02_pmu_resources
),
745 .resource
= gta02_pmu_resources
,
747 .platform_data
= >a02_pcf_pdata
,
753 static struct resource sc32440_fiq_resources
[] = {
755 .flags
= IORESOURCE_IRQ
,
761 struct platform_device sc32440_fiq_device
= {
762 .name
= "sc32440_fiq",
764 .resource
= sc32440_fiq_resources
,
767 #ifdef CONFIG_GTA02_HDQ
770 static struct resource gta02_hdq_resources
[] = {
772 .start
= GTA02v5_GPIO_HDQ
,
773 .end
= GTA02v5_GPIO_HDQ
,
777 struct platform_device gta02_hdq_device
= {
780 .resource
= gta02_hdq_resources
,
787 #define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
788 #define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */
790 static struct physmap_flash_data gta02_nor_flash_data
= {
794 static struct resource gta02_nor_flash_resource
= {
795 .start
= GTA02_FLASH_BASE
,
796 .end
= GTA02_FLASH_BASE
+ GTA02_FLASH_SIZE
- 1,
797 .flags
= IORESOURCE_MEM
,
800 static struct platform_device gta02_nor_flash
= {
801 .name
= "physmap-flash",
804 .platform_data
= >a02_nor_flash_data
,
806 .resource
= >a02_nor_flash_resource
,
812 static struct resource gta02_sdio_resources
[] = {
814 .flags
= IORESOURCE_IRQ
,
819 .flags
= IORESOURCE_MEM
,
820 .start
= S3C2410_PA_SDI
,
821 .end
= S3C2410_PA_SDI
+ S3C24XX_SZ_SDI
- 1,
824 .flags
= IORESOURCE_DMA
,
825 .start
= 0, /* Channel 0 for SDI */
831 static struct platform_device gta02_sdio_dev
= {
832 .name
= "s3c24xx-sdio",
835 .coherent_dma_mask
= 0xffffffff,
837 .resource
= gta02_sdio_resources
,
838 .num_resources
= ARRAY_SIZE(gta02_sdio_resources
),
841 struct platform_device s3c24xx_pwm_device
= {
842 .name
= "s3c24xx_pwm",
847 static struct platform_device
*gta02_devices
[] __initdata
= {
852 // &s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
853 &s3c_device_usbgadget
,
858 >a02_version_device
,
859 >a02_memconfig_device
,
860 >a02_resume_reason_device
,
865 static struct s3c2410_nand_set gta02_nand_sets
[] = {
867 .name
= "neo1973-nand",
869 .flags
= S3C2410_NAND_BBT
,
873 /* choose a set of timings which should suit most 512Mbit
877 static struct s3c2410_platform_nand gta02_nand_info
= {
881 .nr_sets
= ARRAY_SIZE(gta02_nand_sets
),
882 .sets
= gta02_nand_sets
,
885 static struct s3c24xx_mci_pdata gta02_mmc_cfg
= {
886 .gpio_detect
= GTA02v1_GPIO_nSD_DETECT
,
888 .ocr_avail
= MMC_VDD_32_33
,
891 static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd
)
893 printk(KERN_DEBUG
"%s(%d)\n", __func__
, cmd
);
896 case S3C2410_UDC_P_ENABLE
:
897 neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 1);
899 case S3C2410_UDC_P_DISABLE
:
900 neo1973_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 0);
902 case S3C2410_UDC_P_RESET
:
910 /* get PMU to set USB current limit accordingly */
912 static void gta02_udc_vbus_draw(unsigned int ma
)
914 if (!pcf50633_global
)
917 pcf50633_notify_usb_current_limit_change(pcf50633_global
, ma
);
920 static struct s3c2410_udc_mach_info gta02_udc_cfg
= {
921 .vbus_draw
= gta02_udc_vbus_draw
,
922 .udc_command
= gta02_udc_command
,
926 static struct s3c2410_ts_mach_info gta02_ts_cfg
= {
928 .presc
= 50000000 / 1000000, /* 50 MHz PCLK / 1MHz */
929 /* simple averaging, 2^n samples */
930 .oversampling_shift
= 5,
931 /* averaging filter length, 2^n */
932 .excursion_filter_len_bits
= 5,
933 /* flagged for beauty contest on next sample if differs from
934 * average more than this
936 .reject_threshold_vs_avg
= 2,
940 /* SPI: LCM control interface attached to Glamo3362 */
942 static void gta02_jbt6k74_reset(int devidx
, int level
)
944 glamo_lcm_reset(level
);
947 /* finally bring up deferred backlight resume now LCM is resumed itself */
949 static void gta02_jbt6k74_resuming(int devidx
)
951 pcf50633_backlight_resume(pcf50633_global
);
954 static int gta02_jbt6k74_all_dependencies_resumed(int devidx
)
956 if (!resume_dep_jbt_pcf
.called_flag
)
959 if (!resume_dep_jbt_glamo
.called_flag
)
965 /* register jbt resume action to be dependent on pcf50633 and glamo resume */
967 static void gta02_jbt6k74_suspending(int devindex
, struct spi_device
*spi
)
969 void jbt6k74_resume(void *spi
); /* little white lies about types */
971 resume_dep_jbt_pcf
.callback
= jbt6k74_resume
;
972 resume_dep_jbt_pcf
.context
= (void *)spi
;
973 pcf50633_register_resume_dependency(pcf50633_global
,
974 &resume_dep_jbt_pcf
);
975 resume_dep_jbt_glamo
.callback
= jbt6k74_resume
;
976 resume_dep_jbt_glamo
.context
= (void *)spi
;
977 glamo_register_resume_dependency(&resume_dep_jbt_glamo
);
981 const struct jbt6k74_platform_data jbt6k74_pdata
= {
982 .reset
= gta02_jbt6k74_reset
,
983 .resuming
= gta02_jbt6k74_resuming
,
984 .suspending
= gta02_jbt6k74_suspending
,
985 .all_dependencies_resumed
= gta02_jbt6k74_all_dependencies_resumed
,
988 static struct spi_board_info gta02_spi_board_info
[] = {
990 .modalias
= "jbt6k74",
992 .platform_data
= &jbt6k74_pdata
,
993 /* controller_data */
995 .max_speed_hz
= 10 * 1000 * 1000,
1001 #if 0 /* currently this is not used and we use gpio spi */
1002 static struct glamo_spi_info glamo_spi_cfg
= {
1003 .board_size
= ARRAY_SIZE(gta02_spi_board_info
),
1004 .board_info
= gta02_spi_board_info
,
1008 static struct glamo_spigpio_info glamo_spigpio_cfg
= {
1009 .pin_clk
= GLAMO_GPIO10_OUTPUT
,
1010 .pin_mosi
= GLAMO_GPIO11_OUTPUT
,
1011 .pin_cs
= GLAMO_GPIO12_OUTPUT
,
1013 .board_size
= ARRAY_SIZE(gta02_spi_board_info
),
1014 .board_info
= gta02_spi_board_info
,
1017 static struct resource gta02_vibrator_resources
[] = {
1019 .start
= GTA02_GPIO_VIBRATOR_ON
,
1020 .end
= GTA02_GPIO_VIBRATOR_ON
,
1024 static struct platform_device gta02_vibrator_dev
= {
1025 .name
= "neo1973-vibrator",
1026 .num_resources
= ARRAY_SIZE(gta02_vibrator_resources
),
1027 .resource
= gta02_vibrator_resources
,
1030 /* SPI: Accelerometers attached to SPI of s3c244x */
1033 * Situation is that Linux SPI can't work in an interrupt context, so we
1034 * implement our own bitbang here. Arbitration is needed because not only
1035 * can this interrupt happen at any time even if foreground wants to use
1036 * the bitbang API from Linux, but multiple motion sensors can be on the
1037 * same SPI bus, and multiple interrupts can happen.
1039 * Foreground / interrupt arbitration is okay because the interrupts are
1040 * disabled around all the foreground SPI code.
1042 * Interrupt / Interrupt arbitration is evidently needed, otherwise we
1043 * lose edge-triggered service after a while due to the two sensors sharing
1044 * the SPI bus having irqs at the same time eventually.
1046 * Servicing is typ 75 - 100us at 400MHz.
1049 /* #define DEBUG_SPEW_MS */
1050 #define MG_PER_SAMPLE 18
1052 struct lis302dl_platform_data lis302_pdata
[];
1054 void gat02_lis302dl_bitbang_read(struct lis302dl_info
*lis
)
1056 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1057 u8 shifter
= 0xc0 | LIS302DL_REG_OUT_X
; /* read, autoincrement */
1059 unsigned long other_cs
;
1060 unsigned long flags
;
1061 #ifdef DEBUG_SPEW_MS
1065 local_save_flags(flags
);
1068 * Huh.. "quirk"... CS on this device is not really "CS" like you can
1069 * expect. Instead when 1 it selects I2C interface mode. Because we
1070 * have 2 devices on one interface, the "disabled" device when we talk
1071 * to an "enabled" device sees the clocks as I2C clocks, creating
1073 * I2C sees MOSI going LOW while CLK HIGH as a START action, we must
1074 * ensure this is never issued.
1077 if (&lis302_pdata
[0] == pdata
)
1078 other_cs
= lis302_pdata
[1].pin_chip_select
;
1080 other_cs
= lis302_pdata
[0].pin_chip_select
;
1082 s3c2410_gpio_setpin(other_cs
, 1);
1083 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1084 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1085 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1086 for (n
= 0; n
< 8; n
++) { /* write the r/w, inc and address */
1087 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1088 s3c2410_gpio_setpin(pdata
->pin_mosi
, (shifter
>> 7) & 1);
1089 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1090 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1091 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1095 for (n
= 0; n
< 5; n
++) { /* 5 consequetive registers */
1096 for (n1
= 0; n1
< 8; n1
++) { /* 8 bits each */
1097 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1098 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1100 if (s3c2410_gpio_getpin(pdata
->pin_miso
))
1102 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1103 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1107 #ifdef DEBUG_SPEW_MS
1110 input_report_rel(lis
->input_dev
, REL_X
, MG_PER_SAMPLE
* (s8
)shifter
);
1113 #ifdef DEBUG_SPEW_MS
1116 input_report_rel(lis
->input_dev
, REL_Y
, MG_PER_SAMPLE
* (s8
)shifter
);
1119 #ifdef DEBUG_SPEW_MS
1122 input_report_rel(lis
->input_dev
, REL_Z
, MG_PER_SAMPLE
* (s8
)shifter
);
1126 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1127 s3c2410_gpio_setpin(other_cs
, 1);
1128 local_irq_restore(flags
);
1130 input_sync(lis
->input_dev
);
1131 #ifdef DEBUG_SPEW_MS
1132 printk("%s: %d %d %d\n", pdata
->name
, x
, y
, z
);
1137 void gat02_lis302dl_suspend_io(struct lis302dl_info
*lis
, int resume
)
1139 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1143 * we don't want to power them with a high level
1144 * because GSENSOR_3V3 is not up during suspend
1146 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1147 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1148 s3c2410_gpio_setpin(pdata
->pin_mosi
, 0);
1149 /* misnomer: it is a pullDOWN in 2442 */
1150 s3c2410_gpio_pullup(pdata
->pin_miso
, 1);
1154 /* back to normal */
1155 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1156 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1157 /* misnomer: it is a pullDOWN in 2442 */
1158 s3c2410_gpio_pullup(pdata
->pin_miso
, 0);
1161 struct lis302dl_platform_data lis302_pdata
[] = {
1163 .name
= "lis302-1 (top)",
1164 .pin_chip_select
= S3C2410_GPD12
,
1165 .pin_clk
= S3C2410_GPG7
,
1166 .pin_mosi
= S3C2410_GPG6
,
1167 .pin_miso
= S3C2410_GPG5
,
1168 .open_drain
= 1, /* altered at runtime by PCB rev */
1169 .lis302dl_bitbang_read
= gat02_lis302dl_bitbang_read
,
1170 .lis302dl_suspend_io
= gat02_lis302dl_suspend_io
,
1172 .name
= "lis302-2 (bottom)",
1173 .pin_chip_select
= S3C2410_GPD13
,
1174 .pin_clk
= S3C2410_GPG7
,
1175 .pin_mosi
= S3C2410_GPG6
,
1176 .pin_miso
= S3C2410_GPG5
,
1177 .open_drain
= 1, /* altered at runtime by PCB rev */
1178 .lis302dl_bitbang_read
= gat02_lis302dl_bitbang_read
,
1179 .lis302dl_suspend_io
= gat02_lis302dl_suspend_io
,
1183 static struct spi_board_info gta02_spi_acc_bdinfo
[] = {
1185 .modalias
= "lis302dl",
1186 .platform_data
= &lis302_pdata
[0],
1187 .irq
= GTA02_IRQ_GSENSOR_1
,
1188 .max_speed_hz
= 10 * 1000 * 1000,
1194 .modalias
= "lis302dl",
1195 .platform_data
= &lis302_pdata
[1],
1196 .irq
= GTA02_IRQ_GSENSOR_2
,
1197 .max_speed_hz
= 10 * 1000 * 1000,
1204 static void spi_acc_cs(struct s3c2410_spigpio_info
*spigpio_info
,
1207 struct lis302dl_platform_data
* plat_data
=
1208 (struct lis302dl_platform_data
*)spigpio_info
->
1209 board_info
->platform_data
;
1211 case BITBANG_CS_ACTIVE
:
1212 s3c2410_gpio_setpin(plat_data
[csid
].pin_chip_select
, 0);
1214 case BITBANG_CS_INACTIVE
:
1215 s3c2410_gpio_setpin(plat_data
[csid
].pin_chip_select
, 1);
1220 static struct s3c2410_spigpio_info spi_gpio_cfg
= {
1221 .pin_clk
= S3C2410_GPG7
,
1222 .pin_mosi
= S3C2410_GPG6
,
1223 .pin_miso
= S3C2410_GPG5
,
1224 .board_size
= ARRAY_SIZE(gta02_spi_acc_bdinfo
),
1225 .board_info
= gta02_spi_acc_bdinfo
,
1226 .chip_select
= &spi_acc_cs
,
1227 .num_chipselect
= 2,
1230 static struct resource s3c_spi_acc_resource
[] = {
1232 .start
= S3C2410_GPG3
,
1233 .end
= S3C2410_GPG3
,
1236 .start
= S3C2410_GPG5
,
1237 .end
= S3C2410_GPG5
,
1240 .start
= S3C2410_GPG6
,
1241 .end
= S3C2410_GPG6
,
1244 .start
= S3C2410_GPG7
,
1245 .end
= S3C2410_GPG7
,
1249 static struct platform_device s3c_device_spi_acc
= {
1250 .name
= "spi_s3c24xx_gpio",
1252 .num_resources
= ARRAY_SIZE(s3c_spi_acc_resource
),
1253 .resource
= s3c_spi_acc_resource
,
1255 .platform_data
= &spi_gpio_cfg
,
1259 static struct resource gta02_led_resources
[] = {
1261 .name
= "gta02-power:orange",
1262 .start
= GTA02_GPIO_PWR_LED1
,
1263 .end
= GTA02_GPIO_PWR_LED1
,
1265 .name
= "gta02-power:blue",
1266 .start
= GTA02_GPIO_PWR_LED2
,
1267 .end
= GTA02_GPIO_PWR_LED2
,
1269 .name
= "gta02-aux:red",
1270 .start
= GTA02_GPIO_AUX_LED
,
1271 .end
= GTA02_GPIO_AUX_LED
,
1275 struct platform_device gta02_led_dev
= {
1276 .name
= "gta02-led",
1277 .num_resources
= ARRAY_SIZE(gta02_led_resources
),
1278 .resource
= gta02_led_resources
,
1281 static struct resource gta02_button_resources
[] = {
1283 .start
= GTA02_GPIO_AUX_KEY
,
1284 .end
= GTA02_GPIO_AUX_KEY
,
1287 .start
= GTA02_GPIO_HOLD_KEY
,
1288 .end
= GTA02_GPIO_HOLD_KEY
,
1291 .start
= GTA02_GPIO_JACK_INSERT
,
1292 .end
= GTA02_GPIO_JACK_INSERT
,
1296 static struct platform_device gta02_button_dev
= {
1297 .name
= "neo1973-button",
1298 .num_resources
= ARRAY_SIZE(gta02_button_resources
),
1299 .resource
= gta02_button_resources
,
1302 static struct platform_device gta02_pm_gsm_dev
= {
1303 .name
= "neo1973-pm-gsm",
1306 static struct platform_device gta02_pm_usbhost_dev
= {
1307 .name
= "neo1973-pm-host",
1312 static struct s3c2410_hcd_info gta02_usb_info
= {
1314 .flags
= S3C_HCDFLG_USED
,
1321 static int glamo_irq_is_wired(void)
1327 * GTA02 S-Media IRQs prior to A5 are broken due to a lack of
1328 * a pullup on the INT# line. Check for the bad behaviour.
1330 s3c2410_gpio_setpin(S3C2410_GPG4
, 0);
1331 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_OUTP
);
1332 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_INP
);
1334 * we force it low ourselves for a moment and resume being input.
1335 * If there is a pullup, it won't stay low for long. But if the
1336 * level converter is there as on < A5 revision, the weak keeper
1337 * on the input of the LC will hold the line low indefinitiely
1340 rc
= s3c2410_gpio_getpin(S3C2410_GPG4
);
1341 while ((!rc
) && ((count
++) < 10));
1342 if (rc
) { /* it got pulled back up, it's good */
1343 printk(KERN_INFO
"Detected S-Media IRQ# pullup, "
1344 "enabling interrupt\n");
1346 } else /* Gah we can't work with this level converter */
1347 printk(KERN_WARNING
"** Detected bad IRQ# circuit found"
1348 " on pre-A5 GTA02: S-Media interrupt disabled **\n");
1354 gta02_glamo_mmc_set_power(unsigned char power_mode
, unsigned short vdd
)
1359 printk(KERN_DEBUG
"mmc_set_power(power_mode=%u, vdd=%u\n",
1362 switch (system_rev
) {
1363 case GTA02v1_SYSTEM_REV
:
1364 case GTA02v2_SYSTEM_REV
:
1366 case GTA02v3_SYSTEM_REV
:
1367 case GTA02v4_SYSTEM_REV
:
1368 case GTA02v5_SYSTEM_REV
:
1369 case GTA02v6_SYSTEM_REV
:
1370 switch (power_mode
) {
1373 /* depend on pcf50633 driver init + not suspended */
1374 while (pcf50633_ready(pcf50633_global
) && (timeout
--))
1378 printk(KERN_ERR
"gta02_glamo_mmc_set_power "
1379 "BAILING on timeout\n");
1382 /* select and set the voltage */
1384 mv
+= 350 + 100 * (vdd
- 8);
1385 printk(KERN_INFO
"SD power -> %dmV\n", mv
);
1386 pcf50633_voltage_set(pcf50633_global
,
1387 PCF50633_REGULATOR_HCLDO
, mv
);
1388 pcf50633_onoff_set(pcf50633_global
,
1389 PCF50633_REGULATOR_HCLDO
, 1);
1392 /* power off happens during suspend, when pcf50633 can
1393 * be already gone and not coming back... just forget
1394 * the action then because pcf50633 suspend already
1395 * dealt with it, otherwise we spin forever
1397 if (pcf50633_ready(pcf50633_global
))
1399 pcf50633_onoff_set(pcf50633_global
,
1400 PCF50633_REGULATOR_HCLDO
, 0);
1408 static int gta02_glamo_mci_all_dependencies_resumed(struct platform_device
*dev
)
1410 return resume_dep_glamo_mci_pcf
.called_flag
;
1413 /* register jbt resume action to be dependent on pcf50633 and glamo resume */
1415 static void gta02_glamo_mci_suspending(struct platform_device
*dev
)
1417 void glamo_mci_resume(void *dev
); /* little white lies about types */
1419 resume_dep_glamo_mci_pcf
.callback
= glamo_mci_resume
;
1420 resume_dep_glamo_mci_pcf
.context
= (void *)dev
;
1421 pcf50633_register_resume_dependency(pcf50633_global
,
1422 &resume_dep_glamo_mci_pcf
);
1427 /* Smedia Glamo 3362 */
1430 * we crank down SD Card clock dynamically when GPS is powered
1433 static int gta02_glamo_mci_use_slow(void)
1435 return neo1973_pm_gps_is_on();
1438 static struct glamofb_platform_data gta02_glamo_pdata
= {
1441 /* 24.5MHz --> 40.816ns */
1449 .fb_mem_size
= 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
1465 //.spi_info = &glamo_spi_cfg,
1466 .spigpio_info
= &glamo_spigpio_cfg
,
1468 /* glamo MMC function platform data */
1469 .glamo_set_mci_power
= gta02_glamo_mmc_set_power
,
1470 .glamo_mci_use_slow
= gta02_glamo_mci_use_slow
,
1471 .glamo_irq_is_wired
= glamo_irq_is_wired
,
1472 .mci_suspending
= gta02_glamo_mci_suspending
,
1473 .mci_all_dependencies_resumed
=
1474 gta02_glamo_mci_all_dependencies_resumed
,
1477 static struct resource gta02_glamo_resources
[] = {
1479 .start
= S3C2410_CS1
,
1480 .end
= S3C2410_CS1
+ 0x1000000 - 1,
1481 .flags
= IORESOURCE_MEM
,
1484 .start
= GTA02_IRQ_3D
,
1485 .end
= GTA02_IRQ_3D
,
1486 .flags
= IORESOURCE_IRQ
,
1489 .start
= GTA02v1_GPIO_3D_RESET
,
1490 .end
= GTA02v1_GPIO_3D_RESET
,
1494 static struct platform_device gta02_glamo_dev
= {
1495 .name
= "glamo3362",
1496 .num_resources
= ARRAY_SIZE(gta02_glamo_resources
),
1497 .resource
= gta02_glamo_resources
,
1499 .platform_data
= >a02_glamo_pdata
,
1503 static void mangle_glamo_res_by_system_rev(void)
1505 switch (system_rev
) {
1506 case GTA02v1_SYSTEM_REV
:
1509 gta02_glamo_resources
[2].start
= GTA02_GPIO_3D_RESET
;
1510 gta02_glamo_resources
[2].end
= GTA02_GPIO_3D_RESET
;
1514 switch (system_rev
) {
1515 case GTA02v1_SYSTEM_REV
:
1516 case GTA02v2_SYSTEM_REV
:
1517 case GTA02v3_SYSTEM_REV
:
1518 /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
1519 /* The hardware is missing a pull-up resistor and thus can't
1520 * support the Smedia Glamo IRQ */
1521 gta02_glamo_resources
[1].start
= 0;
1522 gta02_glamo_resources
[1].end
= 0;
1527 static void __init
gta02_map_io(void)
1529 s3c24xx_init_io(gta02_iodesc
, ARRAY_SIZE(gta02_iodesc
));
1530 s3c24xx_init_clocks(12000000);
1531 s3c24xx_init_uarts(gta02_uartcfgs
, ARRAY_SIZE(gta02_uartcfgs
));
1534 extern int gta_gsm_interrupts
;
1536 static irqreturn_t
gta02_modem_irq(int irq
, void *param
)
1538 printk(KERN_DEBUG
"modem wakeup interrupt\n");
1539 gta_gsm_interrupts
++;
1543 static irqreturn_t
ar6000_wow_irq(int irq
, void *param
)
1545 printk(KERN_DEBUG
"ar6000_wow interrupt\n");
1549 static void __init
gta02_machine_init(void)
1553 /* set the panic callback to make AUX blink fast */
1554 panic_blink
= gta02_panic_blink
;
1556 switch (system_rev
) {
1557 case GTA02v6_SYSTEM_REV
:
1558 /* we need push-pull interrupt from motion sensors */
1559 lis302_pdata
[0].open_drain
= 0;
1560 lis302_pdata
[1].open_drain
= 0;
1566 spin_lock_init(&motion_irq_lock
);
1568 s3c_device_usb
.dev
.platform_data
= >a02_usb_info
;
1569 s3c_device_nand
.dev
.platform_data
= >a02_nand_info
;
1570 s3c_device_sdi
.dev
.platform_data
= >a02_mmc_cfg
;
1572 /* Only GTA02v1 has a SD_DETECT GPIO. Since the slot is not
1573 * hot-pluggable, this is not required anyway */
1574 switch (system_rev
) {
1575 case GTA02v1_SYSTEM_REV
:
1578 gta02_mmc_cfg
.gpio_detect
= 0;
1582 /* acc sensor chip selects */
1583 s3c2410_gpio_setpin(S3C2410_GPD12
, 1);
1584 s3c2410_gpio_cfgpin(S3C2410_GPD12
, S3C2410_GPIO_OUTPUT
);
1585 s3c2410_gpio_setpin(S3C2410_GPD13
, 1);
1586 s3c2410_gpio_cfgpin(S3C2410_GPD13
, S3C2410_GPIO_OUTPUT
);
1588 s3c24xx_udc_set_platdata(>a02_udc_cfg
);
1589 set_s3c2410ts_info(>a02_ts_cfg
);
1591 /* FIXME: hardcoded WLAN module power-up */
1592 s3c2410_gpio_cfgpin(GTA02_CHIP_PWD
, S3C2410_GPIO_OUTPUT
);
1595 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 1);
1598 switch (system_rev
) {
1599 case GTA02v1_SYSTEM_REV
:
1600 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 0);
1603 /* Chip is in reset state */
1604 s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET
, 0);
1605 s3c2410_gpio_cfgpin(GTA02_GPIO_nWLAN_RESET
, S3C2410_GPIO_OUTPUT
);
1608 s3c2410_gpio_setpin(GTA02_CHIP_PWD
, 0);
1610 /* Chip is out of reset */
1611 s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET
, 1);
1614 mangle_glamo_res_by_system_rev();
1615 platform_device_register(>a02_glamo_dev
);
1617 platform_device_register(&s3c_device_spi_acc
);
1618 platform_device_register(>a02_button_dev
);
1619 platform_device_register(>a02_pm_gsm_dev
);
1620 platform_device_register(>a02_pm_usbhost_dev
);
1622 mangle_pmu_pdata_by_system_rev();
1623 platform_device_register(>a02_pmu_dev
);
1624 platform_device_register(>a02_vibrator_dev
);
1625 platform_device_register(>a02_led_dev
);
1628 platform_device_register(>a02_sdio_dev
);
1630 platform_add_devices(gta02_devices
, ARRAY_SIZE(gta02_devices
));
1632 #ifdef CONFIG_GTA02_HDQ
1633 switch (system_rev
) {
1634 case GTA02v5_SYSTEM_REV
:
1635 case GTA02v6_SYSTEM_REV
:
1636 platform_device_register(>a02_hdq_device
);
1637 platform_device_register(&bq27000_battery_device
);
1645 /* Make sure the modem can wake us up */
1646 set_irq_type(GTA02_IRQ_MODEM
, IRQT_RISING
);
1647 rc
= request_irq(GTA02_IRQ_MODEM
, gta02_modem_irq
, IRQF_DISABLED
,
1650 printk(KERN_ERR
"GTA02: can't request GSM modem wakeup IRQ\n");
1651 enable_irq_wake(GTA02_IRQ_MODEM
);
1653 /* Make sure the wifi module can wake us up*/
1654 set_irq_type(GTA02_IRQ_WLAN_GPIO1
, IRQT_RISING
);
1655 rc
= request_irq(GTA02_IRQ_WLAN_GPIO1
, ar6000_wow_irq
, IRQF_DISABLED
,
1659 printk(KERN_ERR
"GTA02: can't request ar6k wakeup IRQ\n");
1660 enable_irq_wake(GTA02_IRQ_WLAN_GPIO1
);
1663 MACHINE_START(NEO1973_GTA02
, "GTA02")
1664 .phys_io
= S3C2410_PA_UART
,
1665 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
1666 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
1667 .map_io
= gta02_map_io
,
1668 .init_irq
= s3c24xx_init_irq
,
1669 .init_machine
= gta02_machine_init
,
1670 .timer
= &s3c24xx_timer
,