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.
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)
62 static void __init
x30_init_irq(void)
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.
86 .dir
= 0xffff, // Unknown, set as outputs so far
88 // .trigger_type = 0x0000,
89 // .edge_trigger = 0x0000,
90 // .leveltri = 0x0000,
91 // .sleep_mask = 0xffff,
93 .batt_fault_out
= 0x0000,
94 // .int_status = 0x0000,
95 .alt_function
= 0xffff,
100 .dir
= 0xffff, // Unknown, set as outputs so far
102 // .trigger_type = 0x0000,
103 // .edge_trigger = 0x0000,
104 // .leveltri = 0x0000,
105 // .sleep_mask = 0xffff,
107 .batt_fault_out
= 0x0000,
108 // .int_status = 0x0000,
109 .alt_function
= 0xffff,
110 .sleep_conf
= 0x000c,
115 // GPIOC_SD_CS_N | GPIOC_CIOW_N | GPIOC_CIOR_N | GPIOC_PWAIT_N | GPIOC_PIOS16_N,
117 // .trigger_type = 0x0000,
118 // .edge_trigger = 0x0000,
119 // .leveltri = 0x0000,
120 // .sleep_mask = 0xffff,
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,
129 .dir
= 0x0000, // Only inputs
131 // .trigger_type = 0x67ff,
132 // .edge_trigger = 0x0000,
133 // .leveltri = 0x0000,
134 // .sleep_mask = 0x9800,
136 .batt_fault_out
= 0x0000,
137 // .int_status = 0x0000,
138 .alt_function
= 0x9800,
139 .sleep_conf
= 0x000c,
144 static struct resource asic3_resources
[] = {
146 .start
= X30_ASIC3_PHYS
,
147 .end
= X30_ASIC3_PHYS
+ IPAQ_ASIC3_MAP_SIZE
,
148 .flags
= IORESOURCE_MEM
,
151 .start
= X30_IRQ(ASIC3_EXT_INT
),
152 .end
= X30_IRQ(ASIC3_EXT_INT
),
153 .flags
= IORESOURCE_IRQ
,
157 struct platform_device x30_asic3
= {
160 .num_resources
= ARRAY_SIZE(asic3_resources
),
161 .resource
= asic3_resources
,
163 .platform_data
= &x30_asic3_platform_data
,
166 EXPORT_SYMBOL(x30_asic3
);
168 /* Core Hardware Functions */
170 static struct resource pxa_cs5_resources
[] = {
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
= {
183 .num_resources
= ARRAY_SIZE(pxa_cs5_resources
),
184 .resource
= pxa_cs5_resources
,
186 .platform_data
= &core_funcs
,
190 /* USB Device Controller */
195 if (core_funcs
.udc_detect
!= NULL
)
196 return core_funcs
.udc_detect();
206 case PXA2XX_UDC_CMD_DISCONNECT
:
207 printk (KERN_NOTICE
"USB cmd disconnect\n");
208 SET_X30_GPIO(USB_PUEN
, 0);
211 case PXA2XX_UDC_CMD_CONNECT
:
212 printk (KERN_NOTICE
"USB cmd connect\n");
213 SET_X30_GPIO(USB_PUEN
, 1);
218 static struct pxa2xx_udc_mach_info x30_udc_mach_info
= {
219 .udc_is_connected
= udc_detect
,
220 .udc_command
= udc_enable
,
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
= {
239 .platform_data
= &x30_pxa_keys_data
,
243 static struct platform_device
*devices
[] __initdata
= {
249 static void __init
x30_init( void )
251 #if 0 // keep for reference, from bootldr
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;
277 SET_X30_GPIO( ASIC3_RESET_N
, 0 );
279 SET_X30_GPIO( ASIC3_RESET_N
, 1 );
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)
292 INITIRQ(x30_init_irq
)
294 .init_machine
= x30_init
,