hh.org updates
[hh.org.git] / arch / arm / mach-pxa / aximx30 / aximx30.c
blob8c8c6a60b7ad3a312b66311a1b94ac3036d06b66
1 /*
2 *
3 * Hardware definitions for HP iPAQ Handheld Computers
5 * Copyright 2004 Hewlett-Packard Company.
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
15 * History:
17 * 2004-11-2004 Michael Opdenacker Preliminary version
18 * 2004-12-16 Todd Blumer
19 * 2004-12-22 Michael Opdenacker Added USB management
20 * 2005-01-30 Michael Opdenacker Improved Asic3 settings and initialization
24 #include <linux/init.h>
25 #include <linux/kernel.h>
26 #include <linux/ioport.h>
27 #include <linux/device.h>
28 #include <linux/input.h>
29 #include <linux/interrupt.h>
30 #include <linux/delay.h>
32 #include <asm/mach-types.h>
33 #include <asm/hardware.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
37 #include <asm/arch/aximx30-gpio.h>
38 #include <asm/arch/aximx30-asic.h>
39 #include <asm/arch/pxa-regs.h>
40 #include <asm/hardware/gpio_keys.h>
41 #include <asm/arch/udc.h>
42 #include <asm/arch/audio.h>
44 #include <asm/hardware/ipaq-asic3.h>
45 #include <linux/soc/asic3_base.h>
47 #include "../generic.h"
48 #include "aximx30_core.h"
50 /* Physical address space information */
52 /* TI WLAN, EGPIO, External UART */
53 #define X30_EGPIO_WLAN_PHYS PXA_CS5_PHYS
55 /* Initialization code */
57 static void __init x30_map_io(void)
59 pxa_map_io();
62 static void __init x30_init_irq(void)
64 /* int irq; */
66 pxa_init_irq();
70 /* ASIC3 */
72 static struct asic3_platform_data x30_asic3_platform_data = {
74 /* Setting ASIC3 GPIO registers to the below initialization states
75 * x4700 asic3 information: http://handhelds.org/moin/moin.cgi/HpIpaqHx4700Hardware
77 * dir: Direction of the GPIO pin. 0: input, 1: output.
78 * If unknown, set as output to avoid power consuming floating input nodes
79 * init: Initial state of the GPIO bits
81 * These registers are configured as they are on Wince, and are configured
82 * this way on bootldr.
84 .gpio_a = {
85 // .mask = 0xffff,
86 .dir = 0xffff, // Unknown, set as outputs so far
87 .init = 0x0000,
88 // .trigger_type = 0x0000,
89 // .edge_trigger = 0x0000,
90 // .leveltri = 0x0000,
91 // .sleep_mask = 0xffff,
92 .sleep_out = 0x0000,
93 .batt_fault_out = 0x0000,
94 // .int_status = 0x0000,
95 .alt_function = 0xffff,
96 .sleep_conf = 0x000c,
98 .gpio_b = {
99 // .mask = 0xffff,
100 .dir = 0xffff, // Unknown, set as outputs so far
101 .init = 0x0000,
102 // .trigger_type = 0x0000,
103 // .edge_trigger = 0x0000,
104 // .leveltri = 0x0000,
105 // .sleep_mask = 0xffff,
106 .sleep_out = 0x0000,
107 .batt_fault_out = 0x0000,
108 // .int_status = 0x0000,
109 .alt_function = 0xffff,
110 .sleep_conf = 0x000c,
112 .gpio_c = {
113 // .mask = 0xffff,
114 .dir = 0x6067,
115 // GPIOC_SD_CS_N | GPIOC_CIOW_N | GPIOC_CIOR_N | GPIOC_PWAIT_N | GPIOC_PIOS16_N,
116 .init = 0x0000,
117 // .trigger_type = 0x0000,
118 // .edge_trigger = 0x0000,
119 // .leveltri = 0x0000,
120 // .sleep_mask = 0xffff,
121 .sleep_out = 0x0000,
122 .batt_fault_out = 0x0000,
123 // .int_status = 0x0000,
124 .alt_function = 0xfff7, // GPIOC_LED_RED | GPIOC_LED_GREEN | GPIOC_LED_BLUE,
125 .sleep_conf = 0x000c,
127 .gpio_d = {
128 // .mask = 0xffff,
129 .dir = 0x0000, // Only inputs
130 .init = 0x0000,
131 // .trigger_type = 0x67ff,
132 // .edge_trigger = 0x0000,
133 // .leveltri = 0x0000,
134 // .sleep_mask = 0x9800,
135 .sleep_out = 0x0000,
136 .batt_fault_out = 0x0000,
137 // .int_status = 0x0000,
138 .alt_function = 0x9800,
139 .sleep_conf = 0x000c,
141 .bus_shift = 1,
144 static struct resource asic3_resources[] = {
145 [0] = {
146 .start = X30_ASIC3_PHYS,
147 .end = X30_ASIC3_PHYS + IPAQ_ASIC3_MAP_SIZE,
148 .flags = IORESOURCE_MEM,
150 [1] = {
151 .start = X30_IRQ(ASIC3_EXT_INT),
152 .end = X30_IRQ(ASIC3_EXT_INT),
153 .flags = IORESOURCE_IRQ,
157 struct platform_device x30_asic3 = {
158 .name = "asic3",
159 .id = 0,
160 .num_resources = ARRAY_SIZE(asic3_resources),
161 .resource = asic3_resources,
162 .dev = {
163 .platform_data = &x30_asic3_platform_data,
166 EXPORT_SYMBOL(x30_asic3);
168 /* Core Hardware Functions */
170 static struct resource pxa_cs5_resources[] = {
171 [0] = {
172 .start = X30_EGPIO_WLAN_PHYS, /* EGPIOs: +0x400000 */
173 .end = X30_EGPIO_WLAN_PHYS + 0x1000000, /* WLAN: +0x800000 */
174 .flags = IORESOURCE_MEM,
178 static struct x30_core_funcs core_funcs;
180 struct platform_device x30_core = {
181 .name = "x30-core",
182 .id = 0,
183 .num_resources = ARRAY_SIZE(pxa_cs5_resources),
184 .resource = pxa_cs5_resources,
185 .dev = {
186 .platform_data = &core_funcs,
190 /* USB Device Controller */
192 static int
193 udc_detect(void)
195 if (core_funcs.udc_detect != NULL)
196 return core_funcs.udc_detect();
197 else
198 return 0;
201 static void
202 udc_enable(int cmd)
204 switch (cmd)
206 case PXA2XX_UDC_CMD_DISCONNECT:
207 printk (KERN_NOTICE "USB cmd disconnect\n");
208 SET_X30_GPIO(USB_PUEN, 0);
209 break;
211 case PXA2XX_UDC_CMD_CONNECT:
212 printk (KERN_NOTICE "USB cmd connect\n");
213 SET_X30_GPIO(USB_PUEN, 1);
214 break;
218 static struct pxa2xx_udc_mach_info x30_udc_mach_info = {
219 .udc_is_connected = udc_detect,
220 .udc_command = udc_enable,
223 /* PXA2xx Keys */
225 static struct gpio_keys_button x30_button_table[] = {
226 { KEY_SUSPEND, GPIO_NR_X30_KEY_ON, 1 },
227 { KEY_F11 /* mail */, GPIO_NR_X30_KEY_AP3, 1 },
228 { KEY_F10 /* contacts */, GPIO_NR_X30_KEY_AP1, 1 },
231 static struct gpio_keys_platform_data x30_pxa_keys_data = {
232 .buttons = x30_button_table,
233 .nbuttons = ARRAY_SIZE(x30_button_table),
236 static struct platform_device x30_pxa_keys = {
237 .name = "gpio-keys",
238 .dev = {
239 .platform_data = &x30_pxa_keys_data,
243 static struct platform_device *devices[] __initdata = {
244 &x30_asic3,
245 &x30_core,
246 &x30_pxa_keys,
249 static void __init x30_init( void )
251 #if 0 // keep for reference, from bootldr
252 GPSR0 = 0x0935ede7;
253 GPSR1 = 0xffdf40f7;
254 GPSR2 = 0x0173c9f6;
255 GPSR3 = 0x01f1e342;
256 GPCR0 = ~0x0935ede7;
257 GPCR1 = ~0xffdf40f7;
258 GPCR2 = ~0x0173c9f6;
259 GPCR3 = ~0x01f1e342;
260 GPDR0 = 0xda7a841c;
261 GPDR1 = 0x68efbf83;
262 GPDR2 = 0xbfbff7db;
263 GPDR3 = 0x007ffff5;
264 GAFR0_L = 0x80115554;
265 GAFR0_U = 0x591a8558;
266 GAFR1_L = 0x600a9558;
267 GAFR1_U = 0x0005a0aa;
268 GAFR2_L = 0xa0000000;
269 GAFR2_U = 0x00035402;
270 GAFR3_L = 0x00010000;
271 GAFR3_U = 0x00001404;
272 MSC0 = 0x25e225e2;
273 MSC1 = 0x12cc2364;
274 MSC2 = 0x16dc7ffc;
275 #endif
277 SET_X30_GPIO( ASIC3_RESET_N, 0 );
278 mdelay(50);
279 SET_X30_GPIO( ASIC3_RESET_N, 1 );
280 mdelay(50);
282 platform_add_devices( devices, ARRAY_SIZE(devices) );
283 pxa_set_udc_info( &x30_udc_mach_info );
287 MACHINE_START(X30, "Dell Axim X30")
288 MAINTAINER("Giuseppe Zompatori, <giuseppe_zompatori@yahoo.it>")
289 BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
290 BOOT_PARAMS(0xa0000100)
291 MAPIO(x30_map_io)
292 INITIRQ(x30_init_irq)
293 .timer = &pxa_timer,
294 .init_machine = x30_init,
295 MACHINE_END