2 * Platform code for the iPAQ h1910/h1915
4 * Copyright 2000-2003 Hewlett-Packard Company.
5 * Copyright (C) 2005 Pawel Kolodziejski
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 * Authors: Jamey Hicks <jamey.hicks at hp.com>, Joshua Wise <joshua at joshuawise.com>.
19 * 2003-08-28 Joshua Wise Ported to kernel 2.6
20 * 2003-05-14 Joshua Wise Adapted for the HP iPAQ H1900
21 * 2002-08-23 Jamey Hicks Adapted for use with PXA250-based iPAQs
22 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
23 * and abstracted EGPIO interface.
27 #include <linux/module.h>
28 #include <linux/init.h>
29 #include <linux/kernel.h>
30 #include <linux/tty.h>
31 #include <linux/sched.h>
32 #include <linux/delay.h>
34 #include <linux/bootmem.h>
35 #include <linux/lcd.h>
36 #include <linux/backlight.h>
38 #include <linux/soc/asic3_base.h>
39 #include <linux/platform_device.h>
42 #include <asm/mach-types.h>
43 #include <asm/hardware.h>
44 #include <asm/setup.h>
47 #include <asm/mach/irq.h>
48 #include <asm/mach/arch.h>
49 #include <asm/mach/map.h>
50 #include <asm/mach/irda.h>
51 #include <asm/arch/h1900-asic.h>
52 #include <asm/arch/h1900-gpio.h>
53 #include <asm/arch/ipaq.h>
54 #include <asm/arch/udc.h>
55 #include <asm/arch/pxafb.h>
56 #include <asm/arch/irda.h>
58 #include <asm/arch/pxa-regs.h>
59 #include <asm/arch/irq.h>
60 #include <asm/types.h>
63 #include "../generic.h"
65 void h1900_ll_pm_init(void);
67 static struct platform_device h1900_lcd
= { .name
= "h1900-lcd", };
68 static struct platform_device h1900_buttons
= { .name
= "h1900-buttons", };
69 static struct platform_device h1900_ssp
= { .name
= "h1900-ssp", };
70 static struct platform_device h1900_power
= { .name
= "h1900-power", };
72 extern struct platform_device h1900_asic3
;
74 static struct platform_device
*child_devices
[] __initdata
= {
80 static struct asic3_platform_data h1900_asic3_platform_data
= {
86 .batt_fault_out
= 0x0000,
87 .alt_function
= 0x0000,
95 .batt_fault_out
= 0x0000,
96 .alt_function
= 0x0000,
102 .sleep_mask
= 0xffff,
104 .batt_fault_out
= 0x0000,
105 .alt_function
= 0x0003,
106 .sleep_conf
= 0x000c,
111 .sleep_mask
= 0xff83,
113 .batt_fault_out
= 0x0100,
114 .alt_function
= 0x0000,
115 .sleep_conf
= 0x000c,
117 .child_platform_devs
= child_devices
,
118 .num_child_platform_devs
= ARRAY_SIZE(child_devices
),
121 static struct platform_device
*core_devices
[] __initdata
= {
126 static struct resource h1900_asic3_resources
[] = {
129 .end
= 0x0c000000 + IPAQ_ASIC3_MAP_SIZE
,
130 .flags
= IORESOURCE_MEM
,
133 .start
= IRQ_GPIO(GPIO_NR_H1900_ASIC_IRQ_1_N
),
134 .flags
= IORESOURCE_IRQ
,
138 .end
= 0x10000000 + IPAQ_ASIC3_MAP_SIZE
,
139 .flags
= IORESOURCE_MEM
,
142 .start
= IRQ_GPIO(GPIO_NR_H1900_SD_IRQ_N
),
143 .flags
= IORESOURCE_IRQ
,
147 struct platform_device h1900_asic3
= {
150 .num_resources
= ARRAY_SIZE(h1900_asic3_resources
),
151 .resource
= h1900_asic3_resources
,
152 .dev
= { .platform_data
= &h1900_asic3_platform_data
, },
154 EXPORT_SYMBOL(h1900_asic3
);
156 #define asic3 &h1900_asic3.dev
158 static void h1900_irda_transceiver_mode(struct device
*dev
, int mode
) {}
160 static struct pxaficp_platform_data h1900_ficp_platform_data
= {
161 .transceiver_cap
= IR_SIRMODE
,
162 .transceiver_mode
= h1900_irda_transceiver_mode
,
165 static void h1900_init_pxa_gpio(void)
179 GAFR0_L
= 0x00000000;
180 GAFR0_U
= 0x5A1A8012;
181 GAFR1_L
= 0x60000009;
182 GAFR1_U
= 0xAAA10008;
183 GAFR2_L
= 0xAAAAAAAA;
184 GAFR2_U
= 0x00000002;
200 PWER
= PWER_RTC
| PWER_GPIO0
| PWER_GPIO3
| PWER_GPIO4
;
201 PFER
= PWER_GPIO0
| PWER_GPIO4
;
207 void h1900_set_led(int color
, int duty_time
, int cycle_time
)
209 if (color
== H1900_RED_LED
) {
210 asic3_set_led(asic3
, 0, duty_time
, cycle_time
);
211 asic3_set_led(asic3
, 1, 0, cycle_time
);
214 if (color
== H1900_GREEN_LED
) {
215 asic3_set_led(asic3
, 1, duty_time
, cycle_time
);
216 asic3_set_led(asic3
, 0, 0, cycle_time
);
219 if (color
== H1900_YELLOW_LED
) {
220 asic3_set_led(asic3
, 1, duty_time
, cycle_time
);
221 asic3_set_led(asic3
, 0, duty_time
, cycle_time
);
225 int h1900_backlight_set_power(struct backlight_device
*bl
, int level
);
226 int h1900_lcd_set_power(struct lcd_device
*lm
, int level
);
228 static void h1900_lcd_power(int level
)
230 h1900_lcd_set_power(NULL
, level
);
233 static void h1900_backlight_power(int level
)
235 h1900_backlight_set_power(NULL
, level
);
238 static struct pxafb_mach_info h1900_fb_info
= {
250 .lccr0
= (LCCR0_PAS
),
251 .pxafb_lcd_power
= (void *)h1900_lcd_power
,
252 .pxafb_backlight_power
= (void *)h1900_backlight_power
,
255 static int h1900_udc_is_connected(void)
257 return (!(GPLR(GPIO_NR_H1900_USB_DETECT2_N
) & GPIO_bit(GPIO_NR_H1900_USB_DETECT2_N
)));
260 static void h1900_udc_command(int cmd
)
263 case PXA2XX_UDC_CMD_DISCONNECT
:
264 asic3_set_gpio_out_d(asic3
, GPIO4_H1900_USB
, 0);
266 case PXA2XX_UDC_CMD_CONNECT
:
267 asic3_set_gpio_out_d(asic3
, GPIO4_H1900_USB
, GPIO4_H1900_USB
);
270 printk("_udc_control: unknown command!\n");
275 struct pxa2xx_udc_mach_info h1900_udc_mach_info
= {
276 .udc_is_connected
= h1900_udc_is_connected
,
277 .udc_command
= h1900_udc_command
,
280 static void __init
h1900_init(void)
282 h1900_init_pxa_gpio();
284 pxa_set_ficp_info(&h1900_ficp_platform_data
);
285 pxa_set_udc_info(&h1900_udc_mach_info
);
286 set_pxa_fb_info(&h1900_fb_info
);
289 platform_add_devices(core_devices
, ARRAY_SIZE(core_devices
));
292 MACHINE_START(H1900
, "HP iPAQ H1910")
293 /* Maintainer: Pawel Kolodziejski */
294 .phys_io
= 0x40000000,
295 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
296 .boot_params
= 0xa0000100,
297 .map_io
= pxa_map_io
,
298 .init_irq
= pxa_init_irq
,
300 .init_machine
= h1900_init
,