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/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/i2c.h>
49 #include <linux/backlight.h>
50 #include <linux/regulator/machine.h>
52 #include <linux/mfd/pcf50633/core.h>
53 #include <linux/mfd/pcf50633/mbc.h>
54 #include <linux/mfd/pcf50633/adc.h>
55 #include <linux/mfd/pcf50633/gpio.h>
56 #include <linux/mfd/pcf50633/pmic.h>
58 #include <linux/lis302dl.h>
60 #include <asm/mach/arch.h>
61 #include <asm/mach/map.h>
62 #include <asm/mach/irq.h>
64 #include <mach/hardware.h>
67 #include <asm/mach-types.h>
69 #include <mach/regs-irq.h>
70 #include <mach/regs-gpio.h>
71 #include <mach/regs-gpioj.h>
76 #include <mach/spi-gpio.h>
77 #include <mach/regs-mem.h>
78 #include <mach/spi-gpio.h>
82 #include <mach/gta02.h>
84 #include <plat/regs-serial.h>
85 #include <plat/nand.h>
86 #include <plat/devs.h>
91 #include <plat/usb-control.h>
92 #include <plat/regs-timer.h>
94 #include <mach/gta02-pm-gsm.h>
95 #include <mach/gta02-pm-gps.h>
96 #include <mach/gta02-pm-wlan.h>
98 #include <linux/jbt6k74.h>
99 #include <linux/glamofb.h>
101 #include <linux/hdq.h>
102 #include <linux/bq27000_battery.h>
104 #include <linux/touchscreen/ts_filter_chain.h>
105 #ifdef CONFIG_TOUCHSCREEN_FILTER
106 #include <linux/touchscreen/ts_filter_linear.h>
107 #include <linux/touchscreen/ts_filter_mean.h>
108 #include <linux/touchscreen/ts_filter_median.h>
109 #include <linux/touchscreen/ts_filter_group.h>
114 #include <linux/gta02-vibrator.h>
115 #include <linux/gta02-shadow.h>
117 /* arbitrates which sensor IRQ owns the shared SPI bus */
118 static spinlock_t motion_irq_lock
;
121 /* -------------------------------------------------------------------------------
124 * Calls into vibrator and hdq and based on the return values
125 * determines if we the FIQ source be kept alive
128 #define DIVISOR_FROM_US(x) ((x) << 3)
130 #ifdef CONFIG_HDQ_GPIO_BITBANG
131 #define FIQ_DIVISOR_HDQ DIVISOR_FROM_US(HDQ_SAMPLE_PERIOD_US)
132 extern int hdq_fiq_handler(void);
135 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
136 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
137 extern int gta02_vibrator_fiq_handler(void);
140 #if defined(CONFIG_LEDS_GTA02_VIBRATOR) || defined(CONFIG_HDQ_GPIO_BITBANG)
142 /* Global data related to our fiq source */
143 static u32 gta02_fiq_ack_mask
;
144 static struct s3c2410_pwm gta02_fiq_pwm_timer
;
145 static u16 gta02_fiq_timer_index
;
146 static int gta02_fiq_irq
;
148 static void gta02_fiq_handler(void)
150 u16 divisor
= 0xffff;
152 /* Vibrator servicing */
154 /* disable further timer interrupts if nobody has any work
155 * or adjust rate according to who still has work
157 * CAUTION: it means forground code must disable FIQ around
158 * its own non-atomic S3C2410_INTMSK changes... not common
159 * thankfully and taken care of by the fiq-basis patch
162 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
163 if (gta02_vibrator_fiq_handler())
164 divisor
= FIQ_DIVISOR_VIBRATOR
;
167 #ifdef CONFIG_HDQ_GPIO_BITBANG
168 if (hdq_fiq_handler())
169 divisor
= FIQ_DIVISOR_HDQ
;
172 if (divisor
== 0xffff) /* mask the fiq irq source */
173 __raw_writel(__raw_readl(S3C2410_INTMSK
) | gta02_fiq_ack_mask
,
175 else /* still working, maybe at a different rate */
176 __raw_writel(divisor
, S3C2410_TCNTB(gta02_fiq_timer_index
));
178 __raw_writel(gta02_fiq_ack_mask
, S3C2410_SRCPND
);
181 static void gta02_fiq_kick(void)
186 /* we have to take care about FIQ because this modification is
187 * non-atomic, FIQ could come in after the read and before the
188 * writeback and its changes to the register would be lost
189 * (platform INTMSK mod code is taken care of already)
191 local_save_flags(flags
);
193 /* allow FIQs to resume */
194 __raw_writel(__raw_readl(S3C2410_INTMSK
) &
195 ~(1 << (gta02_fiq_irq
- S3C2410_CPUIRQ_OFFSET
)),
197 tcon
= __raw_readl(S3C2410_TCON
) & ~S3C2410_TCON_T3START
;
198 /* fake the timer to a count of 1 */
199 __raw_writel(1, S3C2410_TCNTB(gta02_fiq_timer_index
));
200 __raw_writel(tcon
| S3C2410_TCON_T3MANUALUPD
, S3C2410_TCON
);
201 __raw_writel(tcon
| S3C2410_TCON_T3MANUALUPD
| S3C2410_TCON_T3START
,
203 __raw_writel(tcon
| S3C2410_TCON_T3START
, S3C2410_TCON
);
204 local_irq_restore(flags
);
207 static int gta02_fiq_enable(void)
209 int irq_index_fiq
= IRQ_TIMER3
;
214 gta02_fiq_irq
= irq_index_fiq
;
215 gta02_fiq_ack_mask
= 1 << (irq_index_fiq
- S3C2410_CPUIRQ_OFFSET
);
216 gta02_fiq_timer_index
= (irq_index_fiq
- IRQ_TIMER0
);
218 /* set up the timer to operate as a pwm device */
220 rc
= s3c2410_pwm_init(>a02_fiq_pwm_timer
);
224 gta02_fiq_pwm_timer
.timerid
= PWM0
+ gta02_fiq_timer_index
;
225 gta02_fiq_pwm_timer
.prescaler
= (6 - 1) / 2;
226 gta02_fiq_pwm_timer
.divider
= S3C2410_TCFG1_MUX3_DIV2
;
227 /* default rate == ~32us */
228 gta02_fiq_pwm_timer
.counter
= gta02_fiq_pwm_timer
.comparer
= 3000;
230 rc
= s3c2410_pwm_enable(>a02_fiq_pwm_timer
);
234 s3c2410_pwm_start(>a02_fiq_pwm_timer
);
236 /* let our selected interrupt be a magic FIQ interrupt */
237 __raw_writel(gta02_fiq_ack_mask
, S3C2410_INTMOD
);
239 /* it's ready to go as soon as we unmask the source in S3C2410_INTMSK */
242 set_fiq_c_handler(gta02_fiq_handler
);
247 printk(KERN_ERR
"Could not initialize FIQ for GTA02: %d\n", rc
);
252 static void gta02_fiq_disable(void)
254 __raw_writel(0, S3C2410_INTMOD
);
256 gta02_fiq_irq
= 0; /* no active source interrupt now either */
259 /* -------------------- /GTA02 FIQ Handler ------------------------------------- */
264 * this gets called every 1ms when we paniced.
267 static long gta02_panic_blink(long count
)
270 static long last_blink
;
273 if (count
- last_blink
< 100) /* 200ms period, fast blink */
277 s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED
, S3C2410_GPIO_OUTPUT
);
278 gta02_gpb_setpin(GTA02_GPIO_AUX_LED
, led
);
286 * returns PCB revision information in b9,b8 and b2,b1,b0
287 * Pre-GTA02 A6 returns 0x000
288 * GTA02 A6 returns 0x101
292 int gta02_get_pcb_revision(void)
296 static unsigned long pinlist
[] = {
303 static int pin_offset
[] = {
307 for (n
= 0 ; n
< ARRAY_SIZE(pinlist
); n
++) {
309 * set the PCB version GPIO to be pulled-down input
310 * force low briefly first
312 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
313 s3c2410_gpio_setpin(pinlist
[n
], 0);
314 /* misnomer: it is a pullDOWN in 2442 */
315 s3c2410_gpio_pullup(pinlist
[n
], 1);
316 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_INPUT
);
320 if (s3c2410_gpio_getpin(pinlist
[n
]))
321 u
|= 1 << pin_offset
[n
];
324 * when not being interrogated, all of the revision GPIO
325 * are set to output HIGH without pulldown so no current flows
326 * if they are NC or pulled up.
328 s3c2410_gpio_setpin(pinlist
[n
], 1);
329 s3c2410_gpio_cfgpin(pinlist
[n
], S3C2410_GPIO_OUTPUT
);
330 /* misnomer: it is a pullDOWN in 2442 */
331 s3c2410_gpio_pullup(pinlist
[n
], 0);
337 struct platform_device gta02_resume_reason_device
= {
338 .name
= "gta02-resume",
342 static struct map_desc gta02_iodesc
[] __initdata
= {
344 .virtual = 0xe0000000,
345 .pfn
= __phys_to_pfn(S3C2410_CS3
+0x01000000),
351 #define UCON (S3C2410_UCON_DEFAULT | S3C2443_UCON_RXERR_IRQEN)
352 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
353 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
355 static struct s3c2410_uartcfg gta02_uartcfgs
[] = {
380 struct pcf50633
*gta02_pcf
;
382 #ifdef CONFIG_CHARGER_PCF50633
383 #ifdef CONFIG_HDQ_GPIO_BITBANG
384 static int gta02_get_charger_online_status(void)
386 struct pcf50633
*pcf
= gta02_pcf
;
388 return pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ONLINE
;
391 static int gta02_get_charger_active_status(void)
393 struct pcf50633
*pcf
= gta02_pcf
;
395 return pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ACTIVE
;
399 #define ADC_NOM_CHG_DETECT_1A 6
400 #define ADC_NOM_CHG_DETECT_USB 43
403 gta02_configure_pmu_for_charger(struct pcf50633
*pcf
, void *unused
, int res
)
407 /* Interpret charger type */
408 if (res
< ((ADC_NOM_CHG_DETECT_USB
+ ADC_NOM_CHG_DETECT_1A
) / 2)) {
410 /* Stop GPO driving out now that we have a IA charger */
411 pcf50633_gpio_set(pcf
, PCF50633_GPO
, 0);
417 pcf50633_mbc_usb_curlim_set(pcf
, ma
);
420 static struct delayed_work gta02_charger_work
;
421 static int gta02_usb_vbus_draw
;
423 static void gta02_charger_worker(struct work_struct
*work
)
425 struct pcf50633
*pcf
= gta02_pcf
;
427 if (gta02_usb_vbus_draw
) {
428 pcf50633_mbc_usb_curlim_set(pcf
, gta02_usb_vbus_draw
);
431 #ifdef CONFIG_PCF50633_ADC
432 pcf50633_adc_async_read(pcf
,
433 PCF50633_ADCC1_MUX_ADCIN1
,
434 PCF50633_ADCC1_AVERAGE_16
,
435 gta02_configure_pmu_for_charger
, NULL
);
437 /* If the PCF50633 ADC is disabled we fallback to a 100mA limit for safety. */
438 pcf50633_mbc_usb_curlim_set(pcf
, 100);
444 #define GTA02_CHARGER_CONFIGURE_TIMEOUT ((3000 * HZ) / 1000)
445 static void gta02_pmu_event_callback(struct pcf50633
*pcf
, int irq
)
447 if (irq
== PCF50633_IRQ_USBINS
) {
448 schedule_delayed_work(>a02_charger_work
,
449 GTA02_CHARGER_CONFIGURE_TIMEOUT
);
451 } else if (irq
== PCF50633_IRQ_USBREM
) {
452 cancel_delayed_work_sync(>a02_charger_work
);
453 gta02_usb_vbus_draw
= 0;
457 static void gta02_pmu_force_shutdown(struct pcf50633
*pcf
)
459 pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_OOCSHDWN
,
460 PCF50633_OOCSHDWN_GOSTDBY
, PCF50633_OOCSHDWN_GOSTDBY
);
464 static void gta02_udc_vbus_draw(unsigned int ma
)
469 gta02_usb_vbus_draw
= ma
;
471 schedule_delayed_work(>a02_charger_work
,
472 GTA02_CHARGER_CONFIGURE_TIMEOUT
);
475 static int gta02_udc_vbus_status(void)
477 struct pcf50633
*pcf
= gta02_pcf
;
481 return !!(pcf50633_mbc_get_status(pcf
) & PCF50633_MBC_USB_ONLINE
);
484 #else /* !CONFIG_CHARGER_PCF50633 */
485 #ifdef CONFIG_HDQ_GPIO_BITBANG
486 #define gta02_get_charger_online_status NULL
487 #define gta02_get_charger_active_status NULL
489 #define gta02_pmu_event_callback NULL
490 #define gta02_udc_vbus_draw NULL
491 #define gta02_udc_vbus_status NULL
495 static struct platform_device gta02_pm_gps_dev
= {
496 .name
= "gta02-pm-gps",
499 static struct platform_device gta02_pm_bt_dev
= {
500 .name
= "gta02-pm-bt",
503 static struct platform_device gta02_pm_gsm_dev
= {
504 .name
= "gta02-pm-gsm",
507 static struct platform_device gta02_pm_wlan_dev
= {
508 .name
= "gta02-pm-wlan",
511 /* this is called when pc50633 is probed, unfortunately quite late in the
512 * day since it is an I2C bus device. Here we can belatedly define some
513 * platform devices with the advantage that we can mark the pcf50633 as the
514 * parent. This makes them get suspended and resumed with their parent
515 * the pcf50633 still around.
518 static struct platform_device gta02_glamo_dev
;
519 static void mangle_glamo_res_by_system_rev(void);
521 static void gta02_pmu_attach_child_devices(struct pcf50633
*pcf
);
522 static void gta02_pmu_regulator_registered(struct pcf50633
*pcf
, int id
);
524 static struct regulator_consumer_supply ldo4_consumers
[] = {
526 .dev
= >a02_pm_bt_dev
.dev
,
531 static struct regulator_consumer_supply ldo5_consumers
[] = {
533 .dev
= >a02_pm_gps_dev
.dev
,
539 * We need this dummy thing to fill the regulator consumers
541 static struct platform_device gta02_mmc_dev
= {
542 /* details filled in by glamo core */
545 static struct regulator_consumer_supply hcldo_consumers
[] = {
547 .dev
= >a02_mmc_dev
.dev
,
552 static char *gta02_batteries
[] = {
556 #ifdef CONFIG_CHARGER_PCF50633
558 struct pcf50633_platform_data gta02_pcf_pdata
= {
560 [0] = PCF50633_INT1_USBINS
|
561 PCF50633_INT1_USBREM
|
563 [1] = PCF50633_INT2_ONKEYF
,
564 [2] = PCF50633_INT3_ONKEY1S
,
565 [3] = PCF50633_INT4_LOWSYS
|
566 PCF50633_INT4_LOWBAT
|
567 PCF50633_INT4_HIGHTMP
,
570 .batteries
= gta02_batteries
,
571 .num_batteries
= ARRAY_SIZE(gta02_batteries
),
572 .charging_restart_interval
= (900 * HZ
),
573 .chg_ref_current_ma
= 1000,
576 [PCF50633_REGULATOR_AUTO
] = {
581 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
588 .num_consumer_supplies
= 0,
590 [PCF50633_REGULATOR_DOWN1
] = {
595 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
599 .num_consumer_supplies
= 0,
601 [PCF50633_REGULATOR_DOWN2
] = {
606 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
613 .num_consumer_supplies
= 0,
615 [PCF50633_REGULATOR_HCLDO
] = {
620 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
621 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
624 .num_consumer_supplies
= 1,
625 .consumer_supplies
= hcldo_consumers
,
627 [PCF50633_REGULATOR_LDO1
] = {
629 .name
= "GSENSOR_3V3",
632 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
635 .num_consumer_supplies
= 0,
637 [PCF50633_REGULATOR_LDO2
] = {
642 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
645 .num_consumer_supplies
= 0,
647 [PCF50633_REGULATOR_LDO3
] = {
651 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
654 .num_consumer_supplies
= 0,
656 [PCF50633_REGULATOR_LDO4
] = {
661 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
664 .num_consumer_supplies
= 1,
665 .consumer_supplies
= ldo4_consumers
,
667 [PCF50633_REGULATOR_LDO5
] = {
672 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
678 .num_consumer_supplies
= 1,
679 .consumer_supplies
= ldo5_consumers
,
681 [PCF50633_REGULATOR_LDO6
] = {
686 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
688 .num_consumer_supplies
= 0,
690 [PCF50633_REGULATOR_MEMLDO
] = {
694 .valid_modes_mask
= REGULATOR_MODE_NORMAL
,
699 .num_consumer_supplies
= 0,
703 .probe_done
= gta02_pmu_attach_child_devices
,
704 .regulator_registered
= gta02_pmu_regulator_registered
,
705 .mbc_event_callback
= gta02_pmu_event_callback
,
706 .force_shutdown
= gta02_pmu_force_shutdown
,
709 static void mangle_pmu_pdata_by_system_rev(void)
711 struct regulator_init_data
*reg_init_data
;
713 reg_init_data
= gta02_pcf_pdata
.reg_init_data
;
715 switch (S3C_SYSTEM_REV_ATAG
) {
716 case GTA02v1_SYSTEM_REV
:
717 /* FIXME: this is only in v1 due to wrong PMU variant */
718 reg_init_data
[PCF50633_REGULATOR_DOWN2
]
719 .constraints
.state_mem
.enabled
= 1;
721 case GTA02v2_SYSTEM_REV
:
722 case GTA02v3_SYSTEM_REV
:
723 case GTA02v4_SYSTEM_REV
:
724 case GTA02v5_SYSTEM_REV
:
725 case GTA02v6_SYSTEM_REV
:
726 reg_init_data
[PCF50633_REGULATOR_LDO1
]
727 .constraints
.min_uV
= 3300000;
728 reg_init_data
[PCF50633_REGULATOR_LDO1
]
729 .constraints
.min_uV
= 3300000;
730 reg_init_data
[PCF50633_REGULATOR_LDO1
]
731 .constraints
.state_mem
.enabled
= 0;
733 reg_init_data
[PCF50633_REGULATOR_LDO5
]
734 .constraints
.min_uV
= 3000000;
735 reg_init_data
[PCF50633_REGULATOR_LDO5
]
736 .constraints
.max_uV
= 3000000;
738 reg_init_data
[PCF50633_REGULATOR_LDO6
]
739 .constraints
.min_uV
= 3000000;
740 reg_init_data
[PCF50633_REGULATOR_LDO6
]
741 .constraints
.max_uV
= 3000000;
742 reg_init_data
[PCF50633_REGULATOR_LDO6
]
743 .constraints
.apply_uV
= 1;
752 #ifdef CONFIG_HDQ_GPIO_BITBANG
753 /* BQ27000 Battery */
755 struct bq27000_platform_data bq27000_pdata
= {
758 .hdq_read
= hdq_read
,
759 .hdq_write
= hdq_write
,
760 .hdq_initialized
= hdq_initialized
,
761 .get_charger_online_status
= gta02_get_charger_online_status
,
762 .get_charger_active_status
= gta02_get_charger_active_status
765 struct platform_device bq27000_battery_device
= {
766 .name
= "bq27000-battery",
768 .platform_data
= &bq27000_pdata
,
774 static void gta02_hdq_attach_child_devices(struct device
*parent_device
)
776 switch (S3C_SYSTEM_REV_ATAG
) {
777 case GTA02v5_SYSTEM_REV
:
778 case GTA02v6_SYSTEM_REV
:
779 bq27000_battery_device
.dev
.parent
= parent_device
;
780 platform_device_register(&bq27000_battery_device
);
787 static void gta02_hdq_gpio_direction_out(void)
789 s3c2410_gpio_cfgpin(GTA02v5_GPIO_HDQ
, S3C2410_GPIO_OUTPUT
);
792 static void gta02_hdq_gpio_direction_in(void)
794 s3c2410_gpio_cfgpin(GTA02v5_GPIO_HDQ
, S3C2410_GPIO_INPUT
);
797 static void gta02_hdq_gpio_set_value(int val
)
800 s3c2410_gpio_setpin(GTA02v5_GPIO_HDQ
, val
);
803 static int gta02_hdq_gpio_get_value(void)
805 return s3c2410_gpio_getpin(GTA02v5_GPIO_HDQ
);
808 static struct resource gta02_hdq_resources
[] = {
810 .start
= GTA02v5_GPIO_HDQ
,
811 .end
= GTA02v5_GPIO_HDQ
,
815 struct hdq_platform_data gta02_hdq_platform_data
= {
816 .attach_child_devices
= gta02_hdq_attach_child_devices
,
817 .gpio_dir_out
= gta02_hdq_gpio_direction_out
,
818 .gpio_dir_in
= gta02_hdq_gpio_direction_in
,
819 .gpio_set
= gta02_hdq_gpio_set_value
,
820 .gpio_get
= gta02_hdq_gpio_get_value
,
822 .enable_fiq
= gta02_fiq_enable
,
823 .disable_fiq
= gta02_fiq_disable
,
824 .kick_fiq
= gta02_fiq_kick
,
828 struct platform_device gta02_hdq_device
= {
831 .resource
= gta02_hdq_resources
,
833 .platform_data
= >a02_hdq_platform_data
,
839 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
840 /* vibrator (child of FIQ) */
842 static struct resource gta02_vibrator_resources
[] = {
844 .start
= GTA02_GPIO_VIBRATOR_ON
,
845 .end
= GTA02_GPIO_VIBRATOR_ON
,
848 struct gta02_vib_platform_data gta02_vib_pdata
= {
849 .enable_fiq
= gta02_fiq_enable
,
850 .disable_fiq
= gta02_fiq_disable
,
851 .kick_fiq
= gta02_fiq_kick
,
854 static struct platform_device gta02_vibrator_dev
= {
855 .name
= "gta02-vibrator",
856 .num_resources
= ARRAY_SIZE(gta02_vibrator_resources
),
857 .resource
= gta02_vibrator_resources
,
859 .platform_data
= >a02_vib_pdata
,
866 #define GTA02_FLASH_BASE S3C2410_CS3 /* GCS3 */
867 #define GTA02_FLASH_SIZE 0x200000 /* 2MBytes */
869 static struct physmap_flash_data gta02_nor_flash_data
= {
873 static struct resource gta02_nor_flash_resource
= {
874 .start
= GTA02_FLASH_BASE
,
875 .end
= GTA02_FLASH_BASE
+ GTA02_FLASH_SIZE
- 1,
876 .flags
= IORESOURCE_MEM
,
879 static struct platform_device gta02_nor_flash
= {
880 .name
= "physmap-flash",
883 .platform_data
= >a02_nor_flash_data
,
885 .resource
= >a02_nor_flash_resource
,
890 struct platform_device s3c24xx_pwm_device
= {
891 .name
= "s3c24xx_pwm",
895 static struct i2c_board_info gta02_i2c_devs
[] __initdata
= {
897 I2C_BOARD_INFO("pcf50633", 0x73),
898 .irq
= GTA02_IRQ_PCF50633
,
899 .platform_data
= >a02_pcf_pdata
,
902 I2C_BOARD_INFO("wm8753", 0x1a),
906 static struct s3c2410_nand_set gta02_nand_sets
[] = {
908 .name
= "neo1973-nand",
910 .flags
= S3C2410_NAND_BBT
,
914 /* choose a set of timings derived from S3C@2442B MCP54
915 * data sheet (K5D2G13ACM-D075 MCP Memory)
918 static struct s3c2410_platform_nand gta02_nand_info
= {
922 .nr_sets
= ARRAY_SIZE(gta02_nand_sets
),
923 .sets
= gta02_nand_sets
,
928 static void gta02_s3c_mmc_set_power(unsigned char power_mode
,
931 static int is_on
= -1;
934 on
= power_mode
== MMC_POWER_ON
|| power_mode
== MMC_POWER_UP
;
936 gta02_wlan_reset(!on
);
941 static struct s3c24xx_mci_pdata gta02_s3c_mmc_cfg
= {
942 .set_power
= gta02_s3c_mmc_set_power
,
945 static void gta02_udc_command(enum s3c2410_udc_cmd_e cmd
)
948 case S3C2410_UDC_P_ENABLE
:
949 printk(KERN_DEBUG
"%s S3C2410_UDC_P_ENABLE\n", __func__
);
950 gta02_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 1);
952 case S3C2410_UDC_P_DISABLE
:
953 printk(KERN_DEBUG
"%s S3C2410_UDC_P_DISABLE\n", __func__
);
954 gta02_gpb_setpin(GTA02_GPIO_USB_PULLUP
, 0);
956 case S3C2410_UDC_P_RESET
:
957 printk(KERN_DEBUG
"%s S3C2410_UDC_P_RESET\n", __func__
);
965 /* get PMU to set USB current limit accordingly */
967 static struct s3c2410_udc_mach_info gta02_udc_cfg
= {
968 .vbus_draw
= gta02_udc_vbus_draw
,
969 .udc_command
= gta02_udc_command
,
970 /* .get_vbus_status = gta02_udc_vbus_status,*/
974 /* Touchscreen configuration. */
976 #ifdef CONFIG_TOUCHSCREEN_FILTER
977 const static struct ts_filter_group_configuration gta02_ts_group
= {
980 .threshold
= 6, /* At least half of the points in a group. */
984 const static struct ts_filter_median_configuration gta02_ts_median
= {
986 .decimation_below
= 3,
987 .decimation_threshold
= 8 * 3,
988 .decimation_above
= 4,
991 const static struct ts_filter_mean_configuration gta02_ts_mean
= {
995 const static struct ts_filter_linear_configuration gta02_ts_linear
= {
996 .constants
= {1, 0, 0, 0, 1, 0, 1}, /* Don't modify coords. */
1002 const static struct ts_filter_chain_configuration gta02_filter_configuration
[] =
1004 #ifdef CONFIG_TOUCHSCREEN_FILTER
1005 {&ts_filter_group_api
, >a02_ts_group
.config
},
1006 {&ts_filter_median_api
, >a02_ts_median
.config
},
1007 {&ts_filter_mean_api
, >a02_ts_mean
.config
},
1008 {&ts_filter_linear_api
, >a02_ts_linear
.config
},
1013 const static struct s3c2410_ts_mach_info gta02_ts_cfg
= {
1015 .presc
= 0xff, /* slow as we can go */
1016 .filter_config
= gta02_filter_configuration
,
1021 static void gta02_bl_set_intensity(int intensity
)
1023 struct pcf50633
*pcf
= gta02_pcf
;
1024 int old_intensity
= pcf50633_reg_read(pcf
, PCF50633_REG_LEDOUT
);
1030 * One code path that leads here is from a kernel panic. Trying to turn
1031 * the backlight on just gives us a nearly endless stream of complaints
1032 * and accomplishes nothing. We can't win. Just give up.
1034 * In the unlikely event that there's another path leading here while
1035 * we're atomic, we print at least a warning.
1039 "gta02_bl_set_intensity called while atomic\n");
1043 if (!(pcf50633_reg_read(pcf
, PCF50633_REG_LEDENA
) & 3))
1046 old_intensity
= pcf50633_reg_read(pcf
, PCF50633_REG_LEDOUT
);
1048 if (intensity
== old_intensity
)
1051 /* We can't do this anywhere else */
1052 pcf50633_reg_write(pcf
, PCF50633_REG_LEDDIM
, 5);
1055 * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
1056 * if seen, you have to re-enable the LED unit
1058 if (!intensity
|| !old_intensity
)
1059 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0);
1061 if (!intensity
) /* illegal to set LEDOUT to 0 */
1062 ret
= pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_LEDOUT
, 0x3f,
1065 ret
= pcf50633_reg_set_bit_mask(pcf
, PCF50633_REG_LEDOUT
, 0x3f,
1069 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 2);
1073 static struct generic_bl_info gta02_bl_info
= {
1075 .max_intensity
= 0xff,
1076 .default_intensity
= 0xff,
1077 .set_bl_intensity
= gta02_bl_set_intensity
,
1080 static struct platform_device gta02_bl_dev
= {
1081 .name
= "generic-bl",
1084 .platform_data
= >a02_bl_info
,
1088 /* SPI: LCM control interface attached to Glamo3362 */
1090 static void gta02_jbt6k74_reset(int devidx
, int level
)
1092 glamo_lcm_reset(level
);
1095 static void gta02_jbt6k74_probe_completed(struct device
*dev
)
1097 struct pcf50633
*pcf
= gta02_pcf
;
1099 /* Switch on backlight. Qi does not do it for us */
1100 pcf50633_reg_write(pcf
, PCF50633_REG_LEDOUT
, 0x01);
1101 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0x00);
1102 pcf50633_reg_write(pcf
, PCF50633_REG_LEDDIM
, 0x01);
1103 pcf50633_reg_write(pcf
, PCF50633_REG_LEDENA
, 0x01);
1105 gta02_bl_dev
.dev
.parent
= dev
;
1106 platform_device_register(>a02_bl_dev
);
1109 const struct jbt6k74_platform_data jbt6k74_pdata
= {
1110 .reset
= gta02_jbt6k74_reset
,
1111 .probe_completed
= gta02_jbt6k74_probe_completed
,
1114 #if 0 /* currently this is not used and we use gpio spi */
1115 static struct glamo_spi_info glamo_spi_cfg
= {
1116 .board_size
= ARRAY_SIZE(gta02_spi_board_info
),
1117 .board_info
= gta02_spi_board_info
,
1121 static struct glamo_spigpio_info glamo_spigpio_cfg
= {
1122 .pin_clk
= GLAMO_GPIO10_OUTPUT
,
1123 .pin_mosi
= GLAMO_GPIO11_OUTPUT
,
1124 .pin_cs
= GLAMO_GPIO12_OUTPUT
,
1129 /*----------- SPI: Accelerometers attached to SPI of s3c244x ----------------- */
1131 void gta02_lis302dl_suspend_io(struct lis302dl_info
*lis
, int resume
)
1133 struct lis302dl_platform_data
*pdata
= lis
->pdata
;
1137 * we don't want to power them with a high level
1138 * because GSENSOR_3V3 is not up during suspend
1140 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 0);
1141 s3c2410_gpio_setpin(pdata
->pin_clk
, 0);
1142 s3c2410_gpio_setpin(pdata
->pin_mosi
, 0);
1143 /* misnomer: it is a pullDOWN in 2442 */
1144 s3c2410_gpio_pullup(pdata
->pin_miso
, 1);
1148 /* back to normal */
1149 s3c2410_gpio_setpin(pdata
->pin_chip_select
, 1);
1150 s3c2410_gpio_setpin(pdata
->pin_clk
, 1);
1151 /* misnomer: it is a pullDOWN in 2442 */
1152 s3c2410_gpio_pullup(pdata
->pin_miso
, 0);
1154 s3c2410_gpio_cfgpin(pdata
->pin_chip_select
, S3C2410_GPIO_OUTPUT
);
1155 s3c2410_gpio_cfgpin(pdata
->pin_clk
, S3C2410_GPIO_OUTPUT
);
1156 s3c2410_gpio_cfgpin(pdata
->pin_mosi
, S3C2410_GPIO_OUTPUT
);
1157 s3c2410_gpio_cfgpin(pdata
->pin_miso
, S3C2410_GPIO_INPUT
);
1161 struct lis302dl_platform_data lis302_pdata_top
= {
1162 .name
= "lis302-1 (top)",
1163 .pin_chip_select
= S3C2410_GPD12
,
1164 .pin_clk
= S3C2410_GPG7
,
1165 .pin_mosi
= S3C2410_GPG6
,
1166 .pin_miso
= S3C2410_GPG5
,
1167 .interrupt
= GTA02_IRQ_GSENSOR_1
,
1168 .open_drain
= 1, /* altered at runtime by PCB rev */
1169 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1172 struct lis302dl_platform_data lis302_pdata_bottom
= {
1173 .name
= "lis302-2 (bottom)",
1174 .pin_chip_select
= S3C2410_GPD13
,
1175 .pin_clk
= S3C2410_GPG7
,
1176 .pin_mosi
= S3C2410_GPG6
,
1177 .pin_miso
= S3C2410_GPG5
,
1178 .interrupt
= GTA02_IRQ_GSENSOR_2
,
1179 .open_drain
= 1, /* altered at runtime by PCB rev */
1180 .lis302dl_suspend_io
= gta02_lis302dl_suspend_io
,
1183 static struct spi_board_info gta02_spi_board_info
[] = {
1185 .modalias
= "jbt6k74",
1187 .platform_data
= &jbt6k74_pdata
,
1188 /* controller_data */
1190 .max_speed_hz
= 100 * 1000,
1195 .modalias
= "lis302dl",
1197 .platform_data
= &lis302_pdata_top
,
1198 /* controller_data */
1200 .max_speed_hz
= 100 * 1000,
1206 .modalias
= "lis302dl",
1208 .platform_data
= &lis302_pdata_bottom
,
1209 /* controller_data */
1211 .max_speed_hz
= 100 * 1000,
1218 static void gta02_lis302_chip_select(struct s3c2410_spigpio_info
*info
, int csid
, int cs
)
1222 * Huh... "quirk"... CS on this device is not really "CS" like you can
1225 * When it is 0 it selects SPI interface mode.
1226 * When it is 1 it selects I2C interface mode.
1228 * Because we have 2 devices on one interface we have to make sure
1229 * that the "disabled" device (actually in I2C mode) don't think we're
1232 * When we talk to the "enabled" device, the "disabled" device sees
1233 * the clocks as I2C clocks, creating havoc.
1235 * I2C sees MOSI going LOW while CLK HIGH as a START action, thus we
1236 * must ensure this is never issued.
1239 int cs_gpio
, other_cs_gpio
;
1241 cs_gpio
= csid
? S3C2410_GPD13
: S3C2410_GPD12
;
1242 other_cs_gpio
= (1 - csid
) ? S3C2410_GPD13
: S3C2410_GPD12
;
1245 if (cs
== BITBANG_CS_ACTIVE
) {
1246 s3c2410_gpio_setpin(other_cs_gpio
, 1);
1247 s3c2410_gpio_setpin(cs_gpio
, 1);
1248 s3c2410_gpio_setpin(info
->pin_clk
, 1);
1249 s3c2410_gpio_setpin(cs_gpio
, 0);
1251 s3c2410_gpio_setpin(cs_gpio
, 1);
1252 s3c2410_gpio_setpin(other_cs_gpio
, 1);
1256 static struct s3c2410_spigpio_info gta02_spigpio_cfg
= {
1257 .pin_clk
= S3C2410_GPG7
,
1258 .pin_mosi
= S3C2410_GPG6
,
1259 .pin_miso
= S3C2410_GPG5
,
1261 .num_chipselect
= 2,
1262 .chip_select
= gta02_lis302_chip_select
,
1263 .non_blocking_transfer
= 1,
1266 static struct platform_device gta02_spi_gpio_dev
= {
1267 .name
= "spi_s3c24xx_gpio",
1269 .platform_data
= >a02_spigpio_cfg
,
1273 /*----------- / SPI: Accelerometers attached to SPI of s3c244x ----------------- */
1275 static struct resource gta02_led_resources
[] = {
1277 .name
= "gta02-power:orange",
1278 .start
= GTA02_GPIO_PWR_LED1
,
1279 .end
= GTA02_GPIO_PWR_LED1
,
1281 .name
= "gta02-power:blue",
1282 .start
= GTA02_GPIO_PWR_LED2
,
1283 .end
= GTA02_GPIO_PWR_LED2
,
1285 .name
= "gta02-aux:red",
1286 .start
= GTA02_GPIO_AUX_LED
,
1287 .end
= GTA02_GPIO_AUX_LED
,
1291 struct platform_device gta02_led_dev
= {
1292 .name
= "gta02-led",
1293 .num_resources
= ARRAY_SIZE(gta02_led_resources
),
1294 .resource
= gta02_led_resources
,
1297 static struct resource gta02_button_resources
[] = {
1299 .start
= GTA02_GPIO_AUX_KEY
,
1300 .end
= GTA02_GPIO_AUX_KEY
,
1303 .start
= GTA02_GPIO_HOLD_KEY
,
1304 .end
= GTA02_GPIO_HOLD_KEY
,
1307 .start
= GTA02_GPIO_JACK_INSERT
,
1308 .end
= GTA02_GPIO_JACK_INSERT
,
1320 static struct platform_device gta02_button_dev
= {
1321 .name
= "gta02-button",
1322 .num_resources
= ARRAY_SIZE(gta02_button_resources
),
1323 .resource
= gta02_button_resources
,
1326 static struct platform_device gta02_pm_usbhost_dev
= {
1327 .name
= "gta02-pm-host",
1332 static struct s3c2410_hcd_info gta02_usb_info
= {
1334 .flags
= S3C_HCDFLG_USED
,
1341 static int glamo_irq_is_wired(void)
1347 * GTA02 S-Media IRQs prior to A5 are broken due to a lack of
1348 * a pullup on the INT# line. Check for the bad behaviour.
1350 s3c2410_gpio_setpin(S3C2410_GPG4
, 0);
1351 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_OUTP
);
1352 s3c2410_gpio_cfgpin(S3C2410_GPG4
, S3C2410_GPG4_INP
);
1354 * we force it low ourselves for a moment and resume being input.
1355 * If there is a pullup, it won't stay low for long. But if the
1356 * level converter is there as on < A5 revision, the weak keeper
1357 * on the input of the LC will hold the line low indefinitiely
1360 rc
= s3c2410_gpio_getpin(S3C2410_GPG4
);
1361 while ((!rc
) && ((count
++) < 10));
1362 if (rc
) { /* it got pulled back up, it's good */
1363 printk(KERN_INFO
"Detected S-Media IRQ# pullup, "
1364 "enabling interrupt\n");
1366 } else /* Gah we can't work with this level converter */
1367 printk(KERN_WARNING
"** Detected bad IRQ# circuit found"
1368 " on pre-A5 GTA02: S-Media interrupt disabled **\n");
1372 static int gta02_glamo_can_set_mmc_power(void)
1374 switch (S3C_SYSTEM_REV_ATAG
) {
1375 case GTA02v3_SYSTEM_REV
:
1376 case GTA02v4_SYSTEM_REV
:
1377 case GTA02v5_SYSTEM_REV
:
1378 case GTA02v6_SYSTEM_REV
:
1385 /* Smedia Glamo 3362 */
1388 * we crank down SD Card clock dynamically when GPS is powered
1391 static int gta02_glamo_mci_use_slow(void)
1393 return gta02_pm_gps_is_on();
1396 static void gta02_glamo_external_reset(int level
)
1398 s3c2410_gpio_setpin(GTA02_GPIO_3D_RESET
, level
);
1399 s3c2410_gpio_cfgpin(GTA02_GPIO_3D_RESET
, S3C2410_GPIO_OUTPUT
);
1402 static struct fb_videomode gta02_glamo_modes
[] = {
1414 .vmode
= FB_VMODE_NONINTERLACED
,
1426 .vmode
= FB_VMODE_NONINTERLACED
,
1431 static struct glamofb_platform_data gta02_glamo_pdata
= {
1434 .fb_mem_size
= 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
1436 .num_modes
= ARRAY_SIZE(gta02_glamo_modes
),
1437 .modes
= gta02_glamo_modes
,
1439 //.spi_info = &glamo_spi_cfg,
1440 .spigpio_info
= &glamo_spigpio_cfg
,
1442 /* glamo MMC function platform data */
1443 .mmc_dev
= >a02_mmc_dev
,
1444 .glamo_can_set_mci_power
= gta02_glamo_can_set_mmc_power
,
1445 .glamo_mci_use_slow
= gta02_glamo_mci_use_slow
,
1446 .glamo_irq_is_wired
= glamo_irq_is_wired
,
1447 .glamo_external_reset
= gta02_glamo_external_reset
1450 static struct resource gta02_glamo_resources
[] = {
1452 .start
= S3C2410_CS1
,
1453 .end
= S3C2410_CS1
+ 0x1000000 - 1,
1454 .flags
= IORESOURCE_MEM
,
1457 .start
= GTA02_IRQ_3D
,
1458 .end
= GTA02_IRQ_3D
,
1459 .flags
= IORESOURCE_IRQ
,
1462 .start
= GTA02_GPIO_3D_RESET
,
1463 .end
= GTA02_GPIO_3D_RESET
,
1467 static struct platform_device gta02_glamo_dev
= {
1468 .name
= "glamo3362",
1469 .num_resources
= ARRAY_SIZE(gta02_glamo_resources
),
1470 .resource
= gta02_glamo_resources
,
1472 .platform_data
= >a02_glamo_pdata
,
1476 static void mangle_glamo_res_by_system_rev(void)
1478 switch (S3C_SYSTEM_REV_ATAG
) {
1479 case GTA02v1_SYSTEM_REV
:
1482 gta02_glamo_resources
[2].start
= GTA02_GPIO_3D_RESET
;
1483 gta02_glamo_resources
[2].end
= GTA02_GPIO_3D_RESET
;
1487 switch (S3C_SYSTEM_REV_ATAG
) {
1488 case GTA02v1_SYSTEM_REV
:
1489 case GTA02v2_SYSTEM_REV
:
1490 case GTA02v3_SYSTEM_REV
:
1491 /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
1492 /* The hardware is missing a pull-up resistor and thus can't
1493 * support the Smedia Glamo IRQ */
1494 gta02_glamo_resources
[1].start
= 0;
1495 gta02_glamo_resources
[1].end
= 0;
1500 static void __init
gta02_map_io(void)
1502 s3c24xx_init_io(gta02_iodesc
, ARRAY_SIZE(gta02_iodesc
));
1503 s3c24xx_init_clocks(12000000);
1504 s3c24xx_init_uarts(gta02_uartcfgs
, ARRAY_SIZE(gta02_uartcfgs
));
1507 static irqreturn_t
gta02_modem_irq(int irq
, void *param
)
1509 /* printk(KERN_DEBUG "modem wakeup interrupt\n");*/
1510 gta_gsm_interrupts
++;
1514 static irqreturn_t
ar6000_wow_irq(int irq
, void *param
)
1516 /* printk(KERN_DEBUG "ar6000_wow interrupt\n");*/
1523 static char hardware_ecc_str
[4] __initdata
= "";
1525 static int __init
hardware_ecc_setup(char *str
)
1528 strlcpy(hardware_ecc_str
, str
, sizeof(hardware_ecc_str
));
1532 __setup("hardware_ecc=", hardware_ecc_setup
);
1534 /* these are the guys that don't need to be children of PMU */
1536 static struct platform_device
*gta02_devices
[] __initdata
= {
1540 &s3c_device_usbgadget
,
1544 &s3c24xx_pwm_device
,
1546 >a02_pm_wlan_dev
, /* not dependent on PMU */
1552 /* these guys DO need to be children of PMU */
1554 static struct platform_device
*gta02_devices_pmu_children
[] = {
1555 &s3c_device_ts
, /* input 1 */
1557 >a02_pm_usbhost_dev
,
1558 >a02_spi_gpio_dev
, /* input 2 and 3 */
1559 >a02_button_dev
, /* input 4 */
1560 >a02_resume_reason_device
,
1563 static void gta02_pmu_regulator_registered(struct pcf50633
*pcf
, int id
)
1565 struct platform_device
*regulator
, *pdev
;
1569 regulator
= pcf
->regulator_pdev
[id
];
1572 case PCF50633_REGULATOR_LDO4
:
1573 pdev
= >a02_pm_bt_dev
;
1575 case PCF50633_REGULATOR_LDO5
:
1576 pdev
= >a02_pm_gps_dev
;
1578 case PCF50633_REGULATOR_HCLDO
:
1579 pdev
= >a02_glamo_dev
;
1585 pdev
->dev
.parent
= ®ulator
->dev
;
1586 platform_device_register(pdev
);
1589 /* this is called when pc50633 is probed, unfortunately quite late in the
1590 * day since it is an I2C bus device. Here we can belatedly define some
1591 * platform devices with the advantage that we can mark the pcf50633 as the
1592 * parent. This makes them get suspended and resumed with their parent
1593 * the pcf50633 still around.
1596 static void gta02_pmu_attach_child_devices(struct pcf50633
*pcf
)
1600 for (n
= 0; n
< ARRAY_SIZE(gta02_devices_pmu_children
); n
++)
1601 gta02_devices_pmu_children
[n
]->dev
.parent
= pcf
->dev
;
1603 mangle_glamo_res_by_system_rev();
1604 platform_add_devices(gta02_devices_pmu_children
,
1605 ARRAY_SIZE(gta02_devices_pmu_children
));
1607 /* regulator_has_full_constraints();*/
1610 static void gta02_poweroff(void)
1612 pcf50633_reg_set_bit_mask(gta02_pcf
, PCF50633_REG_OOCSHDWN
,
1613 PCF50633_OOCSHDWN_GOSTDBY
, PCF50633_OOCSHDWN_GOSTDBY
);
1616 static void __init
gta02_machine_init(void)
1620 /* set the panic callback to make AUX blink fast */
1621 panic_blink
= gta02_panic_blink
;
1623 switch (S3C_SYSTEM_REV_ATAG
) {
1624 case GTA02v6_SYSTEM_REV
:
1625 /* we need push-pull interrupt from motion sensors */
1626 lis302_pdata_top
.open_drain
= 0;
1627 lis302_pdata_bottom
.open_drain
= 0;
1633 spin_lock_init(&motion_irq_lock
);
1635 #ifdef CONFIG_CHARGER_PCF50633
1636 INIT_DELAYED_WORK(>a02_charger_work
, gta02_charger_worker
);
1639 /* Glamo chip select optimization */
1640 /* *((u32 *)(S3C2410_MEMREG(((1 + 1) << 2)))) = 0x1280; */
1642 /* do not force soft ecc if we are asked to use hardware_ecc */
1643 if (hardware_ecc_str
[0] == '1')
1644 gta02_nand_info
.software_ecc
= 0;
1646 s3c_device_usb
.dev
.platform_data
= >a02_usb_info
;
1647 s3c_device_nand
.dev
.platform_data
= >a02_nand_info
;
1648 s3c_device_sdi
.dev
.platform_data
= >a02_s3c_mmc_cfg
;
1650 /* acc sensor chip selects */
1651 s3c2410_gpio_setpin(S3C2410_GPD12
, 1);
1652 s3c2410_gpio_cfgpin(S3C2410_GPD12
, S3C2410_GPIO_OUTPUT
);
1653 s3c2410_gpio_setpin(S3C2410_GPD13
, 1);
1654 s3c2410_gpio_cfgpin(S3C2410_GPD13
, S3C2410_GPIO_OUTPUT
);
1656 s3c24xx_udc_set_platdata(>a02_udc_cfg
);
1657 s3c_i2c0_set_platdata(NULL
);
1658 set_s3c2410ts_info(>a02_ts_cfg
);
1660 mangle_glamo_res_by_system_rev();
1662 i2c_register_board_info(0, gta02_i2c_devs
, ARRAY_SIZE(gta02_i2c_devs
));
1663 spi_register_board_info(gta02_spi_board_info
,
1664 ARRAY_SIZE(gta02_spi_board_info
));
1666 #ifdef CONFIG_CHARGER_PCF50633
1667 mangle_pmu_pdata_by_system_rev();
1670 platform_add_devices(gta02_devices
, ARRAY_SIZE(gta02_devices
));
1674 /* Make sure the modem can wake us up */
1675 set_irq_type(GTA02_IRQ_MODEM
, IRQ_TYPE_EDGE_RISING
);
1676 rc
= request_irq(GTA02_IRQ_MODEM
, gta02_modem_irq
, IRQF_DISABLED
,
1679 printk(KERN_ERR
"GTA02: can't request GSM modem wakeup IRQ\n");
1680 enable_irq_wake(GTA02_IRQ_MODEM
);
1682 /* Make sure the wifi module can wake us up*/
1683 set_irq_type(GTA02_IRQ_WLAN_GPIO1
, IRQ_TYPE_EDGE_RISING
);
1684 rc
= request_irq(GTA02_IRQ_WLAN_GPIO1
, ar6000_wow_irq
, IRQF_DISABLED
,
1688 printk(KERN_ERR
"GTA02: can't request ar6k wakeup IRQ\n");
1689 enable_irq_wake(GTA02_IRQ_WLAN_GPIO1
);
1691 pm_power_off
= gta02_poweroff
;
1693 /* Register the HDQ and vibrator as children of pwm device */
1694 #ifdef CONFIG_HDQ_GPIO_BITBANG
1695 gta02_hdq_device
.dev
.parent
= &s3c24xx_pwm_device
.dev
;
1696 platform_device_register(>a02_hdq_device
);
1698 #ifdef CONFIG_LEDS_GTA02_VIBRATOR
1699 gta02_vibrator_dev
.dev
.parent
= &s3c24xx_pwm_device
.dev
;
1700 platform_device_register(>a02_vibrator_dev
);
1704 void DEBUG_LED(int n
)
1708 gta02_gpb_setpin(GTA02_GPIO_PWR_LED1
, 1);
1711 gta02_gpb_setpin(GTA02_GPIO_PWR_LED2
, 1);
1714 gta02_gpb_setpin(GTA02_GPIO_AUX_LED
, 1);
1718 EXPORT_SYMBOL_GPL(DEBUG_LED
);
1720 MACHINE_START(NEO1973_GTA02
, "GTA02")
1721 .phys_io
= S3C2410_PA_UART
,
1722 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
1723 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
1724 .map_io
= gta02_map_io
,
1725 .init_irq
= s3c24xx_init_irq
,
1726 .init_machine
= gta02_machine_init
,
1727 .timer
= &s3c24xx_timer
,