ARM: 5821/1: SA1100: h3100/h3600: revise copyright boilerplates
[safe/jmp/linux-2.6] / arch / arm / mach-sa1100 / h3100.c
1 /*
2  * Support for Compaq iPAQ H3100 handheld computer
3  *
4  * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
5  * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  */
12
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/tty.h>
17 #include <linux/pm.h>
18 #include <linux/device.h>
19 #include <linux/mfd/htc-egpio.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/partitions.h>
22 #include <linux/serial_core.h>
23 #include <linux/gpio.h>
24 #include <linux/platform_device.h>
25
26 #include <asm/irq.h>
27 #include <mach/hardware.h>
28 #include <asm/mach-types.h>
29 #include <asm/setup.h>
30
31 #include <asm/mach/irq.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/flash.h>
34 #include <asm/mach/irda.h>
35 #include <asm/mach/map.h>
36 #include <asm/mach/serial_sa1100.h>
37
38 #include <mach/h3xxx.h>
39
40 #include "generic.h"
41
42 /*
43  * helper for sa1100fb
44  */
45 static void h3100_lcd_power(int enable)
46 {
47         if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
48                 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
49                 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
50                 gpio_free(H3XXX_EGPIO_LCD_ON);
51         }
52 }
53
54
55 static void __init h3100_map_io(void)
56 {
57         h3xxx_map_io();
58
59         sa1100fb_lcd_power = h3100_lcd_power;
60
61         /* Older bootldrs put GPIO2-9 in alternate mode on the
62            assumption that they are used for video */
63         GAFR &= ~0x000001fb;
64 }
65
66 /*
67  * This turns the IRDA power on or off on the Compaq H3100
68  */
69 static int h3100_irda_set_power(struct device *dev, unsigned int state)
70 {
71         gpio_set_value(H3100_GPIO_IR_ON, state);
72         return 0;
73 }
74
75 static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
76 {
77         gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
78 }
79
80 static struct irda_platform_data h3100_irda_data = {
81         .set_power      = h3100_irda_set_power,
82         .set_speed      = h3100_irda_set_speed,
83 };
84
85 static struct gpio_default_state h3100_default_gpio[] = {
86         { H3100_GPIO_IR_ON,     GPIO_MODE_OUT0, "IrDA power" },
87         { H3100_GPIO_IR_FSEL,   GPIO_MODE_OUT0, "IrDA fsel" },
88         { H3XXX_GPIO_COM_DCD,   GPIO_MODE_IN,   "COM DCD" },
89         { H3XXX_GPIO_COM_CTS,   GPIO_MODE_IN,   "COM CTS" },
90         { H3XXX_GPIO_COM_RTS,   GPIO_MODE_OUT0, "COM RTS" },
91         { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
92 };
93
94 static void __init h3100_mach_init(void)
95 {
96         h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
97         h3xxx_mach_init();
98         sa11x0_register_irda(&h3100_irda_data);
99 }
100
101 MACHINE_START(H3100, "Compaq iPAQ H3100")
102         .phys_io        = 0x80000000,
103         .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
104         .boot_params    = 0xc0000100,
105         .map_io         = h3100_map_io,
106         .init_irq       = sa1100_init_irq,
107         .timer          = &sa1100_timer,
108         .init_machine   = h3100_mach_init,
109 MACHINE_END
110