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/device.h>
28 #include <linux/mtd/mtd.h>
29 #include <linux/mtd/partitions.h>
30 #include <linux/serial_core.h>
31 #include <linux/input.h>
32 #include <linux/input_pda.h>
33 #include <linux/platform_device.h>
36 #include <asm/hardware.h>
37 #include <asm/mach-types.h>
38 #include <asm/setup.h>
40 #include <asm/mach/irq.h>
41 #include <asm/mach/arch.h>
42 #include <asm/mach/flash.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/serial_sa1100.h>
46 #include <asm/arch/h3600.h>
47 #include <asm/hardware/gpio_keys.h>
49 #if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100)
50 #include <asm/arch/h3600_gpio.h>
55 static struct mtd_partition h3xxx_partitions
[] = {
57 .name
= "H3XXX boot firmware",
60 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
62 #ifdef CONFIG_MTD_2PARTS_IPAQ
63 .name
= "H3XXX root jffs2",
64 .size
= MTDPART_SIZ_FULL
,
67 .name
= "H3XXX kernel",
71 .name
= "H3XXX params",
75 #ifdef CONFIG_JFFS2_FS
76 .name
= "H3XXX root jffs2",
77 .size
= MTDPART_SIZ_FULL
,
80 .name
= "H3XXX initrd",
84 .name
= "H3XXX root cramfs",
88 .name
= "H3XXX usr cramfs",
92 .name
= "H3XXX usr local",
93 .size
= MTDPART_SIZ_FULL
,
102 static struct flash_platform_data h3xxx_flash_data
= {
103 .map_name
= "cfi_probe",
104 .set_vpp
= ipaqsa_mtd_set_vpp
,
105 .parts
= h3xxx_partitions
,
106 .nr_parts
= ARRAY_SIZE(h3xxx_partitions
),
109 static struct resource h3xxx_flash_resource
= {
110 .start
= SA1100_CS0_PHYS
,
111 .end
= SA1100_CS0_PHYS
+ SZ_32M
- 1,
112 .flags
= IORESOURCE_MEM
,
115 static struct gpio_keys_button h3600_button_table
[] = {
116 { _KEY_POWER
, GPIO_NR_H3600_NPOWER_BUTTON
, 1 },
117 { KEY_ENTER
, GPIO_NR_H3600_ACTION_BUTTON
, 1 },
120 static struct gpio_keys_platform_data h3600_keys_data
= {
121 .buttons
= h3600_button_table
,
122 .nbuttons
= ARRAY_SIZE(h3600_button_table
),
125 static struct platform_device h3600_keys
= {
128 .platform_data
= &h3600_keys_data
,
132 /************************* H3600 *************************/
134 #ifdef CONFIG_SA1100_H3600
136 #define H3600_EGPIO (*(volatile unsigned int *)IPAQSA_EGPIO_VIRT)
137 static unsigned int h3600_egpio
= EGPIO_H3600_RS232_ON
;
139 static void h3600_control_egpio(enum ipaq_egpio_type x
, int setp
)
141 unsigned int egpio
= 0;
145 case IPAQ_EGPIO_LCD_POWER
:
146 egpio
|= EGPIO_H3600_LCD_ON
|
147 EGPIO_H3600_LCD_5V_ON
|
150 case IPAQ_EGPIO_LCD_ENABLE
:
151 egpio
|= EGPIO_H3600_LCD_PCI
;
153 case IPAQ_EGPIO_CODEC_NRESET
:
154 egpio
|= EGPIO_H3600_CODEC_NRESET
;
156 case IPAQ_EGPIO_AUDIO_ON
:
157 egpio
|= EGPIO_H3600_AUD_AMP_ON
|
158 EGPIO_H3600_AUD_PWR_ON
;
160 case IPAQ_EGPIO_QMUTE
:
161 egpio
|= EGPIO_H3600_QMUTE
;
163 case IPAQ_EGPIO_OPT_NVRAM_ON
:
164 egpio
|= EGPIO_H3600_OPT_NVRAM_ON
;
166 case IPAQ_EGPIO_OPT_ON
:
167 egpio
|= EGPIO_H3600_OPT_ON
;
169 case IPAQ_EGPIO_CARD_RESET
:
170 egpio
|= EGPIO_H3600_CARD_RESET
;
172 case IPAQ_EGPIO_OPT_RESET
:
173 egpio
|= EGPIO_H3600_OPT_RESET
;
175 case IPAQ_EGPIO_IR_ON
:
176 egpio
|= EGPIO_H3600_IR_ON
;
178 case IPAQ_EGPIO_IR_FSEL
:
179 egpio
|= EGPIO_H3600_IR_FSEL
;
181 case IPAQ_EGPIO_RS232_ON
:
182 egpio
|= EGPIO_H3600_RS232_ON
;
184 case IPAQ_EGPIO_VPP_ON
:
185 egpio
|= EGPIO_H3600_VPP_ON
;
191 case IPAQ_EGPIO_PCMCIA_CD0_N
:
192 case IPAQ_EGPIO_PCMCIA_CD1_N
:
193 case IPAQ_EGPIO_PCMCIA_IRQ0
:
194 case IPAQ_EGPIO_PCMCIA_IRQ1
:
195 case IPAQ_EGPIO_BLUETOOTH_ON
:
201 local_irq_save(flags
);
203 h3600_egpio
|= egpio
;
205 h3600_egpio
&= ~egpio
;
206 H3600_EGPIO
= h3600_egpio
;
207 local_irq_restore(flags
);
212 static struct ipaq_model_ops h3600_model_ops __initdata
= {
213 .generic_name
= "3600",
214 .control
= h3600_control_egpio
,
217 static void __init
h3600_map_io(void)
221 /* Initialize h3600-specific values here */
223 GPCR
= 0x0fffffff; /* All outputs are set low by default */
224 GPDR
= GPIO_H3600_COM_RTS
| GPIO_H3600_L3_CLOCK
|
225 GPIO_H3600_L3_MODE
| GPIO_H3600_L3_DATA
|
226 GPIO_H3600_CLK_SET1
| GPIO_H3600_CLK_SET0
|
227 GPIO_LDD15
| GPIO_LDD14
| GPIO_LDD13
| GPIO_LDD12
|
228 GPIO_LDD11
| GPIO_LDD10
| GPIO_LDD9
| GPIO_LDD8
;
230 H3600_EGPIO
= h3600_egpio
; /* Maintains across sleep? */
231 ipaq_model_ops
= h3600_model_ops
;
235 /*--- list of devices ---*/
237 struct platform_device h3600micro_device
= {
238 .name
= "h3600-micro",
241 EXPORT_SYMBOL(h3600micro_device
);
243 static struct platform_device h3600lcd_device
= {
246 /* .parent = &sa11x0fb_device.dev, */
251 static struct platform_device
*devices
[] __initdata
= {
258 static void h3600_mach_init(void)
261 sa11x0_set_flash_data(&h3xxx_flash_data
, &h3xxx_flash_resource
, 1);
262 platform_add_devices(devices
, ARRAY_SIZE(devices
));
265 MACHINE_START(H3600
, "Compaq iPAQ H3600")
266 .phys_io
= 0x80000000,
267 .io_pg_offst
= ( io_p2v(0x80000000) >> 18) & 0xfffc,
268 .boot_params
= 0xc0000100,
269 .map_io
= h3600_map_io
,
270 .init_irq
= sa1100_init_irq
,
271 .timer
= &sa1100_timer
,
272 .init_machine
= h3600_mach_init
,
275 #endif /* CONFIG_SA1100_H3600 */