2 * linux/arch/arm/mach-s3c2442/mach-gta02.c
4 * S3C2442 Machine Support for the Openmoko Freerunner (GTA02)
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/spi_gpio.h>
39 #include <linux/spi/spi_bitbang.h>
40 #include <linux/mmc/host.h>
41 #include <linux/leds.h>
42 #include <linux/gpio_keys.h>
44 #include <linux/mtd/mtd.h>
45 #include <linux/mtd/nand.h>
46 #include <linux/mtd/nand_ecc.h>
47 #include <linux/mtd/partitions.h>
48 #include <linux/mtd/physmap.h>
50 #include <linux/i2c.h>
51 #include <linux/backlight.h>
52 #include <linux/regulator/machine.h>
54 #include <linux/mfd/pcf50633/core.h>
55 #include <linux/mfd/pcf50633/mbc.h>
56 #include <linux/mfd/pcf50633/adc.h>
57 #include <linux/mfd/pcf50633/gpio.h>
58 #include <linux/mfd/pcf50633/pmic.h>
60 #include <linux/lis302dl.h>
62 #include <asm/mach/arch.h>
63 #include <asm/mach/map.h>
64 #include <asm/mach/irq.h>
66 #include <mach/hardware.h>
69 #include <asm/mach-types.h>
71 #include <mach/regs-irq.h>
72 #include <mach/regs-gpio.h>
73 #include <mach/regs-gpioj.h>
78 #include <mach/spi-gpio.h>
79 #include <mach/regs-mem.h>
83 #include <mach/gta02.h>
85 #include <plat/regs-serial.h>
86 #include <plat/nand.h>
87 #include <plat/devs.h>
92 #include <plat/usb-control.h>
93 #include <plat/regs-timer.h>
95 #include <mach/gta02-pm-gsm.h>
96 #include <mach/gta02-pm-gps.h>
97 #include <mach/gta02-pm-wlan.h>
99 #include <linux/jbt6k74.h>
100 #include <linux/glamofb.h>
101 #include <linux/mfd/glamo.h>
103 #include <linux/hdq.h>
104 #include <linux/bq27000_battery.h>
106 #include <linux/touchscreen/ts_filter_chain.h>
107 #ifdef CONFIG_TOUCHSCREEN_FILTER
108 #include <linux/touchscreen/ts_filter_linear.h>
109 #include <linux/touchscreen/ts_filter_mean.h>
110 #include <linux/touchscreen/ts_filter_median.h>
111 #include <linux/touchscreen/ts_filter_group.h>
116 #include <linux/gta02-vibrator.h>
118 /* arbitrates which sensor IRQ owns the shared SPI bus */
119 static spinlock_t motion_irq_lock
;
122 /* -------------------------------------------------------------------------------
125 * Calls into vibrator and hdq and based on the return values
126 * determines if we the FIQ source be kept alive
129 #define DIVISOR_FROM_US(x) ((x) << 3)
131 #ifdef CONFIG_HDQ_GPIO_BITBANG
132 #define FIQ_DIVISOR_HDQ DIVISOR_FROM_US(HDQ_SAMPLE_PERIOD_US)
133 extern int hdq_fiq_handler(void);
136 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
137 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
138 extern int gta02_vibrator_fiq_handler(void);
141 #if defined(CONFIG_LEDS_GTA02_VIBRATOR) || defined(CONFIG_HDQ_GPIO_BITBANG)
143 /* Global data related to our fiq source */
144 static u32 gta02_fiq_ack_mask
;
145 static struct s3c2410_pwm gta02_fiq_pwm_timer
;
146 static u16 gta02_fiq_timer_index
;
147 static int gta02_fiq_irq
;
149 static void gta02_fiq_handler(void)
151 u16 divisor
= 0xffff;
153 /* Vibrator servicing */
155 /* disable further timer interrupts if nobody has any work
156 * or adjust rate according to who still has work
158 * CAUTION: it means forground code must disable FIQ around
159 * its own non-atomic S3C2410_INTMSK changes... not common
160 * thankfully and taken care of by the fiq-basis patch
163 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
164 if (gta02_vibrator_fiq_handler())
165 divisor
= FIQ_DIVISOR_VIBRATOR
;
168 #ifdef CONFIG_HDQ_GPIO_BITBANG
169 if (hdq_fiq_handler())
170 divisor
= FIQ_DIVISOR_HDQ
;
173 if (divisor
== 0xffff) /* mask the fiq irq source */
174 __raw_writel(__raw_readl(S3C2410_INTMSK
) | gta02_fiq_ack_mask
,
176 else /* still working, maybe at a different rate */
177 __raw_writel(divisor
, S3C2410_TCNTB(gta02_fiq_timer_index
));
179 __raw_writel(gta02_fiq_ack_mask
, S3C2410_SRCPND
);
182 static void gta02_fiq_kick(void)
187 /* we have to take care about FIQ because this modification is
188 * non-atomic, FIQ could come in after the read and before the
189 * writeback and its changes to the register would be lost
190 * (platform INTMSK mod code is taken care of already)
192 local_save_flags(flags
);
194 /* allow FIQs to resume */
195 __raw_writel(__raw_readl(S3C2410_INTMSK
) &
196 ~(1 << (gta02_fiq_irq
- S3C2410_CPUIRQ_OFFSET
)),
198 tcon
= __raw_readl(S3C2410_TCON
) & ~S3C2410_TCON_T3START
;
199 /* fake the timer to a count of 1 */
200 __raw_writel(1, S3C2410_TCNTB(gta02_fiq_timer_index
));
201 __raw_writel(tcon
| S3C2410_TCON_T3MANUALUPD
, S3C2410_TCON
);
202 __raw_writel(tcon
| S3C2410_TCON_T3MANUALUPD
| S3C2410_TCON_T3START
,
204 __raw_writel(tcon
| S3C2410_TCON_T3START
, S3C2410_TCON
);
205 local_irq_restore(flags
);
208 static int gta02_fiq_enable(void)
210 int irq_index_fiq
= IRQ_TIMER3
;
215 gta02_fiq_irq
= irq_index_fiq
;
216 gta02_fiq_ack_mask
= 1 << (irq_index_fiq
- S3C2410_CPUIRQ_OFFSET
);
217 gta02_fiq_timer_index
= (irq_index_fiq
- IRQ_TIMER0
);
219 /* set up the timer to operate as a pwm device */
221 rc
= s3c2410_pwm_init(>a02_fiq_pwm_timer
);
225 gta02_fiq_pwm_timer
.timerid
= PWM0
+ gta02_fiq_timer_index
;
226 gta02_fiq_pwm_timer
.prescaler
= (6 - 1) / 2;
227 gta02_fiq_pwm_timer
.divider
= S3C2410_TCFG1_MUX3_DIV2
;
228 /* default rate == ~32us */
229 gta02_fiq_pwm_timer
.counter
= gta02_fiq_pwm_timer
.comparer
= 3000;
231 rc
= s3c2410_pwm_enable(>a02_fiq_pwm_timer
);
235 s3c2410_pwm_start(>a02_fiq_pwm_timer
);
237 /* let our selected interrupt be a magic FIQ interrupt */
238 __raw_writel(gta02_fiq_ack_mask
, S3C2410_INTMOD
);
240 /* it's ready to go as soon as we unmask the source in S3C2410_INTMSK */
243 set_fiq_c_handler(gta02_fiq_handler
);
248 printk(KERN_ERR
"Could not initialize FIQ for GTA02: %d\n", rc
);
253 static void gta02_fiq_disable(void)
255 __raw_writel(0, S3C2410_INTMOD
);
257 gta02_fiq_irq
= 0; /* no active source interrupt now either */
260 /* -------------------- /GTA02 FIQ Handler ------------------------------------- */
265 * this gets called every 1ms when we paniced.
268 static long gta02_panic_blink(long count
)
271 static long last_blink
;
274 if (count
- last_blink
< 100) /* 200ms period, fast blink */
278 s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED
, S3C2410_GPIO_OUTPUT
);
279 s3c2410_gpio_setpin(GTA02_GPIO_AUX_LED
, led
);
287 * returns PCB revision information in b9,b8 and b2,b1,b0
288 * Pre-GTA02 A6 returns 0x000
289 * GTA02 A6 returns 0x101
293 int gta02_get_pcb_revision(void)
297 static unsigned long pinlist
[] = {
304 static int pin_offset
[] = {
308 for (n
= 0 ; n
< ARRAY_SIZE(pinlist
); n
++) {
310 * set the PCB version GPIO to be pulled-down input
311 * force low briefly first
313 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
314 s3c2410_gpio_setpin(pinlist
[n
], 0);
315 /* misnomer: it is a pullDOWN in 2442 */
316 s3c2410_gpio_pullup(pinlist
[n
], 1);
317 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_INPUT
);
321 if (s3c2410_gpio_getpin(pinlist
[n
]))
322 u
|= 1 << pin_offset
[n
];
325 * when not being interrogated, all of the revision GPIO
326 * are set to output HIGH without pulldown so no current flows
327 * if they are NC or pulled up.
329 s3c2410_gpio_setpin(pinlist
[n
], 1);
330 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
331 /* misnomer: it is a pullDOWN in 2442 */
332 s3c2410_gpio_pullup(pinlist
[n
], 0);
338 struct platform_device gta02_resume_reason_device
= {
339 .name
= "gta02-resume",
343 static struct map_desc gta02_iodesc
[] __initdata
= {
345 .virtual = 0xe0000000,
346 .pfn
= __phys_to_pfn(S3C2410_CS3
+0x01000000),
352 #define UCON (S3C2410_UCON_DEFAULT | S3C2443_UCON_RXERR_IRQEN)
353 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
354 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
356 static struct s3c2410_uartcfg gta02_uartcfgs
[] = {
381 struct pcf50633
*gta02_pcf
;
383 #ifdef CONFIG_CHARGER_PCF50633
384 #ifdef CONFIG_HDQ_GPIO_BITBANG
385 static int gta02_get_charger_online_status(void)
387 struct pcf50633
*pcf
= gta02_pcf
;
389 return pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ONLINE
;
392 static int gta02_get_charger_active_status(void)
394 struct pcf50633
*pcf
= gta02_pcf
;
396 return pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ACTIVE
;
400 #define ADC_NOM_CHG_DETECT_1A 6
401 #define ADC_NOM_CHG_DETECT_USB 43
404 gta02_configure_pmu_for_charger(struct pcf50633
*pcf
, void *unused
, int res
)
408 /* Interpret charger type */
409 if (res
< ((ADC_NOM_CHG_DETECT_USB
+ ADC_NOM_CHG_DETECT_1A
) / 2)) {
411 /* Stop GPO driving out now that we have a IA charger */
412 pcf50633_gpio_set(pcf
, PCF50633_GPO
, 0);
418 pcf50633_mbc_usb_curlim_set(pcf
, ma
);
421 static struct delayed_work gta02_charger_work
;
422 static int gta02_usb_vbus_draw
;
424 static void gta02_charger_worker(struct work_struct
*work
)
426 struct pcf50633
*pcf
= gta02_pcf
;
428 if (gta02_usb_vbus_draw
) {
429 pcf50633_mbc_usb_curlim_set(pcf
, gta02_usb_vbus_draw
);
432 #ifdef CONFIG_PCF50633_ADC
433 pcf50633_adc_async_read(pcf
,
434 PCF50633_ADCC1_MUX_ADCIN1
,
435 PCF50633_ADCC1_AVERAGE_16
,
436 gta02_configure_pmu_for_charger
, NULL
);
438 /* If the PCF50633 ADC is disabled we fallback to a 100mA limit for safety. */
439 pcf50633_mbc_usb_curlim_set(pcf
, 100);
445 #define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000)
446 static void gta02_pmu_event_callback(struct pcf50633
*pcf
, int irq
)
448 if (irq
== PCF50633_IRQ_USBINS
) {
449 schedule_delayed_work(>a02_charger_work
,
450 GTA02_CHARGER_CONFIGURE_TIMEOUT
);
452 } else if (irq
== PCF50633_IRQ_USBREM
) {
453 cancel_delayed_work_sync(>a02_charger_work
);
454 gta02_usb_vbus_draw
= 0;
458 static void gta02_pmu_force_shutdown(struct pcf50633
*pcf
)
460 pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_OOCSHDWN
,
461 PCF50633_OOCSHDWN_GOSTDBY
, PCF50633_OOCSHDWN_GOSTDBY
);
465 static void gta02_udc_vbus_draw(unsigned int ma
)
470 gta02_usb_vbus_draw
= ma
;
472 schedule_delayed_work(>a02_charger_work
,
473 GTA02_CHARGER_CONFIGURE_TIMEOUT
);
476 static int gta02_udc_vbus_status(void)
478 struct pcf50633
*pcf
= gta02_pcf
;
482 return !!(pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ONLINE
);
485 #else /* !CONFIG_CHARGER_PCF50633 */
486 #ifdef CONFIG_HDQ_GPIO_BITBANG
487 #define gta02_get_charger_online_status NULL
488 #define gta02_get_charger_active_status NULL
490 #define gta02_pmu_event_callback NULL
491 #define gta02_udc_vbus_draw NULL
492 #define gta02_udc_vbus_status NULL
496 static struct platform_device gta02_pm_gps_dev
= {
497 .name
= "gta02-pm-gps",
500 static struct platform_device gta02_pm_bt_dev
= {
501 .name
= "gta02-pm-bt",
504 static struct platform_device gta02_pm_gsm_dev
= {
505 .name
= "gta02-pm-gsm",
508 static struct platform_device gta02_pm_wlan_dev
= {
509 .name
= "gta02-pm-wlan",
512 /* this is called when pc50633 is probed, unfortunately quite late in the
513 * day since it is an I2C bus device. Here we can belatedly define some
514 * platform devices with the advantage that we can mark the pcf50633 as the
515 * parent. This makes them get suspended and resumed with their parent
516 * the pcf50633 still around.
519 static struct platform_device gta02_glamo_dev
;
520 static void mangle_glamo_res_by_system_rev(void);
522 static void gta02_pmu_attach_child_devices(struct pcf50633
*pcf
);
523 static void gta02_pmu_regulator_registered(struct pcf50633
*pcf
, int id
);
525 static struct regulator_consumer_supply ldo4_consumers
[] = {
527 .dev
= >a02_pm_bt_dev
.dev
,
532 static struct regulator_consumer_supply ldo5_consumers
[] = {
534 .dev
= >a02_pm_gps_dev
.dev
,
539 static struct regulator_consumer_supply hcldo_consumers
[] = {
541 .dev
= >a02_glamo_dev
.dev
,
546 static char *gta02_batteries
[] = {
550 #ifdef CONFIG_CHARGER_PCF50633
552 struct pcf50633_platform_data gta02_pcf_pdata
= {
554 [0] = PCF50633_INT1_USBINS
|
555 PCF50633_INT1_USBREM
|
557 [1] = PCF50633_INT2_ONKEYF
,
558 [2] = PCF50633_INT3_ONKEY1S
,
559 [3] = PCF50633_INT4_LOWSYS
|
560 PCF50633_INT4_LOWBAT
|
561 PCF50633_INT4_HIGHTMP
,
564 .batteries
= gta02_batteries
,
565 .num_batteries
= ARRAY_SIZE(gta02_batteries
),
566 .charging_restart_interval
= (900 * HZ
),
567 .chg_ref_current_ma
= 1000,
570 [PCF50633_REGULATOR_AUTO
] = {
575 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
583 .num_consumer_supplies
= 0,
585 [PCF50633_REGULATOR_DOWN1
] = {
590 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
595 .num_consumer_supplies
= 0,
597 [PCF50633_REGULATOR_DOWN2
] = {
602 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
610 .num_consumer_supplies
= 0,
612 [PCF50633_REGULATOR_HCLDO
] = {
617 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
618 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
621 .num_consumer_supplies
= 1,
622 .consumer_supplies
= hcldo_consumers
,
624 [PCF50633_REGULATOR_LDO1
] = {
626 .name
= "GSENSOR_3V3",
629 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
632 .num_consumer_supplies
= 0,
634 [PCF50633_REGULATOR_LDO2
] = {
639 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
642 .num_consumer_supplies
= 0,
644 [PCF50633_REGULATOR_LDO3
] = {
648 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
651 .num_consumer_supplies
= 0,
653 [PCF50633_REGULATOR_LDO4
] = {
658 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
661 .num_consumer_supplies
= 1,
662 .consumer_supplies
= ldo4_consumers
,
664 [PCF50633_REGULATOR_LDO5
] = {
669 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
675 .num_consumer_supplies
= 1,
676 .consumer_supplies
= ldo5_consumers
,
678 [PCF50633_REGULATOR_LDO6
] = {
684 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
687 .num_consumer_supplies
= 0,
689 [PCF50633_REGULATOR_MEMLDO
] = {
693 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
698 .num_consumer_supplies
= 0,
702 .probe_done
= gta02_pmu_attach_child_devices
,
703 .regulator_registered
= gta02_pmu_regulator_registered
,
704 .mbc_event_callback
= gta02_pmu_event_callback
,
705 .force_shutdown
= gta02_pmu_force_shutdown
,
708 static void mangle_pmu_pdata_by_system_rev(void)
710 struct regulator_init_data
*reg_init_data
;
712 reg_init_data
= gta02_pcf_pdata
.reg_init_data
;
714 switch (S3C_SYSTEM_REV_ATAG
) {
715 case GTA02v1_SYSTEM_REV
:
716 /* FIXME: this is only in v1 due to wrong PMU variant */
717 reg_init_data
[PCF50633_REGULATOR_DOWN2
]
718 .constraints
.state_mem
.enabled
= 1;
720 reg_init_data
[PCF50633_REGULATOR_LDO1
]
721 .constraints
.min_uV
= 1300000;
722 reg_init_data
[PCF50633_REGULATOR_LDO1
]
723 .constraints
.max_uV
= 1300000;
725 reg_init_data
[PCF50633_REGULATOR_LDO5
]
726 .constraints
.min_uV
= 1500000;
727 reg_init_data
[PCF50633_REGULATOR_LDO5
]
728 .constraints
.max_uV
= 1500000;
730 reg_init_data
[PCF50633_REGULATOR_LDO6
]
731 .constraints
.min_uV
= 0;
732 reg_init_data
[PCF50633_REGULATOR_LDO6
]
733 .constraints
.max_uV
= 3300000;
734 reg_init_data
[PCF50633_REGULATOR_LDO6
]
735 .constraints
.apply_uV
= 1;
744 #ifdef CONFIG_HDQ_GPIO_BITBANG
745 /* BQ27000 Battery */
747 struct bq27000_platform_data bq27000_pdata
= {
750 .hdq_read
= hdq_read
,
751 .hdq_write
= hdq_write
,
752 .hdq_initialized
= hdq_initialized
,
753 .get_charger_online_status
= gta02_get_charger_online_status
,
754 .get_charger_active_status
= gta02_get_charger_active_status
757 struct platform_device bq27000_battery_device
= {
758 .name
= "bq27000-battery",
760 .platform_data
= &bq27000_pdata
,
766 static void gta02_hdq_attach_child_devices(struct device
*parent_device
)
768 switch (S3C_SYSTEM_REV_ATAG
) {
769 case GTA02v5_SYSTEM_REV
:
770 case GTA02v6_SYSTEM_REV
:
771 bq27000_battery_device
.dev
.parent
= parent_device
;
772 platform_device_register(&bq27000_battery_device
);
779 static void gta02_hdq_gpio_direction_out(void)
781 s3c2410_gpio_cfgpin(GTA02v5_GPIO_HDQ
, S3C2410_GPIO_OUTPUT
);
784 static void gta02_hdq_gpio_direction_in(void)
786 s3c2410_gpio_cfgpin(GTA02v5_GPIO_HDQ
, S3C2410_GPIO_INPUT
);
789 static void gta02_hdq_gpio_set_value(int val
)
792 s3c2410_gpio_setpin(GTA02v5_GPIO_HDQ
, val
);
795 static int gta02_hdq_gpio_get_value(void)
797 return s3c2410_gpio_getpin(GTA02v5_GPIO_HDQ
);
800 static struct resource gta02_hdq_resources
[] = {
802 .start
= GTA02v5_GPIO_HDQ
,
803 .end
= GTA02v5_GPIO_HDQ
,
807 struct hdq_platform_data gta02_hdq_platform_data
= {
808 .attach_child_devices
= gta02_hdq_attach_child_devices
,
809 .gpio_dir_out
= gta02_hdq_gpio_direction_out
,
810 .gpio_dir_in
= gta02_hdq_gpio_direction_in
,
811 .gpio_set
= gta02_hdq_gpio_set_value
,
812 .gpio_get
= gta02_hdq_gpio_get_value
,
814 .enable_fiq
= gta02_fiq_enable
,
815 .disable_fiq
= gta02_fiq_disable
,
816 .kick_fiq
= gta02_fiq_kick
,
820 struct platform_device gta02_hdq_device
= {
823 .resource
= gta02_hdq_resources
,
825 .platform_data
= >a02_hdq_platform_data
,
831 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
832 /* vibrator (child of FIQ) */
834 static struct resource gta02_vibrator_resources
[] = {
836 .start
= GTA02_GPIO_VIBRATOR_ON
,
837 .end
= GTA02_GPIO_VIBRATOR_ON
,
840 struct gta02_vib_platform_data gta02_vib_pdata
= {
841 .enable_fiq
= gta02_fiq_enable
,
842 .disable_fiq
= gta02_fiq_disable
,
843 .kick_fiq
= gta02_fiq_kick
,
846 static struct platform_device gta02_vibrator_dev
= {
847 .name
= "gta02-vibrator",
848 .num_resources
= ARRAY_SIZE(gta02_vibrator_resources
),
849 .resource
= gta02_vibrator_resources
,
851 .platform_data
= >a02_vib_pdata
,
858 #define GTA02_FLASH_BASE S3C2410_CS3 /* GCS3 */
859 #define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */
861 static struct physmap_flash_data gta02_nor_flash_data
= {
865 static struct resource gta02_nor_flash_resource
= {
866 .start
= GTA02_FLASH_BASE
,
867 .end
= GTA02_FLASH_BASE
+ GTA02_FLASH_SIZE
- 1,
868 .flags
= IORESOURCE_MEM
,
871 static struct platform_device gta02_nor_flash
= {
872 .name
= "physmap-flash",
875 .platform_data
= >a02_nor_flash_data
,
877 .resource
= >a02_nor_flash_resource
,
882 struct platform_device s3c24xx_pwm_device
= {
883 .name
= "s3c24xx_pwm",
887 static struct i2c_board_info gta02_i2c_devs
[] __initdata
= {
889 I2C_BOARD_INFO("pcf50633", 0x73),
890 .irq
= GTA02_IRQ_PCF50633
,
891 .platform_data
= >a02_pcf_pdata
,
894 I2C_BOARD_INFO("wm8753", 0x1a),
898 static struct s3c2410_nand_set gta02_nand_sets
[] = {
900 .name
= "neo1973-nand",
902 .flags
= S3C2410_NAND_BBT
,
906 /* choose a set of timings derived from S3C@2442B MCP54
907 * data sheet (K5D2G13ACM-D075 MCP Memory)
910 static struct s3c2410_platform_nand gta02_nand_info
= {
914 .nr_sets
= ARRAY_SIZE(gta02_nand_sets
),
915 .sets
= gta02_nand_sets
,
920 static void gta02_s3c_mmc_set_power(unsigned char power_mode
,
923 static int is_on
= -1;
926 on
= power_mode
== MMC_POWER_ON
|| power_mode
== MMC_POWER_UP
;
928 gta02_wlan_reset(!on
);
933 static struct s3c24xx_mci_pdata gta02_s3c_mmc_cfg
= {
934 .set_power
= gta02_s3c_mmc_set_power
,
937 static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd
)
940 case S3C2410_UDC_P_ENABLE
:
941 printk(KERN_DEBUG
"%s S3C2410_UDC_P_ENABLE\n", __func__
);
942 s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP
, 1);
944 case S3C2410_UDC_P_DISABLE
:
945 printk(KERN_DEBUG
"%s S3C2410_UDC_P_DISABLE\n", __func__
);
946 s3c2410_gpio_setpin(GTA02_GPIO_USB_PULLUP
, 0);
948 case S3C2410_UDC_P_RESET
:
949 printk(KERN_DEBUG
"%s S3C2410_UDC_P_RESET\n", __func__
);
957 /* get PMU to set USB current limit accordingly */
959 static struct s3c2410_udc_mach_info gta02_udc_cfg
= {
960 .vbus_draw
= gta02_udc_vbus_draw
,
961 .udc_command
= gta02_udc_command
,
962 /* .get_vbus_status = gta02_udc_vbus_status,*/
966 /* Touchscreen configuration. */
968 #ifdef CONFIG_TOUCHSCREEN_FILTER
969 const static struct ts_filter_group_configuration gta02_ts_group
= {
972 .threshold
= 6, /* At least half of the points in a group. */
976 const static struct ts_filter_median_configuration gta02_ts_median
= {
978 .decimation_below
= 3,
979 .decimation_threshold
= 8 * 3,
980 .decimation_above
= 4,
983 const static struct ts_filter_mean_configuration gta02_ts_mean
= {
987 const static struct ts_filter_linear_configuration gta02_ts_linear
= {
988 .constants
= {1, 0, 0, 0, 1, 0, 1}, /* Don't modify coords. */
994 const static struct ts_filter_chain_configuration gta02_filter_configuration
[] =
996 #ifdef CONFIG_TOUCHSCREEN_FILTER
997 {&ts_filter_group_api
, >a02_ts_group
.config
},
998 {&ts_filter_median_api
, >a02_ts_median
.config
},
999 {&ts_filter_mean_api
, >a02_ts_mean
.config
},
1000 {&ts_filter_linear_api
, >a02_ts_linear
.config
},
1005 const static struct s3c2410_ts_mach_info gta02_ts_cfg
= {
1007 .presc
= 0xff, /* slow as we can go */
1008 .filter_config
= gta02_filter_configuration
,
1013 static void gta02_bl_set_intensity(int intensity
)
1015 struct pcf50633
*pcf
= gta02_pcf
;
1016 int old_intensity
= pcf50633_reg_read(pcf
, PCF50633_REG_LEDOUT
);
1022 * One code path that leads here is from a kernel panic. Trying to turn
1023 * the backlight on just gives us a nearly endless stream of complaints
1024 * and accomplishes nothing. We can't win. Just give up.
1026 * In the unlikely event that there's another path leading here while
1027 * we're atomic, we print at least a warning.
1031 "gta02_bl_set_intensity called while atomic\n");
1035 if (!(pcf50633_reg_read(pcf
, PCF50633_REG_LEDENA
) & 3))
1038 old_intensity
= pcf50633_reg_read(pcf
, PCF50633_REG_LEDOUT
);
1040 if (intensity
== old_intensity
)
1043 /* We can't do this anywhere else */
1044 pcf50633_reg_write(pcf
, PCF50633_REG_LEDDIM
, 5);
1047 * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
1048 * if seen, you have to re-enable the LED unit
1050 if (!intensity
|| !old_intensity
)
1051 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0);
1053 if (!intensity
) /* illegal to set LEDOUT to 0 */
1054 ret
= pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_LEDOUT
, 0x3f,
1057 ret
= pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_LEDOUT
, 0x3f,
1061 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 2);
1065 static struct generic_bl_info gta02_bl_info
= {
1067 .max_intensity
= 0xff,
1068 .default_intensity
= 0xff,
1069 .set_bl_intensity
= gta02_bl_set_intensity
,
1072 static struct platform_device gta02_bl_dev
= {
1073 .name
= "generic-bl",
1076 .platform_data
= >a02_bl_info
,
1080 /* SPI: LCM control interface attached to Glamo3362 */
1082 static void gta02_jbt6k74_reset(int devidx
, int level
)
1084 gpio_set_value(GTA02_GPIO_GLAMO(4), level
);
1087 static void gta02_jbt6k74_probe_completed(struct device
*dev
)
1089 struct pcf50633
*pcf
= gta02_pcf
;
1091 /* Switch on backlight. Qi does not do it for us */
1092 pcf50633_reg_write(pcf
, PCF50633_REG_LEDOUT
, 0x01);
1093 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0x00);
1094 pcf50633_reg_write(pcf
, PCF50633_REG_LEDDIM
, 0x01);
1095 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0x01);
1097 gta02_bl_dev
.dev
.parent
= dev
;
1098 platform_device_register(>a02_bl_dev
);
1101 const struct jbt6k74_platform_data jbt6k74_pdata
= {
1102 .reset
= gta02_jbt6k74_reset
,
1103 .probe_completed
= gta02_jbt6k74_probe_completed
,
1106 /*----------- SPI: Accelerometers attached to SPI of s3c244x ----------------- */
1108 void gta02_lis302dl_suspend_io(struct lis302dl_info
*lis
, int resume
)
1110 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1114 * we don't want to power them with a high level
1115 * because GSENSOR_3V3 is not up during suspend
1117 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1118 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1119 s3c2410_gpio_setpin(pdata
->pin_mosi
, 0);
1120 /* misnomer: it is a pullDOWN in 2442 */
1121 s3c2410_gpio_pullup(pdata
->pin_miso
, 1);
1125 /* back to normal */
1126 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1127 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1128 /* misnomer: it is a pullDOWN in 2442 */
1129 s3c2410_gpio_pullup(pdata
->pin_miso
, 0);
1131 s3c2410_gpio_cfgpin(pdata
->pin_chip_select
, S3C2410_GPIO_OUTPUT
);
1132 s3c2410_gpio_cfgpin(pdata
->pin_clk
, S3C2410_GPIO_OUTPUT
);
1133 s3c2410_gpio_cfgpin(pdata
->pin_mosi
, S3C2410_GPIO_OUTPUT
);
1134 s3c2410_gpio_cfgpin(pdata
->pin_miso
, S3C2410_GPIO_INPUT
);
1138 struct lis302dl_platform_data lis302_pdata_top
= {
1139 .name
= "lis302-1 (top)",
1140 .pin_chip_select
= S3C2410_GPD12
,
1141 .pin_clk
= S3C2410_GPG7
,
1142 .pin_mosi
= S3C2410_GPG6
,
1143 .pin_miso
= S3C2410_GPG5
,
1144 .interrupt
= GTA02_IRQ_GSENSOR_1
,
1145 .open_drain
= 1, /* altered at runtime by PCB rev */
1146 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1149 struct lis302dl_platform_data lis302_pdata_bottom
= {
1150 .name
= "lis302-2 (bottom)",
1151 .pin_chip_select
= S3C2410_GPD13
,
1152 .pin_clk
= S3C2410_GPG7
,
1153 .pin_mosi
= S3C2410_GPG6
,
1154 .pin_miso
= S3C2410_GPG5
,
1155 .interrupt
= GTA02_IRQ_GSENSOR_2
,
1156 .open_drain
= 1, /* altered at runtime by PCB rev */
1157 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1160 static struct spi_board_info gta02_spi_board_info
[] = {
1162 .modalias
= "jbt6k74",
1163 .platform_data
= &jbt6k74_pdata
,
1164 .controller_data
= (void*)GTA02_GPIO_GLAMO(12),
1166 .max_speed_hz
= 100 * 1000,
1171 .modalias
= "lis302dl",
1173 .platform_data
= &lis302_pdata_top
,
1174 /* controller_data */
1176 .max_speed_hz
= 100 * 1000,
1182 .modalias
= "lis302dl",
1184 .platform_data
= &lis302_pdata_bottom
,
1185 /* controller_data */
1187 .max_speed_hz
= 100 * 1000,
1194 static void gta02_lis302_chip_select(struct s3c2410_spigpio_info
*info
, int csid
, int cs
)
1198 * Huh... "quirk"... CS on this device is not really "CS" like you can
1201 * When it is 0 it selects SPI interface mode.
1202 * When it is 1 it selects I2C interface mode.
1204 * Because we have 2 devices on one interface we have to make sure
1205 * that the "disabled" device (actually in I2C mode) don't think we're
1208 * When we talk to the "enabled" device, the "disabled" device sees
1209 * the clocks as I2C clocks, creating havoc.
1211 * I2C sees MOSI going LOW while CLK HIGH as a START action, thus we
1212 * must ensure this is never issued.
1215 int cs_gpio
, other_cs_gpio
;
1217 cs_gpio
= csid
? S3C2410_GPD13
: S3C2410_GPD12
;
1218 other_cs_gpio
= (1 - csid
) ? S3C2410_GPD13
: S3C2410_GPD12
;
1221 if (cs
== BITBANG_CS_ACTIVE
) {
1222 s3c2410_gpio_setpin(other_cs_gpio
, 1);
1223 s3c2410_gpio_setpin(cs_gpio
, 1);
1224 s3c2410_gpio_setpin(info
->pin_clk
, 1);
1225 s3c2410_gpio_setpin(cs_gpio
, 0);
1227 s3c2410_gpio_setpin(cs_gpio
, 1);
1228 s3c2410_gpio_setpin(other_cs_gpio
, 1);
1232 static struct s3c2410_spigpio_info gta02_spigpio_cfg
= {
1233 .pin_clk
= S3C2410_GPG7
,
1234 .pin_mosi
= S3C2410_GPG6
,
1235 .pin_miso
= S3C2410_GPG5
,
1237 .num_chipselect
= 2,
1238 .chip_select
= gta02_lis302_chip_select
,
1239 .non_blocking_transfer
= 1,
1242 static struct platform_device gta02_spi_gpio_dev
= {
1243 .name
= "spi_s3c24xx_gpio",
1245 .platform_data
= >a02_spigpio_cfg
,
1249 /*----------- / SPI: Accelerometers attached to SPI of s3c244x ----------------- */
1251 static struct gpio_led gta02_gpio_leds
[] = {
1253 .name
= "gta02-power:orange",
1254 .gpio
= GTA02_GPIO_PWR_LED1
,
1256 .name
= "gta02-power:blue",
1257 .gpio
= GTA02_GPIO_PWR_LED2
,
1259 .name
= "gta02-aux:red",
1260 .gpio
= GTA02_GPIO_AUX_LED
,
1264 static struct gpio_led_platform_data gta02_gpio_leds_pdata
= {
1265 .leds
= gta02_gpio_leds
,
1266 .num_leds
= ARRAY_SIZE(gta02_gpio_leds
),
1269 struct platform_device gta02_led_dev
= {
1270 .name
= "leds-gpio",
1273 .platform_data
= >a02_gpio_leds_pdata
,
1277 static struct gpio_keys_button gta02_buttons
[] = {
1279 .gpio
= GTA02_GPIO_AUX_KEY
,
1285 .gpio
= GTA02_GPIO_HOLD_KEY
,
1292 static struct gpio_keys_platform_data gta02_buttons_pdata
= {
1293 .buttons
= gta02_buttons
,
1294 .nbuttons
= ARRAY_SIZE(gta02_buttons
),
1297 static struct platform_device gta02_button_dev
= {
1298 .name
= "gpio-keys",
1301 .platform_data
= >a02_buttons_pdata
,
1305 static struct platform_device gta02_pm_usbhost_dev
= {
1306 .name
= "gta02-pm-host",
1310 static struct s3c2410_hcd_info gta02_usb_info
= {
1312 .flags
= S3C_HCDFLG_USED
,
1319 static int glamo_irq_is_wired(void)
1325 * GTA02 S-Media IRQs prior to A5 are broken due to a lack of
1326 * a pullup on the INT# line. Check for the bad behaviour.
1328 s3c2410_gpio_setpin(S3C2410_GPG4
, 0);
1329 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_OUTP
);
1330 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_INP
);
1332 * we force it low ourselves for a moment and resume being input.
1333 * If there is a pullup, it won't stay low for long. But if the
1334 * level converter is there as on < A5 revision, the weak keeper
1335 * on the input of the LC will hold the line low indefinitiely
1338 rc
= s3c2410_gpio_getpin(S3C2410_GPG4
);
1339 while ((!rc
) && ((count
++) < 10));
1340 if (rc
) { /* it got pulled back up, it's good */
1341 printk(KERN_INFO
"Detected S-Media IRQ# pullup, "
1342 "enabling interrupt\n");
1344 } else /* Gah we can't work with this level converter */
1345 printk(KERN_WARNING
"** Detected bad IRQ# circuit found"
1346 " on pre-A5 GTA02: S-Media interrupt disabled **\n");
1350 /* Smedia Glamo 3362 */
1353 * we crank down SD Card clock dynamically when GPS is powered
1356 static int gta02_glamo_mci_use_slow(void)
1358 return gta02_pm_gps_is_on();
1361 static void gta02_glamo_external_reset(int level
)
1363 s3c2410_gpio_setpin(GTA02_GPIO_3D_RESET
, level
);
1364 s3c2410_gpio_cfgpin(GTA02_GPIO_3D_RESET
, S3C2410_GPIO_OUTPUT
);
1368 static struct fb_videomode gta02_glamo_modes[] = {
1380 .vmode = FB_VMODE_NONINTERLACED,
1392 .vmode = FB_VMODE_NONINTERLACED,
1396 static struct fb_videomode gta02_glamo_modes
[] = {
1408 .vmode
= FB_VMODE_NONINTERLACED
,
1420 .vmode
= FB_VMODE_NONINTERLACED
,
1425 static struct glamo_fb_platform_data gta02_glamo_fb_pdata
= {
1429 .num_modes
= ARRAY_SIZE(gta02_glamo_modes
),
1430 .modes
= gta02_glamo_modes
,
1433 static struct glamo_mmc_platform_data gta02_glamo_mmc_pdata
= {
1434 .glamo_mmc_use_slow
= gta02_glamo_mci_use_slow
,
1437 static struct glamo_platform_data gta02_glamo_pdata
= {
1438 .fb_data
= >a02_glamo_fb_pdata
,
1439 .mmc_data
= >a02_glamo_mmc_pdata
,
1440 .gpio_base
= GTA02_GPIO_GLAMO_BASE
,
1442 .osci_clock_rate
= 32768,
1444 .glamo_irq_is_wired
= glamo_irq_is_wired
,
1445 .glamo_external_reset
= gta02_glamo_external_reset
,
1448 static struct resource gta02_glamo_resources
[] = {
1450 .start
= S3C2410_CS1
,
1451 .end
= S3C2410_CS1
+ 0x1000000 - 1,
1452 .flags
= IORESOURCE_MEM
,
1455 .start
= GTA02_IRQ_3D
,
1456 .end
= GTA02_IRQ_3D
,
1457 .flags
= IORESOURCE_IRQ
,
1460 .start
= GTA02_GPIO_3D_RESET
,
1461 .end
= GTA02_GPIO_3D_RESET
,
1465 static struct platform_device gta02_glamo_dev
= {
1466 .name
= "glamo3362",
1467 .num_resources
= ARRAY_SIZE(gta02_glamo_resources
),
1468 .resource
= gta02_glamo_resources
,
1470 .platform_data
= >a02_glamo_pdata
,
1474 static void mangle_glamo_res_by_system_rev(void)
1476 switch (S3C_SYSTEM_REV_ATAG
) {
1477 case GTA02v1_SYSTEM_REV
:
1480 gta02_glamo_resources
[2].start
= GTA02_GPIO_3D_RESET
;
1481 gta02_glamo_resources
[2].end
= GTA02_GPIO_3D_RESET
;
1485 switch (S3C_SYSTEM_REV_ATAG
) {
1486 case GTA02v1_SYSTEM_REV
:
1487 case GTA02v2_SYSTEM_REV
:
1488 case GTA02v3_SYSTEM_REV
:
1489 /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
1490 /* The hardware is missing a pull-up resistor and thus can't
1491 * support the Smedia Glamo IRQ */
1492 gta02_glamo_resources
[1].start
= 0;
1493 gta02_glamo_resources
[1].end
= 0;
1498 struct spi_gpio_platform_data spigpio_platform_data
= {
1499 .sck
= GTA02_GPIO_GLAMO(10),
1500 .mosi
= GTA02_GPIO_GLAMO(11),
1501 .miso
= GTA02_GPIO_GLAMO(5),
1502 .num_chipselect
= 1,
1505 static struct platform_device spigpio_device
= {
1509 .platform_data
= &spigpio_platform_data
,
1510 .parent
= >a02_glamo_dev
.dev
,
1514 static void __init
gta02_map_io(void)
1516 s3c24xx_init_io(gta02_iodesc
, ARRAY_SIZE(gta02_iodesc
));
1517 s3c24xx_init_clocks(12000000);
1518 s3c24xx_init_uarts(gta02_uartcfgs
, ARRAY_SIZE(gta02_uartcfgs
));
1521 static irqreturn_t
gta02_modem_irq(int irq
, void *param
)
1523 /* printk(KERN_DEBUG "modem wakeup interrupt\n");*/
1524 gta_gsm_interrupts
++;
1528 static irqreturn_t
ar6000_wow_irq(int irq
, void *param
)
1530 /* printk(KERN_DEBUG "ar6000_wow interrupt\n");*/
1537 static char hardware_ecc_str
[4] __initdata
= "";
1539 static int __init
hardware_ecc_setup(char *str
)
1542 strlcpy(hardware_ecc_str
, str
, sizeof(hardware_ecc_str
));
1546 __setup("hardware_ecc=", hardware_ecc_setup
);
1548 /* these are the guys that don't need to be children of PMU */
1550 static struct platform_device
*gta02_devices
[] __initdata
= {
1554 &s3c_device_usbgadget
,
1558 &s3c24xx_pwm_device
,
1560 >a02_pm_wlan_dev
, /* not dependent on PMU */
1565 /* these guys DO need to be children of PMU */
1567 static struct platform_device
*gta02_devices_pmu_children
[] = {
1568 &s3c_device_ts
, /* input 1 */
1570 >a02_pm_usbhost_dev
,
1571 >a02_spi_gpio_dev
, /* input 2 and 3 */
1572 >a02_button_dev
, /* input 4 */
1573 >a02_resume_reason_device
,
1576 static void gta02_register_glamo(void)
1578 platform_device_register(>a02_glamo_dev
);
1579 if (gpio_request(GTA02_GPIO_GLAMO(4), "jbt6k74 reset"))
1580 printk("gta02: Failed to request jbt6k74 reset pin\n");
1581 if (gpio_direction_output(GTA02_GPIO_GLAMO(4), 1))
1582 printk("gta02: Failed to configure jbt6k74 reset pin\n");
1583 platform_device_register(&spigpio_device
);
1586 static void gta02_pmu_regulator_registered(struct pcf50633
*pcf
, int id
)
1588 struct platform_device
*regulator
, *pdev
;
1592 regulator
= pcf
->regulator_pdev
[id
];
1595 case PCF50633_REGULATOR_LDO4
:
1596 pdev
= >a02_pm_bt_dev
;
1598 case PCF50633_REGULATOR_LDO5
:
1599 pdev
= >a02_pm_gps_dev
;
1601 case PCF50633_REGULATOR_HCLDO
:
1602 gta02_register_glamo();
1608 pdev
->dev
.parent
= ®ulator
->dev
;
1609 platform_device_register(pdev
);
1612 /* this is called when pc50633 is probed, unfortunately quite late in the
1613 * day since it is an I2C bus device. Here we can belatedly define some
1614 * platform devices with the advantage that we can mark the pcf50633 as the
1615 * parent. This makes them get suspended and resumed with their parent
1616 * the pcf50633 still around.
1619 static void gta02_pmu_attach_child_devices(struct pcf50633
*pcf
)
1623 for (n
= 0; n
< ARRAY_SIZE(gta02_devices_pmu_children
); n
++)
1624 gta02_devices_pmu_children
[n
]->dev
.parent
= pcf
->dev
;
1626 mangle_glamo_res_by_system_rev();
1627 platform_add_devices(gta02_devices_pmu_children
,
1628 ARRAY_SIZE(gta02_devices_pmu_children
));
1630 regulator_has_full_constraints();
1633 static void gta02_poweroff(void)
1635 pcf50633_reg_set_bit_mask(gta02_pcf
, PCF50633_REG_OOCSHDWN
,
1636 PCF50633_OOCSHDWN_GOSTDBY
, PCF50633_OOCSHDWN_GOSTDBY
);
1639 static void __init
gta02_machine_init(void)
1643 /* set the panic callback to make AUX blink fast */
1644 panic_blink
= gta02_panic_blink
;
1646 switch (S3C_SYSTEM_REV_ATAG
) {
1647 case GTA02v6_SYSTEM_REV
:
1648 /* we need push-pull interrupt from motion sensors */
1649 lis302_pdata_top
.open_drain
= 0;
1650 lis302_pdata_bottom
.open_drain
= 0;
1656 spin_lock_init(&motion_irq_lock
);
1658 #ifdef CONFIG_CHARGER_PCF50633
1659 INIT_DELAYED_WORK(>a02_charger_work
, gta02_charger_worker
);
1662 /* Glamo chip select optimization */
1663 /* *((u32 *)(S3C2410_MEMREG(((1 + 1) << 2)))) = 0x1280; */
1665 /* do not force soft ecc if we are asked to use hardware_ecc */
1666 if (hardware_ecc_str
[0] == '1')
1667 gta02_nand_info
.software_ecc
= 0;
1669 s3c_device_usb
.dev
.platform_data
= >a02_usb_info
;
1670 s3c_device_nand
.dev
.platform_data
= >a02_nand_info
;
1671 s3c_device_sdi
.dev
.platform_data
= >a02_s3c_mmc_cfg
;
1673 /* acc sensor chip selects */
1674 s3c2410_gpio_setpin(S3C2410_GPD12
, 1);
1675 s3c2410_gpio_cfgpin(S3C2410_GPD12
, S3C2410_GPIO_OUTPUT
);
1676 s3c2410_gpio_setpin(S3C2410_GPD13
, 1);
1677 s3c2410_gpio_cfgpin(S3C2410_GPD13
, S3C2410_GPIO_OUTPUT
);
1680 s3c24xx_udc_set_platdata(>a02_udc_cfg
);
1681 s3c_i2c0_set_platdata(NULL
);
1682 set_s3c2410ts_info(>a02_ts_cfg
);
1684 mangle_glamo_res_by_system_rev();
1686 i2c_register_board_info(0, gta02_i2c_devs
, ARRAY_SIZE(gta02_i2c_devs
));
1687 spi_register_board_info(gta02_spi_board_info
,
1688 ARRAY_SIZE(gta02_spi_board_info
));
1690 #ifdef CONFIG_CHARGER_PCF50633
1691 mangle_pmu_pdata_by_system_rev();
1694 platform_add_devices(gta02_devices
, ARRAY_SIZE(gta02_devices
));
1698 /* Make sure the modem can wake us up */
1699 set_irq_type(GTA02_IRQ_MODEM
, IRQ_TYPE_EDGE_RISING
);
1700 rc
= request_irq(GTA02_IRQ_MODEM
, gta02_modem_irq
, IRQF_DISABLED
,
1703 printk(KERN_ERR
"GTA02: can't request GSM modem wakeup IRQ\n");
1704 enable_irq_wake(GTA02_IRQ_MODEM
);
1706 /* Make sure the wifi module can wake us up*/
1707 set_irq_type(GTA02_IRQ_WLAN_GPIO1
, IRQ_TYPE_EDGE_RISING
);
1708 rc
= request_irq(GTA02_IRQ_WLAN_GPIO1
, ar6000_wow_irq
, IRQF_DISABLED
,
1712 printk(KERN_ERR
"GTA02: can't request ar6k wakeup IRQ\n");
1713 enable_irq_wake(GTA02_IRQ_WLAN_GPIO1
);
1715 pm_power_off
= gta02_poweroff
;
1717 /* Register the HDQ and vibrator as children of pwm device */
1718 #ifdef CONFIG_HDQ_GPIO_BITBANG
1719 gta02_hdq_device
.dev
.parent
= &s3c24xx_pwm_device
.dev
;
1720 platform_device_register(>a02_hdq_device
);
1722 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
1723 gta02_vibrator_dev
.dev
.parent
= &s3c24xx_pwm_device
.dev
;
1724 platform_device_register(>a02_vibrator_dev
);
1728 void DEBUG_LED(int n
)
1732 s3c2410_gpio_setpin(GTA02_GPIO_PWR_LED1
, 1);
1735 s3c2410_gpio_setpin(GTA02_GPIO_PWR_LED2
, 1);
1738 s3c2410_gpio_setpin(GTA02_GPIO_AUX_LED
, 1);
1742 EXPORT_SYMBOL_GPL(DEBUG_LED
);
1744 MACHINE_START(NEO1973_GTA02
, "GTA02")
1745 .phys_io
= S3C2410_PA_UART
,
1746 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
1747 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
1748 .map_io
= gta02_map_io
,
1749 .init_irq
= s3c24xx_init_irq
,
1750 .init_machine
= gta02_machine_init
,
1751 .timer
= &s3c24xx_timer
,