2 * Hardware definitions for Compaq iPAQ H3xxx Handheld Computers
4 * Copyright 2000,1 Compaq Computer Corporation.
6 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is
8 * preserved in its entirety in all copies and derived works.
10 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 * Author: Jamey Hicks.
18 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
19 * and abstracted EGPIO interface.
22 #include <linux/module.h>
23 #include <linux/init.h>
24 #include <linux/kernel.h>
25 #include <linux/tty.h>
27 #include <linux/serial_core.h>
30 #include <asm/hardware.h>
31 #include <asm/mach-types.h>
32 #include <asm/setup.h>
34 #include <asm/mach/irq.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/serial_sa1100.h>
39 #include <asm/arch/h3600.h>
41 #if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100)
42 #include <asm/arch/h3600_gpio.h>
45 #ifdef CONFIG_SA1100_H3800
46 #include <asm/arch/h3600_asic.h>
51 struct ipaq_model_ops ipaq_model_ops
;
52 EXPORT_SYMBOL(ipaq_model_ops
);
54 static void msleep(unsigned int msec
)
56 current
->state
= TASK_INTERRUPTIBLE
;
57 schedule_timeout((msec
* HZ
+ 999) / 1000);
61 * low-level UART features
64 static void h3600_uart_set_mctrl(struct uart_port
*port
, u_int mctrl
)
66 if (port
->mapbase
== _Ser3UTCR0
) {
67 if (mctrl
& TIOCM_RTS
)
68 GPCR
= GPIO_H3600_COM_RTS
;
70 GPSR
= GPIO_H3600_COM_RTS
;
74 static u_int
h3600_uart_get_mctrl(struct uart_port
*port
)
76 u_int ret
= TIOCM_CD
| TIOCM_CTS
| TIOCM_DSR
;
78 if (port
->mapbase
== _Ser3UTCR0
) {
80 /* DCD and CTS bits are inverted in GPLR by RS232 transceiver */
81 if (gplr
& GPIO_H3600_COM_DCD
)
83 if (gplr
& GPIO_H3600_COM_CTS
)
90 static void h3600_uart_pm(struct uart_port
*port
, u_int state
, u_int oldstate
)
92 if (port
->mapbase
== _Ser2UTCR0
) { /* TODO: REMOVE THIS */
93 assign_h3600_egpio(IPAQ_EGPIO_IR_ON
, !state
);
94 } else if (port
->mapbase
== _Ser3UTCR0
) {
95 assign_h3600_egpio(IPAQ_EGPIO_RS232_ON
, !state
);
100 * Enable/Disable wake up events for this serial port.
101 * Obviously, we only support this on the normal COM port.
103 static int h3600_uart_set_wake(struct uart_port
*port
, u_int enable
)
107 if (port
->mapbase
== _Ser3UTCR0
) {
109 PWER
|= PWER_GPIO23
| PWER_GPIO25
; /* DCD and CTS */
111 PWER
&= ~(PWER_GPIO23
| PWER_GPIO25
); /* DCD and CTS */
117 static struct sa1100_port_fns h3600_port_fns __initdata
= {
118 .set_mctrl
= h3600_uart_set_mctrl
,
119 .get_mctrl
= h3600_uart_get_mctrl
,
121 .set_wake
= h3600_uart_set_wake
,
125 * helper for sa1100fb
127 static void h3xxx_lcd_power(int enable
)
129 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER
, enable
);
132 static struct map_desc h3600_io_desc
[] __initdata
= {
133 /* virtual physical length type */
134 { H3600_BANK_2_VIRT
, SA1100_CS2_PHYS
, 0x02800000, MT_DEVICE
}, /* static memory bank 2 CS#2 */
135 { H3600_BANK_4_VIRT
, SA1100_CS4_PHYS
, 0x00800000, MT_DEVICE
}, /* static memory bank 4 CS#4 */
136 { H3600_EGPIO_VIRT
, H3600_EGPIO_PHYS
, 0x01000000, MT_DEVICE
}, /* EGPIO 0 CS#5 */
140 * Common map_io initialization
143 static void __init
h3xxx_map_io(void)
146 iotable_init(h3600_io_desc
, ARRAY_SIZE(h3600_io_desc
));
148 sa1100_register_uart_fns(&h3600_port_fns
);
149 sa1100_register_uart(0, 3); /* Common serial port */
150 // sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
152 /* Ensure those pins are outputs and driving low */
153 PPDR
|= PPC_TXD4
| PPC_SCLK
| PPC_SFRM
;
154 PPSR
&= ~(PPC_TXD4
| PPC_SCLK
| PPC_SFRM
);
156 /* Configure suspend conditions */
158 PWER
= PWER_GPIO0
| PWER_RTC
;
162 sa1100fb_lcd_power
= h3xxx_lcd_power
;
165 static __inline__
void do_blank(int setp
)
167 if (ipaq_model_ops
.blank_callback
)
168 ipaq_model_ops
.blank_callback(1-setp
);
171 /************************* H3100 *************************/
173 #ifdef CONFIG_SA1100_H3100
175 #define H3100_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
176 static unsigned int h3100_egpio
= 0;
178 static void h3100_control_egpio(enum ipaq_egpio_type x
, int setp
)
180 unsigned int egpio
= 0;
185 case IPAQ_EGPIO_LCD_POWER
:
186 egpio
|= EGPIO_H3600_LCD_ON
;
187 gpio
|= GPIO_H3100_LCD_3V_ON
;
190 case IPAQ_EGPIO_LCD_ENABLE
:
192 case IPAQ_EGPIO_CODEC_NRESET
:
193 egpio
|= EGPIO_H3600_CODEC_NRESET
;
195 case IPAQ_EGPIO_AUDIO_ON
:
196 gpio
|= GPIO_H3100_AUD_PWR_ON
199 case IPAQ_EGPIO_QMUTE
:
200 gpio
|= GPIO_H3100_QMUTE
;
202 case IPAQ_EGPIO_OPT_NVRAM_ON
:
203 egpio
|= EGPIO_H3600_OPT_NVRAM_ON
;
205 case IPAQ_EGPIO_OPT_ON
:
206 egpio
|= EGPIO_H3600_OPT_ON
;
208 case IPAQ_EGPIO_CARD_RESET
:
209 egpio
|= EGPIO_H3600_CARD_RESET
;
211 case IPAQ_EGPIO_OPT_RESET
:
212 egpio
|= EGPIO_H3600_OPT_RESET
;
214 case IPAQ_EGPIO_IR_ON
:
215 gpio
|= GPIO_H3100_IR_ON
;
217 case IPAQ_EGPIO_IR_FSEL
:
218 gpio
|= GPIO_H3100_IR_FSEL
;
220 case IPAQ_EGPIO_RS232_ON
:
221 egpio
|= EGPIO_H3600_RS232_ON
;
223 case IPAQ_EGPIO_VPP_ON
:
224 egpio
|= EGPIO_H3600_VPP_ON
;
229 local_irq_save(flags
);
231 h3100_egpio
|= egpio
;
234 h3100_egpio
&= ~egpio
;
237 H3100_EGPIO
= h3100_egpio
;
238 local_irq_restore(flags
);
242 static unsigned long h3100_read_egpio(void)
247 static int h3100_pm_callback(int req
)
249 if (ipaq_model_ops
.pm_callback_aux
)
250 return ipaq_model_ops
.pm_callback_aux(req
);
254 static struct ipaq_model_ops h3100_model_ops __initdata
= {
255 .generic_name
= "3100",
256 .control
= h3100_control_egpio
,
257 .read
= h3100_read_egpio
,
258 .pm_callback
= h3100_pm_callback
261 #define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \
264 | GPIO_H3100_LCD_3V_ON \
265 | GPIO_H3100_AUD_ON \
266 | GPIO_H3100_AUD_PWR_ON \
268 | GPIO_H3100_IR_FSEL)
270 static void __init
h3100_map_io(void)
274 /* Initialize h3100-specific values here */
275 GPCR
= 0x0fffffff; /* All outputs are set low by default */
276 GPDR
= GPIO_H3600_COM_RTS
| GPIO_H3600_L3_CLOCK
|
277 GPIO_H3600_L3_MODE
| GPIO_H3600_L3_DATA
|
278 GPIO_H3600_CLK_SET1
| GPIO_H3600_CLK_SET0
|
281 /* Older bootldrs put GPIO2-9 in alternate mode on the
282 assumption that they are used for video */
283 GAFR
&= ~H3100_DIRECT_EGPIO
;
285 H3100_EGPIO
= h3100_egpio
;
286 ipaq_model_ops
= h3100_model_ops
;
289 MACHINE_START(H3100
, "Compaq iPAQ H3100")
290 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
291 BOOT_PARAMS(0xc0000100)
293 INITIRQ(sa1100_init_irq
)
296 #endif /* CONFIG_SA1100_H3100 */
298 /************************* H3600 *************************/
300 #ifdef CONFIG_SA1100_H3600
302 #define H3600_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
303 static unsigned int h3600_egpio
= EGPIO_H3600_RS232_ON
;
305 static void h3600_control_egpio(enum ipaq_egpio_type x
, int setp
)
307 unsigned int egpio
= 0;
311 case IPAQ_EGPIO_LCD_POWER
:
312 egpio
|= EGPIO_H3600_LCD_ON
|
313 EGPIO_H3600_LCD_PCI
|
314 EGPIO_H3600_LCD_5V_ON
|
318 case IPAQ_EGPIO_LCD_ENABLE
:
320 case IPAQ_EGPIO_CODEC_NRESET
:
321 egpio
|= EGPIO_H3600_CODEC_NRESET
;
323 case IPAQ_EGPIO_AUDIO_ON
:
324 egpio
|= EGPIO_H3600_AUD_AMP_ON
|
325 EGPIO_H3600_AUD_PWR_ON
;
327 case IPAQ_EGPIO_QMUTE
:
328 egpio
|= EGPIO_H3600_QMUTE
;
330 case IPAQ_EGPIO_OPT_NVRAM_ON
:
331 egpio
|= EGPIO_H3600_OPT_NVRAM_ON
;
333 case IPAQ_EGPIO_OPT_ON
:
334 egpio
|= EGPIO_H3600_OPT_ON
;
336 case IPAQ_EGPIO_CARD_RESET
:
337 egpio
|= EGPIO_H3600_CARD_RESET
;
339 case IPAQ_EGPIO_OPT_RESET
:
340 egpio
|= EGPIO_H3600_OPT_RESET
;
342 case IPAQ_EGPIO_IR_ON
:
343 egpio
|= EGPIO_H3600_IR_ON
;
345 case IPAQ_EGPIO_IR_FSEL
:
346 egpio
|= EGPIO_H3600_IR_FSEL
;
348 case IPAQ_EGPIO_RS232_ON
:
349 egpio
|= EGPIO_H3600_RS232_ON
;
351 case IPAQ_EGPIO_VPP_ON
:
352 egpio
|= EGPIO_H3600_VPP_ON
;
357 local_irq_save(flags
);
359 h3600_egpio
|= egpio
;
361 h3600_egpio
&= ~egpio
;
362 H3600_EGPIO
= h3600_egpio
;
363 local_irq_restore(flags
);
367 static unsigned long h3600_read_egpio(void)
372 static int h3600_pm_callback(int req
)
374 if (ipaq_model_ops
.pm_callback_aux
)
375 return ipaq_model_ops
.pm_callback_aux(req
);
379 static struct ipaq_model_ops h3600_model_ops __initdata
= {
380 .generic_name
= "3600",
381 .control
= h3600_control_egpio
,
382 .read
= h3600_read_egpio
,
383 .pm_callback
= h3600_pm_callback
386 static void __init
h3600_map_io(void)
390 /* Initialize h3600-specific values here */
392 GPCR
= 0x0fffffff; /* All outputs are set low by default */
393 GPDR
= GPIO_H3600_COM_RTS
| GPIO_H3600_L3_CLOCK
|
394 GPIO_H3600_L3_MODE
| GPIO_H3600_L3_DATA
|
395 GPIO_H3600_CLK_SET1
| GPIO_H3600_CLK_SET0
|
396 GPIO_LDD15
| GPIO_LDD14
| GPIO_LDD13
| GPIO_LDD12
|
397 GPIO_LDD11
| GPIO_LDD10
| GPIO_LDD9
| GPIO_LDD8
;
399 H3600_EGPIO
= h3600_egpio
; /* Maintains across sleep? */
400 ipaq_model_ops
= h3600_model_ops
;
403 MACHINE_START(H3600
, "Compaq iPAQ H3600")
404 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
405 BOOT_PARAMS(0xc0000100)
407 INITIRQ(sa1100_init_irq
)
410 #endif /* CONFIG_SA1100_H3600 */
412 #ifdef CONFIG_SA1100_H3800
414 #define SET_ASIC1(x) \
415 do {if (setp) { H3800_ASIC1_GPIO_OUT |= (x); } else { H3800_ASIC1_GPIO_OUT &= ~(x); }} while(0)
417 #define SET_ASIC2(x) \
418 do {if (setp) { H3800_ASIC2_GPIOPIOD |= (x); } else { H3800_ASIC2_GPIOPIOD &= ~(x); }} while(0)
420 #define CLEAR_ASIC1(x) \
421 do {if (setp) { H3800_ASIC1_GPIO_OUT &= ~(x); } else { H3800_ASIC1_GPIO_OUT |= (x); }} while(0)
423 #define CLEAR_ASIC2(x) \
424 do {if (setp) { H3800_ASIC2_GPIOPIOD &= ~(x); } else { H3800_ASIC2_GPIOPIOD |= (x); }} while(0)
428 On screen enable, we get
430 h3800_video_power_on(1)
431 LCD controller starts
432 h3800_video_lcd_enable(1)
434 On screen disable, we get
436 h3800_video_lcd_enable(0)
438 h3800_video_power_on(0)
442 static void h3800_video_power_on(int setp
)
445 H3800_ASIC1_GPIO_OUT
|= GPIO1_LCD_ON
;
447 H3800_ASIC1_GPIO_OUT
|= GPIO1_VGL_ON
;
449 H3800_ASIC1_GPIO_OUT
|= GPIO1_VGH_ON
;
451 H3800_ASIC1_GPIO_OUT
|= GPIO1_LCD_5V_ON
;
455 H3800_ASIC1_GPIO_OUT
&= ~GPIO1_LCD_5V_ON
;
457 H3800_ASIC1_GPIO_OUT
&= ~GPIO1_VGL_ON
;
459 H3800_ASIC1_GPIO_OUT
&= ~GPIO1_VGH_ON
;
461 H3800_ASIC1_GPIO_OUT
&= ~GPIO1_LCD_ON
;
465 static void h3800_video_lcd_enable(int setp
)
468 msleep(17); // Wait one from before turning on
469 H3800_ASIC1_GPIO_OUT
|= GPIO1_LCD_PCI
;
471 H3800_ASIC1_GPIO_OUT
&= ~GPIO1_LCD_PCI
;
472 msleep(30); // Wait before turning off
477 static void h3800_control_egpio(enum ipaq_egpio_type x
, int setp
)
480 case IPAQ_EGPIO_LCD_POWER
:
481 h3800_video_power_on(setp
);
483 case IPAQ_EGPIO_LCD_ENABLE
:
484 h3800_video_lcd_enable(setp
);
486 case IPAQ_EGPIO_CODEC_NRESET
:
487 case IPAQ_EGPIO_AUDIO_ON
:
488 case IPAQ_EGPIO_QMUTE
:
489 printk(__FUNCTION__
": error - should not be called\n");
491 case IPAQ_EGPIO_OPT_NVRAM_ON
:
492 SET_ASIC2(GPIO2_OPT_ON_NVRAM
);
494 case IPAQ_EGPIO_OPT_ON
:
495 SET_ASIC2(GPIO2_OPT_ON
);
497 case IPAQ_EGPIO_CARD_RESET
:
498 SET_ASIC2(GPIO2_OPT_PCM_RESET
);
500 case IPAQ_EGPIO_OPT_RESET
:
501 SET_ASIC2(GPIO2_OPT_RESET
);
503 case IPAQ_EGPIO_IR_ON
:
504 CLEAR_ASIC1(GPIO1_IR_ON_N
);
506 case IPAQ_EGPIO_IR_FSEL
:
508 case IPAQ_EGPIO_RS232_ON
:
509 SET_ASIC1(GPIO1_RS232_ON
);
511 case IPAQ_EGPIO_VPP_ON
:
512 H3800_ASIC2_FlashWP_VPP_ON
= setp
;
517 static unsigned long h3800_read_egpio(void)
519 return H3800_ASIC1_GPIO_OUT
| (H3800_ASIC2_GPIOPIOD
<< 16);
522 /* We need to fix ASIC2 GPIO over suspend/resume. At the moment,
523 it doesn't appear that ASIC1 GPIO has the same problem */
525 static int h3800_pm_callback(int req
)
527 static u16 asic1_data
;
528 static u16 asic2_data
;
531 printk(__FUNCTION__
" %d\n", req
);
535 MSC2
= (MSC2
& 0x0000ffff) | 0xE4510000; /* Set MSC2 correctly */
537 H3800_ASIC2_GPIOPIOD
= asic2_data
;
538 H3800_ASIC2_GPIODIR
= GPIO2_PEN_IRQ
544 H3800_ASIC1_GPIO_OUT
= asic1_data
;
546 if (ipaq_model_ops
.pm_callback_aux
)
547 result
= ipaq_model_ops
.pm_callback_aux(req
);
551 if (ipaq_model_ops
.pm_callback_aux
&&
552 ((result
= ipaq_model_ops
.pm_callback_aux(req
)) != 0))
555 asic1_data
= H3800_ASIC1_GPIO_OUT
;
556 asic2_data
= H3800_ASIC2_GPIOPIOD
;
559 printk(__FUNCTION__
": unrecognized PM callback\n");
565 static struct ipaq_model_ops h3800_model_ops __initdata
= {
566 .generic_name
= "3800",
567 .control
= h3800_control_egpio
,
568 .read
= h3800_read_egpio
,
569 .pm_callback
= h3800_pm_callback
572 #define MAX_ASIC_ISR_LOOPS 20
574 /* The order of these is important - see #include <asm/arch/irqs.h> */
575 static u32 kpio_irq_mask
[] = {
587 static u32 gpio_irq_mask
[] = {
595 static void h3800_IRQ_demux(unsigned int irq
, struct irqdesc
*desc
, struct pt_regs
*regs
)
599 if (0) printk(__FUNCTION__
": interrupt received\n");
601 desc
->chip
->ack(irq
);
603 for (i
= 0; i
< MAX_ASIC_ISR_LOOPS
&& (GPLR
& GPIO_H3800_ASIC
); i
++) {
608 irq
= H3800_ASIC2_KPIINTFLAG
;
609 if (0) printk(__FUNCTION__
" KPIO 0x%08X\n", irq
);
610 for (j
= 0; j
< H3800_KPIO_IRQ_COUNT
; j
++)
611 if (irq
& kpio_irq_mask
[j
])
612 do_edge_IRQ(H3800_KPIO_IRQ_COUNT
+ j
, irq_desc
+ H3800_KPIO_IRQ_COUNT
+ j
, regs
);
615 irq
= H3800_ASIC2_GPIINTFLAG
;
616 if (0) printk(__FUNCTION__
" GPIO 0x%08X\n", irq
);
617 for (j
= 0; j
< H3800_GPIO_IRQ_COUNT
; j
++)
618 if (irq
& gpio_irq_mask
[j
])
619 do_edge_IRQ(H3800_GPIO_IRQ_COUNT
+ j
, irq_desc
+ H3800_GPIO_IRQ_COUNT
+ j
, regs
);
622 if (i
>= MAX_ASIC_ISR_LOOPS
)
623 printk(__FUNCTION__
": interrupt processing overrun\n");
625 /* For level-based interrupts */
626 desc
->chip
->unmask(irq
);
630 static struct irqaction h3800_irq
= {
631 .name
= "h3800_asic",
632 .handler
= h3800_IRQ_demux
,
633 .flags
= SA_INTERRUPT
,
636 u32 kpio_int_shadow
= 0;
639 /* mask_ack <- IRQ is first serviced.
640 mask <- IRQ is disabled.
641 unmask <- IRQ is enabled
643 The INTCLR registers are poorly documented. I believe that writing
644 a "1" to the register clears the specific interrupt, but the documentation
645 indicates writing a "0" clears the interrupt. In any case, they shouldn't
646 be read (that's the INTFLAG register)
649 static void h3800_mask_ack_kpio_irq(unsigned int irq
)
651 u32 mask
= kpio_irq_mask
[irq
- H3800_KPIO_IRQ_START
];
652 kpio_int_shadow
&= ~mask
;
653 H3800_ASIC2_KPIINTSTAT
= kpio_int_shadow
;
654 H3800_ASIC2_KPIINTCLR
= mask
;
657 static void h3800_mask_kpio_irq(unsigned int irq
)
659 u32 mask
= kpio_irq_mask
[irq
- H3800_KPIO_IRQ_START
];
660 kpio_int_shadow
&= ~mask
;
661 H3800_ASIC2_KPIINTSTAT
= kpio_int_shadow
;
664 static void h3800_unmask_kpio_irq(unsigned int irq
)
666 u32 mask
= kpio_irq_mask
[irq
- H3800_KPIO_IRQ_START
];
667 kpio_int_shadow
|= mask
;
668 H3800_ASIC2_KPIINTSTAT
= kpio_int_shadow
;
671 static void h3800_mask_ack_gpio_irq(unsigned int irq
)
673 u32 mask
= gpio_irq_mask
[irq
- H3800_GPIO_IRQ_START
];
674 H3800_ASIC2_GPIINTSTAT
&= ~mask
;
675 H3800_ASIC2_GPIINTCLR
= mask
;
678 static void h3800_mask_gpio_irq(unsigned int irq
)
680 u32 mask
= gpio_irq_mask
[irq
- H3800_GPIO_IRQ_START
];
681 H3800_ASIC2_GPIINTSTAT
&= ~mask
;
684 static void h3800_unmask_gpio_irq(unsigned int irq
)
686 u32 mask
= gpio_irq_mask
[irq
- H3800_GPIO_IRQ_START
];
687 H3800_ASIC2_GPIINTSTAT
|= mask
;
690 static void __init
h3800_init_irq(void)
694 /* Initialize standard IRQs */
697 /* Disable all IRQs and set up clock */
698 H3800_ASIC2_KPIINTSTAT
= 0; /* Disable all interrupts */
699 H3800_ASIC2_GPIINTSTAT
= 0;
701 H3800_ASIC2_KPIINTCLR
= 0; /* Clear all KPIO interrupts */
702 H3800_ASIC2_GPIINTCLR
= 0; /* Clear all GPIO interrupts */
704 // H3800_ASIC2_KPIINTCLR = 0xffff; /* Clear all KPIO interrupts */
705 // H3800_ASIC2_GPIINTCLR = 0xffff; /* Clear all GPIO interrupts */
707 H3800_ASIC2_CLOCK_Enable
|= ASIC2_CLOCK_EX0
; /* 32 kHZ crystal on */
708 H3800_ASIC2_INTR_ClockPrescale
|= ASIC2_INTCPS_SET
;
709 H3800_ASIC2_INTR_ClockPrescale
= ASIC2_INTCPS_CPS(0x0e) | ASIC2_INTCPS_SET
;
710 H3800_ASIC2_INTR_TimerSet
= 1;
713 for (i
= 0; i
< H3800_KPIO_IRQ_COUNT
; i
++) {
714 int irq
= i
+ H3800_KPIO_IRQ_START
;
715 irq_desc
[irq
].valid
= 1;
716 irq_desc
[irq
].probe_ok
= 1;
717 set_irq_chip(irq
, &h3800_kpio_irqchip
);
720 for (i
= 0; i
< H3800_GPIO_IRQ_COUNT
; i
++) {
721 int irq
= i
+ H3800_GPIO_IRQ_START
;
722 irq_desc
[irq
].valid
= 1;
723 irq_desc
[irq
].probe_ok
= 1;
724 set_irq_chip(irq
, &h3800_gpio_irqchip
);
727 set_irq_type(IRQ_GPIO_H3800_ASIC
, IRQT_RISING
);
728 set_irq_chained_handler(IRQ_GPIO_H3800_ASIC
, &h3800_IRQ_demux
);
732 #define ASIC1_OUTPUTS 0x7fff /* First 15 bits are used */
734 static void __init
h3800_map_io(void)
738 /* Add wakeup on AC plug/unplug */
741 /* Initialize h3800-specific values here */
742 GPCR
= 0x0fffffff; /* All outputs are set low by default */
743 GAFR
= GPIO_H3800_CLK_OUT
|
744 GPIO_LDD15
| GPIO_LDD14
| GPIO_LDD13
| GPIO_LDD12
|
745 GPIO_LDD11
| GPIO_LDD10
| GPIO_LDD9
| GPIO_LDD8
;
746 GPDR
= GPIO_H3800_CLK_OUT
|
747 GPIO_H3600_COM_RTS
| GPIO_H3600_L3_CLOCK
|
748 GPIO_H3600_L3_MODE
| GPIO_H3600_L3_DATA
|
749 GPIO_LDD15
| GPIO_LDD14
| GPIO_LDD13
| GPIO_LDD12
|
750 GPIO_LDD11
| GPIO_LDD10
| GPIO_LDD9
| GPIO_LDD8
;
751 TUCR
= TUCR_3_6864MHz
; /* Seems to be used only for the Bluetooth UART */
753 /* Fix the memory bus */
754 MSC2
= (MSC2
& 0x0000ffff) | 0xE4510000;
757 H3800_ASIC1_GPIO_DIR
= ASIC1_OUTPUTS
; /* All outputs */
758 H3800_ASIC1_GPIO_MASK
= ASIC1_OUTPUTS
; /* No interrupts */
759 H3800_ASIC1_GPIO_SLEEP_MASK
= ASIC1_OUTPUTS
;
760 H3800_ASIC1_GPIO_SLEEP_DIR
= ASIC1_OUTPUTS
;
761 H3800_ASIC1_GPIO_SLEEP_OUT
= GPIO1_EAR_ON_N
;
762 H3800_ASIC1_GPIO_BATT_FAULT_DIR
= ASIC1_OUTPUTS
;
763 H3800_ASIC1_GPIO_BATT_FAULT_OUT
= GPIO1_EAR_ON_N
;
765 H3800_ASIC1_GPIO_OUT
= GPIO1_IR_ON_N
770 H3800_ASIC2_GPIOPIOD
= GPIO2_IN_Y1_N
| GPIO2_IN_X1_N
;
771 H3800_ASIC2_GPOBFSTAT
= GPIO2_IN_Y1_N
| GPIO2_IN_X1_N
;
773 H3800_ASIC2_GPIODIR
= GPIO2_PEN_IRQ
779 /* TODO : Set sleep states & battery fault states */
781 /* Clear VPP Enable */
782 H3800_ASIC2_FlashWP_VPP_ON
= 0;
783 ipaq_model_ops
= h3800_model_ops
;
786 MACHINE_START(H3800
, "Compaq iPAQ H3800")
787 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
788 BOOT_PARAMS(0xc0000100)
790 INITIRQ(h3800_init_irq
)
793 #endif /* CONFIG_SA1100_H3800 */