2 * Hardware definitions for HP iPAQ Handheld Computers
4 * Copyright 2000-2003 Hewlett-Packard Company.
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.
15 * 2004-??-?? Shawn Anderson Derived the from aximx3.c aximx5.c e7xx.c
16 * h1900.c h2200.c h3900.c h5400.c and friends.
17 * 2004-04-01 Eddi De Pieri Move lcd stuff so it can be used as a module.
18 * 2004-04-19 Eddi De Pieri Moving to new 2.6 standard
19 * (platform_device / device_driver structure)
22 #include <linux/kernel.h>
23 #include <linux/init.h>
24 #include <linux/platform_device.h>
27 #include <asm/mach-types.h>
28 #include <asm/hardware.h>
29 #include <asm/setup.h>
31 #include <asm/mach/irq.h>
32 #include <asm/mach/arch.h>
34 #include <asm/arch/bitfield.h>
35 #include <asm/arch/pxa-regs.h>
36 #include <asm/arch/ipaq.h>
37 #include <asm/arch/pxafb.h>
38 #include <linux/soc/asic3_base.h>
39 #include <asm/arch/h4000-gpio.h>
40 #include <asm/arch/h4000-init.h>
41 #include <asm/arch/h4000-asic.h>
43 #include <asm/hardware/ipaq-asic3.h>
45 #include "../generic.h"
46 #define asic3 &h4000_asic3.dev
48 void h4000_ll_pm_init(void);
50 extern struct platform_device h4000_bl
;
51 static struct platform_device h4000_lcd
= { .name
= "h4000_lcd", };
52 static struct platform_device h4300_kbd
= { .name
= "h4300_kbd", };
53 static struct platform_device h4000_buttons
= { .name
= "h4000_buttons", };
54 static struct platform_device h4000_ts
= { .name
= "h4000_ts", };
55 static struct platform_device h4000_udc
= { .name
= "h4000_udc", };
56 static struct platform_device h4000_pcmcia
= { .name
= "h4000_pcmcia", };
57 static struct platform_device h4000_batt
= { .name
= "h4000_batt", };
59 static struct platform_device
*h4000_asic3_devices
[] __initdata
= {
61 #ifdef CONFIG_IPAQ_H4000_BACKLIGHT
72 static struct asic3_platform_data h4000_asic3_platform_data
= {
75 .init
= 0x0000 | GPIOA_RS232_ON
,
77 .batt_fault_out
= 0x0000,
78 .alt_function
= 0x0000,
82 .dir
= 0xddbf, /* 0xdfbd for h4300 kbd irq */
83 .init
= 0x1c00, /* 0x1c05 for h4300 kbd wakeup/power*/
85 .batt_fault_out
= 0x0000,
86 .alt_function
= 0x0000,
90 .dir
= 0xffff, /* 0xfff7 for h4300 key rxd spi */
93 .batt_fault_out
= 0x4000,
94 .alt_function
= 0x0003, /* 0x003b for h4300 kbd spi */
98 .dir
= 0xef03, /* 0xef7b for h4300, no buttons here*/
99 .init
= 0x0f02 | GPIOD_USB_ON
| GPIOD_USB_PULLUP
,
101 .batt_fault_out
= 0x0100,
102 .alt_function
= 0x0000,
103 .sleep_conf
= 0x000c,
105 .child_platform_devs
= h4000_asic3_devices
,
106 .num_child_platform_devs
= ARRAY_SIZE(h4000_asic3_devices
),
109 static struct resource h4000_asic3_resources
[] = {
112 .start
= H4000_ASIC3_PHYS
,
113 .end
= H4000_ASIC3_PHYS
+ IPAQ_ASIC3_MAP_SIZE
,
114 .flags
= IORESOURCE_MEM
,
117 .start
= IRQ_GPIO(GPIO_NR_H4000_ASIC3_IRQ
),
118 .flags
= IORESOURCE_IRQ
,
122 .start
= H4000_ASIC3_SD_PHYS
,
123 .end
= H4000_ASIC3_SD_PHYS
+ IPAQ_ASIC3_MAP_SIZE
,
124 .flags
= IORESOURCE_MEM
,
127 .start
= IRQ_GPIO(GPIO_NR_H4000_SD_IRQ_N
),
128 .flags
= IORESOURCE_IRQ
,
132 struct platform_device h4000_asic3
= {
135 .num_resources
= ARRAY_SIZE(h4000_asic3_resources
),
136 .resource
= h4000_asic3_resources
,
137 .dev
= { .platform_data
= &h4000_asic3_platform_data
, },
139 EXPORT_SYMBOL(h4000_asic3
);
142 void h4000_set_led(int color
, int duty_time
, int cycle_time
)
144 if (color
== H4000_RED_LED
) {
145 asic3_set_led(asic3
, 0, duty_time
, cycle_time
);
146 asic3_set_led(asic3
, 1, 0, cycle_time
);
149 if (color
== H4000_GREEN_LED
) {
150 asic3_set_led(asic3
, 1, duty_time
, cycle_time
);
151 asic3_set_led(asic3
, 0, 0, cycle_time
);
154 if (color
== H4000_YELLOW_LED
) {
155 asic3_set_led(asic3
, 1, duty_time
, cycle_time
);
156 asic3_set_led(asic3
, 0, duty_time
, cycle_time
);
159 EXPORT_SYMBOL(h4000_set_led
);
163 * LCCR0: 0x003008f9 -- ENB=0x1, CMS=0x0, SDS=0x0, LDM=0x1,
164 * SFM=0x1, IUM=0x1, EFM=0x1, PAS=0x1,
165 * res=0x0, DPD=0x0, DIS=0x0, QDM=0x1,
166 * PDD=0x0, BM=0x1, OUM=0x1, res=0x0
167 * LCCR1: 0x13070cef -- BLW=0x13, ELW=0x7, HSW=0x3, PPL=0xef
168 * LCCR2: 0x0708013f -- BFW=0x7, EFW=0x8, VSW=0x0, LPP=0x13f
169 * LCCR3: 0x04700008 -- res=0x0, DPC=0x0, BPP=0x4, OEP=0x0, PCP=0x1
170 * HSP=0x1, VSP=0x1, API=0x0, ACD=0x0, PCD=0x8
173 static struct pxafb_mode_info h4000_lcd_modes
[] __initdata
= {
175 .pixclock
= 171521, // (160756 > 180849)
176 .xres
= 240, // PPL + 1
177 .yres
= 320, // LPP + 1
178 .bpp
= 16, // BPP (0x4 == 16bits)
179 .hsync_len
= 4, // HSW + 1
180 .vsync_len
= 1, // VSW + 1
181 .left_margin
= 20, // BLW + 1
182 .upper_margin
= 8, // BFW + 1
183 .right_margin
= 8, // ELW + 1
184 .lower_margin
= 8, // EFW + 1
189 static struct pxafb_mach_info sony_acx502bmu __initdata
= {
190 .modes
= h4000_lcd_modes
,
191 .num_modes
= ARRAY_SIZE(h4000_lcd_modes
),
193 .lccr0
= LCCR0_Act
| LCCR0_Sngl
| LCCR0_Color
,
194 .lccr3
= LCCR3_OutEnH
| LCCR3_PixFlEdg
| LCCR3_Acb(0),
196 //.pxafb_backlight_power = ,
197 //.pxafb_lcd_power = ,
201 CS3# 0x0C000000, 1 ;HTC Asic3 chip select
202 CS4# 0x10000000, 1 ;SD I/O controller
203 CS5# 0x14000000, 1 ;DBG LED REGISTER
204 0x15000000, 1 ;DBG LAN REGISTER
205 0x16000000, 1 ;DBG PPSH REGISTER */
207 static void __init
h4000_init_irq(void)
212 static void __init
h4000_map_io(void)
216 /* Wake up enable. */
217 PWER
= PWER_GPIO0
| PWER_RTC
;
218 /* Wake up on falling edge. */
219 PFER
= PWER_GPIO0
| PWER_RTC
;
220 /* Wake up on rising edge. */
222 /* 3.6864 MHz oscillator power-down enable */
226 static void __init
h4000_init(void)
228 set_pxa_fb_info(&sony_acx502bmu
);
232 platform_device_register(&h4000_asic3
);
235 MACHINE_START(H4000
, "HP iPAQ H4000")
236 /* Maintainer h4000 port team h4100-port@handhelds.org */
237 .phys_io
= 0x40000000,
238 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
239 .boot_params
= 0xa0000100,
240 .map_io
= h4000_map_io
,
241 .init_irq
= h4000_init_irq
,
242 .init_machine
= h4000_init
,
246 /* vim: set ts=8 tw=80 shiftwidth=8 noet: */