2 * linux/arch/arm/mach-omap1/board-h6300.c
4 * Modified from board-innovator.c
6 * Board specific inits for OMAP-1510 based iPAQ h63xx series of mobile phones.
7 * (h6315, h6340 and h6365)
9 * Copyright (C) 2009 Mika Laitio
10 * Copyright (C) 2009 Husam Senussi
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/delay.h>
20 #include <linux/input.h>
22 #include <asm/hardware.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
27 #include <asm/arch/gpio.h>
28 #include <asm/arch/tc.h>
29 #include <asm/arch/usb.h>
30 #include <asm/arch/keypad.h>
31 #include <asm/arch/common.h>
33 #define _h6300_KEY_CALENDAR 67 // xmodmap 75 aka F9
34 #define _H6300_KEY_TELEPHONE 68 // xmodmap 76 aka F10
35 #define _H6300_KEY_HOMEPAGE 87 // xmodmap 87 aka Num_Lock
36 #define _H6300_KEY_MAIL 88 // xmodmap 88 aka Scroll_Lock
39 * When joypad is pressed on h63xx to up, right, down or left direction,
40 * it does not send keypress events directly from those directions.
41 * Instead we receive multiple events from the keypresses on directions
42 * up_right, down_right, down_left, up_left and ok.
43 * Therefore we are summing those events in kernel level and then
44 * making a decision which event is send to userspace. (up, right, down or left)
46 #define _H6300_JOYPAD_UP_RIGHT 1 // 00001
47 #define _H6300_JOYPAD_DOWN_RIGHT 2 // 00010
48 #define _h6300_JOYPAD_DOWN_LEFT 4 // 00100
49 #define _h6300_JOYPAD_UP_LEFT 8 // 01000
50 #define _H6300_JOYPAD_KEY_OK 16 // 10000
52 static int h6300_keymap[] = {
53 KEY(2, 0, _h6300_KEY_CALENDAR), // address button in the bottom left of iPAQ keypad
54 KEY(2, 3, _H6300_KEY_TELEPHONE), // start call button in the bottom of iPAQ keypad
55 KEY(3, 1, _H6300_KEY_HOMEPAGE), // stop call button in the bottom of iPAQ keypad
56 KEY(3, 4, _H6300_KEY_MAIL), // messaging button in the bottom right of iPAQ keypad
58 KEY(0, 0, KEY_VOLUMEUP), // volume up button in the right side of iPAQ keypad
59 KEY(0, 1, KEY_VOLUMEDOWN), // volume down button in the right side of iPAQ keypad
60 KEY(3, 2, KEY_RECORD), // record button in the left side of iPAQ keypad
62 KEY(1, 0, _h6300_JOYPAD_UP_LEFT),
63 KEY(1, 1, _h6300_JOYPAD_DOWN_LEFT),
64 KEY(1, 2, _H6300_JOYPAD_KEY_OK),
65 KEY(1, 3, _H6300_JOYPAD_DOWN_RIGHT),
66 KEY(1, 4, _H6300_JOYPAD_UP_RIGHT),
77 static struct platform_device h6300_lcd_device = {
82 static struct resource h6300_kp_resources[] = {
84 .start = INT_KEYBOARD,
86 .flags = IORESOURCE_IRQ,
90 static struct omap_kp_platform_data h6300_kp_data = {
93 .keymap = h6300_keymap,
94 .rep = 1, // turns repeat bit on
97 static struct platform_device h6300_kp_device = {
98 .name = "omap-keypad",
101 .platform_data = &h6300_kp_data,
103 .num_resources = ARRAY_SIZE(h6300_kp_resources),
104 .resource = h6300_kp_resources,
107 static struct platform_device *h6300_devices[] __initdata = {
112 static struct omap_lcd_config h6300_lcd_config __initdata = {
113 .ctrl_name = "internal",
116 static struct omap_uart_config h6300_uart_config __initdata = {
117 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
120 /* assume no Mini-AB port */
121 static struct omap_usb_config h6300_usb_config __initdata = {
127 static struct omap_mmc_config h6300_mmc_config __initdata = {
131 .wp_pin = OMAP_GPIO_IRQ(13),
132 .power_pin = -1, // tps65010 ?
133 .switch_pin = -1, // OMAP_MPUIO(1), // = -1, // ARMIO2?
137 static struct omap_board_config_kernel h6300_config[] = {
138 { OMAP_TAG_LCD, &h6300_lcd_config },
139 { OMAP_TAG_UART, &h6300_uart_config },
140 { OMAP_TAG_USB, &h6300_usb_config },
141 { OMAP_TAG_MMC, &h6300_mmc_config },
144 static void __init h6300_init_irq(void)
146 omap1_init_common_hw();
149 /* touchscreen gpio setup is now done in the drivers/input/touschreen/omap/ts_hx.c
150 omap_request_gpio(2);
151 omap_set_gpio_direction(2, 0);
152 omap_set_gpio_dataout(2, 1);
156 static void __init h6300_init(void)
160 ret = platform_add_devices(h6300_devices, ARRAY_SIZE(h6300_devices));
162 printk(KERN_WARNING "Unable to add h6300 platform devices.");
164 omap_board_config = h6300_config;
165 omap_board_config_size = ARRAY_SIZE(h6300_config);
169 static void __init h6300_map_io(void)
171 omap1_map_common_io();
174 MACHINE_START(OMAP_H6300, "HP iPAQ h6300")
175 /* MAINTAINER("Mika Laitio <lamikr at pilppa dot org>") */
176 .phys_io = 0xfff00000,
177 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
178 .boot_params = 0x10000100,
179 .map_io = h6300_map_io,
180 .init_irq = h6300_init_irq,
181 .init_machine = h6300_init,
182 .timer = &omap_timer,