sync hh.org
[hh.org.git] / arch / arm / mach-sa1100 / h3600.c
blob2de4cf2dbd97d61cd8766a18ccce1db678ebfccd
1 /*
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.
16 * History:
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>
26 #include <linux/pm.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>
35 #include <asm/irq.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>
51 #endif
53 #include "generic.h"
55 static struct mtd_partition h3xxx_partitions[] = {
57 .name = "H3XXX boot firmware",
58 .size = 0x00040000,
59 .offset = 0,
60 .mask_flags = MTD_WRITEABLE, /* force read-only */
61 }, {
62 #ifdef CONFIG_MTD_2PARTS_IPAQ
63 .name = "H3XXX root jffs2",
64 .size = MTDPART_SIZ_FULL,
65 .offset = 0x00040000,
66 #else
67 .name = "H3XXX kernel",
68 .size = 0x00080000,
69 .offset = 0x00040000,
70 }, {
71 .name = "H3XXX params",
72 .size = 0x00040000,
73 .offset = 0x000C0000,
74 }, {
75 #ifdef CONFIG_JFFS2_FS
76 .name = "H3XXX root jffs2",
77 .size = MTDPART_SIZ_FULL,
78 .offset = 0x00100000,
79 #else
80 .name = "H3XXX initrd",
81 .size = 0x00100000,
82 .offset = 0x00100000,
83 }, {
84 .name = "H3XXX root cramfs",
85 .size = 0x00300000,
86 .offset = 0x00200000,
87 }, {
88 .name = "H3XXX usr cramfs",
89 .size = 0x00800000,
90 .offset = 0x00500000,
91 }, {
92 .name = "H3XXX usr local",
93 .size = MTDPART_SIZ_FULL,
94 .offset = 0x00d00000,
95 #endif
96 #endif
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 = {
126 .name = "gpio-keys",
127 .dev = {
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;
142 unsigned long flags;
144 switch (x) {
145 case IPAQ_EGPIO_LCD_POWER:
146 egpio |= EGPIO_H3600_LCD_ON |
147 EGPIO_H3600_LCD_5V_ON |
148 EGPIO_H3600_LVDD_ON;
149 break;
150 case IPAQ_EGPIO_LCD_ENABLE:
151 egpio |= EGPIO_H3600_LCD_PCI;
152 break;
153 case IPAQ_EGPIO_CODEC_NRESET:
154 egpio |= EGPIO_H3600_CODEC_NRESET;
155 break;
156 case IPAQ_EGPIO_AUDIO_ON:
157 egpio |= EGPIO_H3600_AUD_AMP_ON |
158 EGPIO_H3600_AUD_PWR_ON;
159 break;
160 case IPAQ_EGPIO_QMUTE:
161 egpio |= EGPIO_H3600_QMUTE;
162 break;
163 case IPAQ_EGPIO_OPT_NVRAM_ON:
164 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
165 break;
166 case IPAQ_EGPIO_OPT_ON:
167 egpio |= EGPIO_H3600_OPT_ON;
168 break;
169 case IPAQ_EGPIO_CARD_RESET:
170 egpio |= EGPIO_H3600_CARD_RESET;
171 break;
172 case IPAQ_EGPIO_OPT_RESET:
173 egpio |= EGPIO_H3600_OPT_RESET;
174 break;
175 case IPAQ_EGPIO_IR_ON:
176 egpio |= EGPIO_H3600_IR_ON;
177 break;
178 case IPAQ_EGPIO_IR_FSEL:
179 egpio |= EGPIO_H3600_IR_FSEL;
180 break;
181 case IPAQ_EGPIO_RS232_ON:
182 egpio |= EGPIO_H3600_RS232_ON;
183 break;
184 case IPAQ_EGPIO_VPP_ON:
185 egpio |= EGPIO_H3600_VPP_ON;
186 break;
189 * unhandled EGPIOs
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:
196 default:
197 break;
200 if (egpio) {
201 local_irq_save(flags);
202 if (setp)
203 h3600_egpio |= egpio;
204 else
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)
219 ipaqsa_map_io();
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",
239 .id = -1,
241 EXPORT_SYMBOL(h3600micro_device);
243 static struct platform_device h3600lcd_device = {
244 .name = "h3600-lcd",
245 /* .dev = { */
246 /* .parent = &sa11x0fb_device.dev, */
247 /* }, */
248 .id = -1,
251 static struct platform_device *devices[] __initdata = {
252 &h3600micro_device,
253 &h3600lcd_device,
254 &h3600_keys,
258 static void h3600_mach_init(void)
260 ipaqsa_mach_init();
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,
273 MACHINE_END
275 #endif /* CONFIG_SA1100_H3600 */