]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap1/board-nokia770.c
2c583d1949a40df8feb05fbc621570b52c2cd942
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / board-nokia770.c
1 /*
2  * linux/arch/arm/mach-omap1/board-nokia770.c
3  *
4  * Modified from board-generic.c
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/input.h>
15
16 #include <linux/spi/spi.h>
17 #include <linux/spi/ads7846.h>
18
19 #include <asm/hardware.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23
24 #include <asm/arch/gpio.h>
25 #include <asm/arch/mux.h>
26 #include <asm/arch/usb.h>
27 #include <asm/arch/board.h>
28 #include <asm/arch/keypad.h>
29 #include <asm/arch/common.h>
30
31 static void __init omap_nokia770_init_irq(void)
32 {
33         omap1_init_common_hw();
34         omap_init_irq();
35 }
36
37 static int nokia770_keymap[] = {
38         KEY(0, 1, GROUP_0 | KEY_UP),
39         KEY(0, 2, GROUP_1 | KEY_F5),
40         KEY(1, 0, GROUP_0 | KEY_LEFT),
41         KEY(1, 1, GROUP_0 | KEY_ENTER),
42         KEY(1, 2, GROUP_0 | KEY_RIGHT),
43         KEY(2, 0, GROUP_1 | KEY_ESC),
44         KEY(2, 1, GROUP_0 | KEY_DOWN),
45         KEY(2, 2, GROUP_1 | KEY_F4),
46         KEY(3, 0, GROUP_2 | KEY_F7),
47         KEY(3, 1, GROUP_2 | KEY_F8),
48         KEY(3, 2, GROUP_2 | KEY_F6),
49         0
50 };
51
52 static struct resource nokia770_kp_resources[] = {
53         [0] = {
54                 .start  = INT_KEYBOARD,
55                 .end    = INT_KEYBOARD,
56                 .flags  = IORESOURCE_IRQ,
57         },
58 };
59
60 static struct omap_kp_platform_data nokia770_kp_data = {
61         .rows   = 8,
62         .cols   = 8,
63         .keymap = nokia770_keymap
64 };
65
66 static struct platform_device nokia770_kp_device = {
67         .name           = "omap-keypad",
68         .id             = -1,
69         .dev            = {
70                 .platform_data = &nokia770_kp_data,
71         },
72         .num_resources  = ARRAY_SIZE(nokia770_kp_resources),
73         .resource       = nokia770_kp_resources,
74 };
75
76 static struct platform_device *nokia770_devices[] __initdata = {
77         &nokia770_kp_device,
78 };
79
80 static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
81         .x_max          = 0x0fff,
82         .y_max          = 0x0fff,
83         .x_plate_ohms   = 120,
84         .pressure_max   = 200,
85
86 };
87
88 static struct spi_board_info nokia770_spi_board_info[] __initdata = {
89         [0] = {
90                 .modalias       = "lcd_lph8923",
91                 .bus_num        = 2,
92                 .chip_select    = 3,
93                 .max_speed_hz   = 12000000,
94         },
95         [1] = {
96                 .modalias       = "ads7846",
97                 .bus_num        = 2,
98                 .chip_select    = 0,
99                 .max_speed_hz   = 2500000,
100                 .irq            = OMAP_GPIO_IRQ(15),
101                 .platform_data  = &nokia770_ads7846_platform_data,
102         },
103 };
104
105
106 /* assume no Mini-AB port */
107
108 static struct omap_usb_config nokia770_usb_config __initdata = {
109         .otg            = 1,
110         .register_host  = 1,
111         .register_dev   = 1,
112         .hmc_mode       = 16,
113         .pins[0]        = 6,
114 };
115
116 static struct omap_mmc_config nokia770_mmc_config __initdata = {
117         .mmc[0] = {
118                 .enabled        = 0,
119                 .wire4          = 0,
120                 .wp_pin         = -1,
121                 .power_pin      = -1,
122                 .switch_pin     = -1,
123         },
124         .mmc[1] = {
125                 .enabled        = 0,
126                 .wire4          = 0,
127                 .wp_pin         = -1,
128                 .power_pin      = -1,
129                 .switch_pin     = -1,
130         },
131 };
132
133 static struct omap_board_config_kernel nokia770_config[] = {
134         { OMAP_TAG_USB,         NULL },
135         { OMAP_TAG_MMC,         &nokia770_mmc_config },
136 };
137
138 static void __init omap_nokia770_init(void)
139 {
140         nokia770_config[0].data = &nokia770_usb_config;
141
142         platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
143         spi_register_board_info(nokia770_spi_board_info,
144                                 ARRAY_SIZE(nokia770_spi_board_info));
145         omap_board_config = nokia770_config;
146         omap_board_config_size = ARRAY_SIZE(nokia770_config);
147         omap_serial_init();
148 }
149
150 static void __init omap_nokia770_map_io(void)
151 {
152         omap1_map_common_io();
153 }
154
155 MACHINE_START(NOKIA770, "Nokia 770")
156         .phys_io        = 0xfff00000,
157         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
158         .boot_params    = 0x10000100,
159         .map_io         = omap_nokia770_map_io,
160         .init_irq       = omap_nokia770_init_irq,
161         .init_machine   = omap_nokia770_init,
162         .timer          = &omap_timer,
163 MACHINE_END