sync hh.org
[hh.org.git] / arch / arm / plat-ipaq / h3100.c
bloba0921c1c45e2d65042da92dccb2b98ac798d774e
1 /*
2 * Hardware definitions for HP iPAQ H31xx Handheld Computers
4 * Copyright 2000-2002 Compaq Computer Corporation.
5 * Copyright 2002-2003 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 * Author: Jamey Hicks.
17 * History:
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 * and abstracted EGPIO interface.
23 #include <linux/module.h>
24 #include <linux/init.h>
25 #include <linux/kernel.h>
26 #include <linux/tty.h>
27 #include <linux/sched.h>
28 #include <linux/pm.h>
29 #include <linux/lcd.h>
30 #include <linux/backlight.h>
31 #include <linux/fb.h>
32 #include <../drivers/video/sa1100fb.h>
34 #include <asm/irq.h>
35 #include <asm/hardware.h>
36 #include <asm/mach-types.h>
37 #include <asm/setup.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/map.h>
41 #include <asm/mach/serial_sa1100.h>
43 #include <linux/serial_core.h>
45 #if defined (CONFIG_SA1100_H3600) || defined (CONFIG_SA1100_H3100)
46 #include <asm/arch/h3600_gpio.h>
47 #endif
49 #include "../mach-sa1100/generic.h"
52 /************************* H3100 *************************/
54 #define H3100_EGPIO (*(volatile unsigned int *)IPAQSA_EGPIO_VIRT)
55 static unsigned int h3100_egpio = 0;
57 static void h3100_control_egpio( enum ipaq_egpio_type x, int setp )
59 unsigned int egpio = 0;
60 long gpio = 0;
61 unsigned long flags;
63 switch (x) {
64 case IPAQ_EGPIO_CODEC_NRESET:
65 egpio |= EGPIO_H3600_CODEC_NRESET;
66 break;
67 case IPAQ_EGPIO_AUDIO_ON:
68 gpio |= GPIO_H3100_AUD_PWR_ON
69 | GPIO_H3100_AUD_ON;
70 break;
71 case IPAQ_EGPIO_QMUTE:
72 gpio |= GPIO_H3100_QMUTE;
73 break;
74 case IPAQ_EGPIO_OPT_NVRAM_ON:
75 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
76 break;
77 case IPAQ_EGPIO_OPT_ON:
78 egpio |= EGPIO_H3600_OPT_ON;
79 break;
80 case IPAQ_EGPIO_CARD_RESET:
81 egpio |= EGPIO_H3600_CARD_RESET;
82 break;
83 case IPAQ_EGPIO_OPT_RESET:
84 egpio |= EGPIO_H3600_OPT_RESET;
85 break;
86 case IPAQ_EGPIO_IR_ON:
87 gpio |= GPIO_H3100_IR_ON;
88 break;
89 case IPAQ_EGPIO_IR_FSEL:
90 gpio |= GPIO_H3100_IR_FSEL;
91 break;
92 case IPAQ_EGPIO_RS232_ON:
93 egpio |= EGPIO_H3600_RS232_ON;
94 break;
95 case IPAQ_EGPIO_VPP_ON:
96 egpio |= EGPIO_H3600_VPP_ON;
97 break;
98 default:
99 printk("%s: unhandled egpio=%d\n", __FUNCTION__, x);
102 if ( egpio || gpio ) {
103 local_irq_save(flags);
104 if ( setp ) {
105 h3100_egpio |= egpio;
106 GPSR = gpio;
107 } else {
108 h3100_egpio &= ~egpio;
109 GPCR = gpio;
111 H3100_EGPIO = h3100_egpio;
112 local_irq_restore(flags);
116 static struct ipaq_model_ops h3100_model_ops __initdata = {
117 .generic_name = "3100",
118 .control = h3100_control_egpio,
122 #if 0
123 static struct sa1100fb_mach_info h3100_sa1100fb_mach_info __initdata = {
124 .pixclock = 406977, .bpp = 4,
125 .xres = 320, .yres = 240,
127 .hsync_len = 26, .vsync_len = 41,
128 .left_margin = 4, .upper_margin = 0,
129 .right_margin = 4, .lower_margin = 0,
131 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
132 .cmap_greyscale = 1,
133 .cmap_inverse = 1,
135 .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas,
136 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
139 static void *h3100_get_mach_info(struct lcd_device *lm)
141 return (void *)&h3100_sa1100fb_mach_info;
144 struct lcd_device h3100_lcd_device = {
145 .get_mach_info = h3100_get_mach_info,
146 .set_power = h3100_lcd_set_power,
147 .get_power = h3100_lcd_get_power
149 #endif
152 #define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \
153 | GPIO_H3100_GPIO3 \
154 | GPIO_H3100_QMUTE \
155 | GPIO_H3100_LCD_3V_ON \
156 | GPIO_H3100_AUD_ON \
157 | GPIO_H3100_AUD_PWR_ON \
158 | GPIO_H3100_IR_ON \
159 | GPIO_H3100_IR_FSEL)
161 static void __init h3100_map_io(void)
163 ipaqsa_map_io();
164 /* sa1100_register_uart(1, 1); */ /* Microcontroller */
166 /* Initialize h3100-specific values here */
167 GPCR = 0x0fffffff; /* All outputs are set low by default */
168 GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK |
169 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
170 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
171 H3100_DIRECT_EGPIO;
173 /* Older bootldrs put GPIO2-9 in alternate mode on the
174 assumption that they are used for video */
175 GAFR &= ~H3100_DIRECT_EGPIO;
177 H3100_EGPIO = h3100_egpio;
178 ipaq_model_ops = h3100_model_ops;
181 static void __init h3100_mach_init(void)
183 ipaqsa_mach_init();
186 MACHINE_START(H3100, "HP iPAQ H3100")
187 BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
188 BOOT_PARAMS(0xc0000100)
189 MAPIO(h3100_map_io)
190 INITIRQ(sa1100_init_irq)
191 .timer = &sa1100_timer,
192 .init_machine = &h3100_mach_init,
193 MACHINE_END