sync hh.org
[hh.org.git] / arch / arm / plat-ipaq / h3600.c
blobf2a2c2da030bbf1f22a2da33e380b876c2265155
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/config.h>
23 #include <linux/module.h>
24 #include <linux/init.h>
25 #include <linux/kernel.h>
26 #include <linux/tty.h>
27 #include <linux/pm.h>
28 #include <linux/device.h>
29 #include <linux/mtd/mtd.h>
30 #include <linux/mtd/partitions.h>
31 #include <linux/serial_core.h>
33 #include <asm/irq.h>
34 #include <asm/hardware.h>
35 #include <asm/mach-types.h>
36 #include <asm/setup.h>
38 #include <asm/mach/irq.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/flash.h>
41 #include <asm/mach/map.h>
42 #include <asm/mach/serial_sa1100.h>
44 #include <asm/arch/h3600.h>
46 #if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100)
47 #include <asm/arch/h3600_gpio.h>
48 #endif
50 #include "../mach-sa1100/generic.h"
52 static struct mtd_partition h3xxx_partitions[] = {
54 .name = "H3XXX boot firmware",
55 .size = 0x00040000,
56 .offset = 0,
57 .mask_flags = MTD_WRITEABLE, /* force read-only */
58 }, {
59 #ifdef CONFIG_MTD_2PARTS_IPAQ
60 .name = "H3XXX root jffs2",
61 .size = MTDPART_SIZ_FULL,
62 .offset = 0x00040000,
63 #else
64 .name = "H3XXX kernel",
65 .size = 0x00080000,
66 .offset = 0x00040000,
67 }, {
68 .name = "H3XXX params",
69 .size = 0x00040000,
70 .offset = 0x000C0000,
71 }, {
72 #ifdef CONFIG_JFFS2_FS
73 .name = "H3XXX root jffs2",
74 .size = MTDPART_SIZ_FULL,
75 .offset = 0x00100000,
76 #else
77 .name = "H3XXX initrd",
78 .size = 0x00100000,
79 .offset = 0x00100000,
80 }, {
81 .name = "H3XXX root cramfs",
82 .size = 0x00300000,
83 .offset = 0x00200000,
84 }, {
85 .name = "H3XXX usr cramfs",
86 .size = 0x00800000,
87 .offset = 0x00500000,
88 }, {
89 .name = "H3XXX usr local",
90 .size = MTDPART_SIZ_FULL,
91 .offset = 0x00d00000,
92 #endif
93 #endif
99 static struct flash_platform_data h3xxx_flash_data = {
100 .map_name = "cfi_probe",
101 .set_vpp = ipaqsa_mtd_set_vpp,
102 .parts = h3xxx_partitions,
103 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
106 static struct resource h3xxx_flash_resource = {
107 .start = SA1100_CS0_PHYS,
108 .end = SA1100_CS0_PHYS + SZ_32M - 1,
109 .flags = IORESOURCE_MEM,
115 * helper for sa1100fb
117 static void h3xxx_lcd_power(int enable)
119 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_POWER, enable);
125 /************************* H3600 *************************/
127 #ifdef CONFIG_SA1100_H3600
129 #define H3600_EGPIO (*(volatile unsigned int *)IPAQSA_EGPIO_VIRT)
130 static unsigned int h3600_egpio = EGPIO_H3600_RS232_ON;
132 static void h3600_control_egpio(enum ipaq_egpio_type x, int setp)
134 unsigned int egpio = 0;
135 unsigned long flags;
137 switch (x) {
138 case IPAQ_EGPIO_LCD_POWER:
139 egpio |= EGPIO_H3600_LCD_ON |
140 EGPIO_H3600_LCD_PCI |
141 EGPIO_H3600_LCD_5V_ON |
142 EGPIO_H3600_LVDD_ON;
143 break;
144 case IPAQ_EGPIO_LCD_ENABLE:
145 break;
146 case IPAQ_EGPIO_CODEC_NRESET:
147 egpio |= EGPIO_H3600_CODEC_NRESET;
148 break;
149 case IPAQ_EGPIO_AUDIO_ON:
150 egpio |= EGPIO_H3600_AUD_AMP_ON |
151 EGPIO_H3600_AUD_PWR_ON;
152 break;
153 case IPAQ_EGPIO_QMUTE:
154 egpio |= EGPIO_H3600_QMUTE;
155 break;
156 case IPAQ_EGPIO_OPT_NVRAM_ON:
157 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
158 break;
159 case IPAQ_EGPIO_OPT_ON:
160 egpio |= EGPIO_H3600_OPT_ON;
161 break;
162 case IPAQ_EGPIO_CARD_RESET:
163 egpio |= EGPIO_H3600_CARD_RESET;
164 break;
165 case IPAQ_EGPIO_OPT_RESET:
166 egpio |= EGPIO_H3600_OPT_RESET;
167 break;
168 case IPAQ_EGPIO_IR_ON:
169 egpio |= EGPIO_H3600_IR_ON;
170 break;
171 case IPAQ_EGPIO_IR_FSEL:
172 egpio |= EGPIO_H3600_IR_FSEL;
173 break;
174 case IPAQ_EGPIO_RS232_ON:
175 egpio |= EGPIO_H3600_RS232_ON;
176 break;
177 case IPAQ_EGPIO_VPP_ON:
178 egpio |= EGPIO_H3600_VPP_ON;
179 break;
182 * unhandled EGPIOs
184 case IPAQ_EGPIO_PCMCIA_CD0_N:
185 case IPAQ_EGPIO_PCMCIA_CD1_N:
186 case IPAQ_EGPIO_PCMCIA_IRQ0:
187 case IPAQ_EGPIO_PCMCIA_IRQ1:
188 case IPAQ_EGPIO_BLUETOOTH_ON:
189 default:
190 break;
193 if (egpio) {
194 local_irq_save(flags);
195 if (setp)
196 h3600_egpio |= egpio;
197 else
198 h3600_egpio &= ~egpio;
199 H3600_EGPIO = h3600_egpio;
200 local_irq_restore(flags);
205 static struct ipaq_model_ops h3600_model_ops __initdata = {
206 .generic_name = "3600",
207 .control = h3600_control_egpio,
210 static void __init h3600_map_io(void)
212 ipaqsa_map_io();
213 sa1100fb_lcd_power = h3xxx_lcd_power;
215 /* Initialize h3600-specific values here */
217 GPCR = 0x0fffffff; /* All outputs are set low by default */
218 GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK |
219 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
220 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
221 GPIO_LDD15 | GPIO_LDD14 | GPIO_LDD13 | GPIO_LDD12 |
222 GPIO_LDD11 | GPIO_LDD10 | GPIO_LDD9 | GPIO_LDD8;
224 H3600_EGPIO = h3600_egpio; /* Maintains across sleep? */
225 ipaq_model_ops = h3600_model_ops;
228 static void h3600_mach_init(void)
230 ipaqsa_mach_init();
231 sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
235 MACHINE_START(H3600, "Compaq iPAQ H3600")
236 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
237 BOOT_PARAMS(0xc0000100)
238 MAPIO(h3600_map_io)
239 INITIRQ(sa1100_init_irq)
240 .timer = &sa1100_timer,
241 .init_machine = h3600_mach_init,
242 MACHINE_END
244 #endif /* CONFIG_SA1100_H3600 */