blob: 429fdb051a356f315331ecb014a089c04081c351 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Hardware definitions for Compaq iPAQ H3xxx Handheld Computers
3 *
4 * Copyright 2000,1 Compaq Computer Corporation.
5 *
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.
9 *
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.
13 *
14 * Author: Jamey Hicks.
15 *
16 * History:
17 *
18 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
19 * and abstracted EGPIO interface.
20 *
21 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/kernel.h>
25#include <linux/tty.h>
26#include <linux/pm.h>
27#include <linux/device.h>
Dmitry Artamonow2eec62d2009-11-27 12:00:00 +010028#include <linux/mfd/htc-egpio.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/mtd/mtd.h>
30#include <linux/mtd/partitions.h>
31#include <linux/serial_core.h>
Russell King0831e3e2009-10-06 14:35:16 +010032#include <linux/gpio.h>
Dmitry Artamonow2eec62d2009-11-27 12:00:00 +010033#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35#include <asm/irq.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010036#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#include <asm/mach-types.h>
38#include <asm/setup.h>
39
40#include <asm/mach/irq.h>
41#include <asm/mach/arch.h>
42#include <asm/mach/flash.h>
43#include <asm/mach/irda.h>
44#include <asm/mach/map.h>
45#include <asm/mach/serial_sa1100.h>
46
Russell Kinga09e64f2008-08-05 16:14:15 +010047#include <mach/h3600.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010048#include <mach/h3600_gpio.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50#include "generic.h"
51
Dmitry Artamonow607b0672009-03-15 19:14:27 +010052void (*assign_h3600_egpio)(enum ipaq_egpio_type x, int level);
53EXPORT_SYMBOL(assign_h3600_egpio);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Russell King0831e3e2009-10-06 14:35:16 +010055struct gpio_default_state {
56 int gpio;
57 int mode;
58 const char *name;
59};
60
61#define GPIO_MODE_IN -1
62#define GPIO_MODE_OUT0 0
63#define GPIO_MODE_OUT1 1
64
65static void h3xxx_init_gpio(struct gpio_default_state *s, size_t n)
66{
67 while (n--) {
68 const char *name = s->name;
69 int err;
70
71 if (!name)
72 name = "[init]";
73 err = gpio_request(s->gpio, name);
74 if (err) {
75 printk(KERN_ERR "gpio%u: unable to request: %d\n",
76 s->gpio, err);
77 continue;
78 }
79 if (s->mode >= 0) {
80 err = gpio_direction_output(s->gpio, s->mode);
81 } else {
82 err = gpio_direction_input(s->gpio);
83 }
84 if (err) {
85 printk(KERN_ERR "gpio%u: unable to set direction: %d\n",
86 s->gpio, err);
87 continue;
88 }
89 if (!s->name)
90 gpio_free(s->gpio);
91 s++;
92 }
93}
94
95
Russell King6e21ee62009-10-06 15:16:27 +010096/*
97 * H3xxx flash support
98 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070099static struct mtd_partition h3xxx_partitions[] = {
100 {
101 .name = "H3XXX boot firmware",
102 .size = 0x00040000,
103 .offset = 0,
104 .mask_flags = MTD_WRITEABLE, /* force read-only */
105 }, {
Dmitry Artamonowf110b3f2009-03-15 19:09:50 +0100106 .name = "H3XXX rootfs",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 .size = MTDPART_SIZ_FULL,
108 .offset = 0x00040000,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 }
110};
111
112static void h3xxx_set_vpp(int vpp)
113{
114 assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp);
115}
116
117static struct flash_platform_data h3xxx_flash_data = {
118 .map_name = "cfi_probe",
119 .set_vpp = h3xxx_set_vpp,
120 .parts = h3xxx_partitions,
121 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
122};
123
124static struct resource h3xxx_flash_resource = {
125 .start = SA1100_CS0_PHYS,
126 .end = SA1100_CS0_PHYS + SZ_32M - 1,
127 .flags = IORESOURCE_MEM,
128};
129
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
131/*
Russell King6e21ee62009-10-06 15:16:27 +0100132 * H3xxx uart support
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 */
Russell King6e21ee62009-10-06 15:16:27 +0100134static void h3xxx_uart_set_mctrl(struct uart_port *port, u_int mctrl)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135{
136 if (port->mapbase == _Ser3UTCR0) {
Russell King6e21ee62009-10-06 15:16:27 +0100137 gpio_set_value(H3XXX_GPIO_COM_RTS, !(mctrl & TIOCM_RTS));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 }
139}
140
Russell King6e21ee62009-10-06 15:16:27 +0100141static u_int h3xxx_uart_get_mctrl(struct uart_port *port)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142{
143 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
144
145 if (port->mapbase == _Ser3UTCR0) {
Russell King6e21ee62009-10-06 15:16:27 +0100146 /*
147 * DCD and CTS bits are inverted in GPLR by RS232 transceiver
148 */
149 if (gpio_get_value(H3XXX_GPIO_COM_DCD))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 ret &= ~TIOCM_CD;
Russell King6e21ee62009-10-06 15:16:27 +0100151 if (gpio_get_value(H3XXX_GPIO_COM_CTS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 ret &= ~TIOCM_CTS;
153 }
154
155 return ret;
156}
157
Russell King6e21ee62009-10-06 15:16:27 +0100158static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159{
Dmitry Artamonow2a151a02009-11-27 11:10:58 +0100160 if (port->mapbase == _Ser3UTCR0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 assign_h3600_egpio(IPAQ_EGPIO_RS232_ON, !state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162}
163
164/*
165 * Enable/Disable wake up events for this serial port.
166 * Obviously, we only support this on the normal COM port.
167 */
Russell King6e21ee62009-10-06 15:16:27 +0100168static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169{
170 int err = -EINVAL;
171
172 if (port->mapbase == _Ser3UTCR0) {
173 if (enable)
174 PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */
175 else
176 PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */
177 err = 0;
178 }
179 return err;
180}
181
Russell King6e21ee62009-10-06 15:16:27 +0100182static struct sa1100_port_fns h3xxx_port_fns __initdata = {
183 .set_mctrl = h3xxx_uart_set_mctrl,
184 .get_mctrl = h3xxx_uart_get_mctrl,
185 .pm = h3xxx_uart_pm,
186 .set_wake = h3xxx_uart_set_wake,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187};
188
Dmitry Artamonow2eec62d2009-11-27 12:00:00 +0100189/*
190 * EGPIO
191 */
192
193static struct resource egpio_resources[] = {
194 [0] = {
195 .start = H3600_EGPIO_PHYS,
196 .end = H3600_EGPIO_PHYS + 0x4 - 1,
197 .flags = IORESOURCE_MEM,
198 },
199};
200
201static struct htc_egpio_chip egpio_chips[] = {
202 [0] = {
203 .reg_start = 0,
204 .gpio_base = H3XXX_EGPIO_BASE,
205 .num_gpios = 16,
206 .direction = HTC_EGPIO_OUTPUT,
207 .initial_values = 0x0080, /* H3XXX_EGPIO_RS232_ON */
208 },
209};
210
211static struct htc_egpio_platform_data egpio_info = {
212 .reg_width = 16,
213 .bus_width = 16,
214 .chip = egpio_chips,
215 .num_chips = ARRAY_SIZE(egpio_chips),
216};
217
218static struct platform_device h3xxx_egpio = {
219 .name = "htc-egpio",
220 .id = -1,
221 .resource = egpio_resources,
222 .num_resources = ARRAY_SIZE(egpio_resources),
223 .dev = {
224 .platform_data = &egpio_info,
225 },
226};
227
228static struct platform_device *h3xxx_devices[] = {
229 &h3xxx_egpio,
230};
Russell King6e21ee62009-10-06 15:16:27 +0100231
Dmitry Artamonowe55b20e2009-11-27 11:06:46 +0100232static void __init h3xxx_mach_init(void)
Russell King6e21ee62009-10-06 15:16:27 +0100233{
234 sa1100_register_uart_fns(&h3xxx_port_fns);
235 sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
Dmitry Artamonow2eec62d2009-11-27 12:00:00 +0100236 platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));
Russell King6e21ee62009-10-06 15:16:27 +0100237}
238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239static struct map_desc h3600_io_desc[] __initdata = {
Deepak Saxena92519d82005-10-28 15:19:04 +0100240 { /* static memory bank 2 CS#2 */
241 .virtual = H3600_BANK_2_VIRT,
242 .pfn = __phys_to_pfn(SA1100_CS2_PHYS),
243 .length = 0x02800000,
244 .type = MT_DEVICE
245 }, { /* static memory bank 4 CS#4 */
246 .virtual = H3600_BANK_4_VIRT,
247 .pfn = __phys_to_pfn(SA1100_CS4_PHYS),
248 .length = 0x00800000,
249 .type = MT_DEVICE
250 }, { /* EGPIO 0 CS#5 */
251 .virtual = H3600_EGPIO_VIRT,
252 .pfn = __phys_to_pfn(H3600_EGPIO_PHYS),
253 .length = 0x01000000,
254 .type = MT_DEVICE
255 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256};
257
258/*
259 * Common map_io initialization
260 */
261
262static void __init h3xxx_map_io(void)
263{
264 sa1100_map_io();
265 iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc));
266
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 sa1100_register_uart(0, 3); /* Common serial port */
268// sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
269
270 /* Ensure those pins are outputs and driving low */
271 PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
272 PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
273
274 /* Configure suspend conditions */
275 PGSR = 0;
Russell King0fb85a52009-10-06 16:40:24 +0100276 PWER = PWER_GPIO0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 PCFR = PCFR_OPDE;
278 PSDR = 0;
279
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280}
281
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282/************************* H3100 *************************/
283
284#ifdef CONFIG_SA1100_H3100
285
286#define H3100_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
287static unsigned int h3100_egpio = 0;
288
289static void h3100_control_egpio(enum ipaq_egpio_type x, int setp)
290{
291 unsigned int egpio = 0;
292 long gpio = 0;
293 unsigned long flags;
294
295 switch (x) {
296 case IPAQ_EGPIO_LCD_POWER:
297 egpio |= EGPIO_H3600_LCD_ON;
298 gpio |= GPIO_H3100_LCD_3V_ON;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 break;
300 case IPAQ_EGPIO_LCD_ENABLE:
301 break;
302 case IPAQ_EGPIO_CODEC_NRESET:
303 egpio |= EGPIO_H3600_CODEC_NRESET;
304 break;
305 case IPAQ_EGPIO_AUDIO_ON:
306 gpio |= GPIO_H3100_AUD_PWR_ON
307 | GPIO_H3100_AUD_ON;
308 break;
309 case IPAQ_EGPIO_QMUTE:
310 gpio |= GPIO_H3100_QMUTE;
311 break;
312 case IPAQ_EGPIO_OPT_NVRAM_ON:
313 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
314 break;
315 case IPAQ_EGPIO_OPT_ON:
316 egpio |= EGPIO_H3600_OPT_ON;
317 break;
318 case IPAQ_EGPIO_CARD_RESET:
319 egpio |= EGPIO_H3600_CARD_RESET;
320 break;
321 case IPAQ_EGPIO_OPT_RESET:
322 egpio |= EGPIO_H3600_OPT_RESET;
323 break;
324 case IPAQ_EGPIO_IR_ON:
325 gpio |= GPIO_H3100_IR_ON;
326 break;
327 case IPAQ_EGPIO_IR_FSEL:
328 gpio |= GPIO_H3100_IR_FSEL;
329 break;
330 case IPAQ_EGPIO_RS232_ON:
331 egpio |= EGPIO_H3600_RS232_ON;
332 break;
333 case IPAQ_EGPIO_VPP_ON:
334 egpio |= EGPIO_H3600_VPP_ON;
335 break;
336 }
337
338 if (egpio || gpio) {
339 local_irq_save(flags);
340 if (setp) {
341 h3100_egpio |= egpio;
342 GPSR = gpio;
343 } else {
344 h3100_egpio &= ~egpio;
345 GPCR = gpio;
346 }
347 H3100_EGPIO = h3100_egpio;
348 local_irq_restore(flags);
349 }
350}
351
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352#define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \
353 | GPIO_H3100_GPIO3 \
354 | GPIO_H3100_QMUTE \
355 | GPIO_H3100_LCD_3V_ON \
356 | GPIO_H3100_AUD_ON \
357 | GPIO_H3100_AUD_PWR_ON \
358 | GPIO_H3100_IR_ON \
359 | GPIO_H3100_IR_FSEL)
Dmitry Artamonowcf5a87d2009-11-27 11:58:35 +0100360/*
361 * helper for sa1100fb
362 */
363static void h3100_lcd_power(int enable)
364{
365 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable);
366}
367
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368
369static void __init h3100_map_io(void)
370{
371 h3xxx_map_io();
372
Dmitry Artamonowcf5a87d2009-11-27 11:58:35 +0100373 sa1100fb_lcd_power = h3100_lcd_power;
374
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 /* Initialize h3100-specific values here */
376 GPCR = 0x0fffffff; /* All outputs are set low by default */
Russell King6e21ee62009-10-06 15:16:27 +0100377 GPDR = GPIO_H3600_L3_CLOCK |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
379 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
380 H3100_DIRECT_EGPIO;
381
382 /* Older bootldrs put GPIO2-9 in alternate mode on the
383 assumption that they are used for video */
384 GAFR &= ~H3100_DIRECT_EGPIO;
385
386 H3100_EGPIO = h3100_egpio;
Dmitry Artamonow607b0672009-03-15 19:14:27 +0100387 assign_h3600_egpio = h3100_control_egpio;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388}
389
Russell Kinga5d176a2009-10-06 14:22:23 +0100390/*
391 * This turns the IRDA power on or off on the Compaq H3100
392 */
393static int h3100_irda_set_power(struct device *dev, unsigned int state)
394{
Russell King9c196f02009-10-06 14:36:05 +0100395 gpio_set_value(H3100_GPIO_IR_ON, state);
Russell Kinga5d176a2009-10-06 14:22:23 +0100396 return 0;
397}
398
399static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
400{
Russell King9c196f02009-10-06 14:36:05 +0100401 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
Russell Kinga5d176a2009-10-06 14:22:23 +0100402}
403
404static struct irda_platform_data h3100_irda_data = {
405 .set_power = h3100_irda_set_power,
406 .set_speed = h3100_irda_set_speed,
407};
408
Russell King9c196f02009-10-06 14:36:05 +0100409static struct gpio_default_state h3100_default_gpio[] = {
410 { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
411 { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
Russell King6e21ee62009-10-06 15:16:27 +0100412 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
413 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
414 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
Russell King9c196f02009-10-06 14:36:05 +0100415};
416
Dmitry Artamonowe55b20e2009-11-27 11:06:46 +0100417static void __init h3100_mach_init(void)
Russell King898e8102009-10-06 14:19:44 +0100418{
Russell King9c196f02009-10-06 14:36:05 +0100419 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
Russell King898e8102009-10-06 14:19:44 +0100420 h3xxx_mach_init();
Russell Kinga5d176a2009-10-06 14:22:23 +0100421 sa11x0_register_irda(&h3100_irda_data);
Russell King898e8102009-10-06 14:19:44 +0100422}
423
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424MACHINE_START(H3100, "Compaq iPAQ H3100")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100425 .phys_io = 0x80000000,
426 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
427 .boot_params = 0xc0000100,
428 .map_io = h3100_map_io,
429 .init_irq = sa1100_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 .timer = &sa1100_timer,
Russell King898e8102009-10-06 14:19:44 +0100431 .init_machine = h3100_mach_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432MACHINE_END
433
434#endif /* CONFIG_SA1100_H3100 */
435
436/************************* H3600 *************************/
437
438#ifdef CONFIG_SA1100_H3600
439
440#define H3600_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
441static unsigned int h3600_egpio = EGPIO_H3600_RS232_ON;
442
443static void h3600_control_egpio(enum ipaq_egpio_type x, int setp)
444{
445 unsigned int egpio = 0;
446 unsigned long flags;
447
448 switch (x) {
449 case IPAQ_EGPIO_LCD_POWER:
450 egpio |= EGPIO_H3600_LCD_ON |
451 EGPIO_H3600_LCD_PCI |
452 EGPIO_H3600_LCD_5V_ON |
453 EGPIO_H3600_LVDD_ON;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 break;
455 case IPAQ_EGPIO_LCD_ENABLE:
456 break;
457 case IPAQ_EGPIO_CODEC_NRESET:
458 egpio |= EGPIO_H3600_CODEC_NRESET;
459 break;
460 case IPAQ_EGPIO_AUDIO_ON:
461 egpio |= EGPIO_H3600_AUD_AMP_ON |
462 EGPIO_H3600_AUD_PWR_ON;
463 break;
464 case IPAQ_EGPIO_QMUTE:
465 egpio |= EGPIO_H3600_QMUTE;
466 break;
467 case IPAQ_EGPIO_OPT_NVRAM_ON:
468 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
469 break;
470 case IPAQ_EGPIO_OPT_ON:
471 egpio |= EGPIO_H3600_OPT_ON;
472 break;
473 case IPAQ_EGPIO_CARD_RESET:
474 egpio |= EGPIO_H3600_CARD_RESET;
475 break;
476 case IPAQ_EGPIO_OPT_RESET:
477 egpio |= EGPIO_H3600_OPT_RESET;
478 break;
479 case IPAQ_EGPIO_IR_ON:
480 egpio |= EGPIO_H3600_IR_ON;
481 break;
482 case IPAQ_EGPIO_IR_FSEL:
483 egpio |= EGPIO_H3600_IR_FSEL;
484 break;
485 case IPAQ_EGPIO_RS232_ON:
486 egpio |= EGPIO_H3600_RS232_ON;
487 break;
488 case IPAQ_EGPIO_VPP_ON:
489 egpio |= EGPIO_H3600_VPP_ON;
490 break;
491 }
492
493 if (egpio) {
494 local_irq_save(flags);
495 if (setp)
496 h3600_egpio |= egpio;
497 else
498 h3600_egpio &= ~egpio;
499 H3600_EGPIO = h3600_egpio;
500 local_irq_restore(flags);
501 }
502}
503
Dmitry Artamonowcf5a87d2009-11-27 11:58:35 +0100504/*
505 * helper for sa1100fb
506 */
507static void h3600_lcd_power(int enable)
508{
509 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable);
510}
511
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512static void __init h3600_map_io(void)
513{
514 h3xxx_map_io();
515
Dmitry Artamonowcf5a87d2009-11-27 11:58:35 +0100516 sa1100fb_lcd_power = h3600_lcd_power;
517
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 /* Initialize h3600-specific values here */
519
520 GPCR = 0x0fffffff; /* All outputs are set low by default */
Russell King6e21ee62009-10-06 15:16:27 +0100521 GPDR = GPIO_H3600_L3_CLOCK |
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
Dmitry Artamonowd0e60412009-11-27 11:11:00 +0100523 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524
525 H3600_EGPIO = h3600_egpio; /* Maintains across sleep? */
Dmitry Artamonow607b0672009-03-15 19:14:27 +0100526 assign_h3600_egpio = h3600_control_egpio;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527}
528
Russell Kinga5d176a2009-10-06 14:22:23 +0100529/*
530 * This turns the IRDA power on or off on the Compaq H3600
531 */
532static int h3600_irda_set_power(struct device *dev, unsigned int state)
533{
534 assign_h3600_egpio(IPAQ_EGPIO_IR_ON, state);
535 return 0;
536}
537
538static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
539{
540 assign_h3600_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000));
541}
542
543static struct irda_platform_data h3600_irda_data = {
544 .set_power = h3600_irda_set_power,
545 .set_speed = h3600_irda_set_speed,
546};
547
Russell King6e21ee62009-10-06 15:16:27 +0100548static struct gpio_default_state h3600_default_gpio[] = {
549 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
550 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
551 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
552};
553
Dmitry Artamonowe55b20e2009-11-27 11:06:46 +0100554static void __init h3600_mach_init(void)
Russell King898e8102009-10-06 14:19:44 +0100555{
Russell King6e21ee62009-10-06 15:16:27 +0100556 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio));
Russell King898e8102009-10-06 14:19:44 +0100557 h3xxx_mach_init();
Russell Kinga5d176a2009-10-06 14:22:23 +0100558 sa11x0_register_irda(&h3600_irda_data);
Russell King898e8102009-10-06 14:19:44 +0100559}
560
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561MACHINE_START(H3600, "Compaq iPAQ H3600")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100562 .phys_io = 0x80000000,
563 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
564 .boot_params = 0xc0000100,
565 .map_io = h3600_map_io,
566 .init_irq = sa1100_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .timer = &sa1100_timer,
Russell King898e8102009-10-06 14:19:44 +0100568 .init_machine = h3600_mach_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569MACHINE_END
570
571#endif /* CONFIG_SA1100_H3600 */
572