diff options
Diffstat (limited to 'arch/arm/mach-mx3/mach-pcm037_eet.c')
-rw-r--r-- | arch/arm/mach-mx3/mach-pcm037_eet.c | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mach-pcm037_eet.c b/arch/arm/mach-mx3/mach-pcm037_eet.c new file mode 100644 index 000000000000..8d386000fc40 --- /dev/null +++ b/arch/arm/mach-mx3/mach-pcm037_eet.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 | ||
3 | * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | #include <linux/gpio.h> | ||
10 | #include <linux/gpio_keys.h> | ||
11 | #include <linux/input.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/spi/spi.h> | ||
14 | |||
15 | #include <mach/common.h> | ||
16 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) | ||
17 | #include <mach/spi.h> | ||
18 | #endif | ||
19 | #include <mach/iomux-mx3.h> | ||
20 | |||
21 | #include <asm/mach-types.h> | ||
22 | |||
23 | #include "pcm037.h" | ||
24 | #include "devices.h" | ||
25 | |||
26 | static unsigned int pcm037_eet_pins[] = { | ||
27 | /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */ | ||
28 | IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO), | ||
29 | /* GPIO keys */ | ||
30 | IOMUX_MODE(MX31_PIN_GPIO1_0, IOMUX_CONFIG_GPIO), /* 0 */ | ||
31 | IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO), /* 1 */ | ||
32 | IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO), /* 2 */ | ||
33 | IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), /* 3 */ | ||
34 | IOMUX_MODE(MX31_PIN_SVEN0, IOMUX_CONFIG_GPIO), /* 32 */ | ||
35 | IOMUX_MODE(MX31_PIN_STX0, IOMUX_CONFIG_GPIO), /* 33 */ | ||
36 | IOMUX_MODE(MX31_PIN_SRX0, IOMUX_CONFIG_GPIO), /* 34 */ | ||
37 | IOMUX_MODE(MX31_PIN_SIMPD0, IOMUX_CONFIG_GPIO), /* 35 */ | ||
38 | IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_GPIO), /* 38 */ | ||
39 | IOMUX_MODE(MX31_PIN_CTS1, IOMUX_CONFIG_GPIO), /* 39 */ | ||
40 | IOMUX_MODE(MX31_PIN_KEY_ROW4, IOMUX_CONFIG_GPIO), /* 50 */ | ||
41 | IOMUX_MODE(MX31_PIN_KEY_ROW5, IOMUX_CONFIG_GPIO), /* 51 */ | ||
42 | IOMUX_MODE(MX31_PIN_KEY_ROW6, IOMUX_CONFIG_GPIO), /* 52 */ | ||
43 | IOMUX_MODE(MX31_PIN_KEY_ROW7, IOMUX_CONFIG_GPIO), /* 53 */ | ||
44 | |||
45 | /* LEDs */ | ||
46 | IOMUX_MODE(MX31_PIN_DTR_DTE1, IOMUX_CONFIG_GPIO), /* 44 */ | ||
47 | IOMUX_MODE(MX31_PIN_DSR_DTE1, IOMUX_CONFIG_GPIO), /* 45 */ | ||
48 | IOMUX_MODE(MX31_PIN_KEY_COL5, IOMUX_CONFIG_GPIO), /* 55 */ | ||
49 | IOMUX_MODE(MX31_PIN_KEY_COL6, IOMUX_CONFIG_GPIO), /* 56 */ | ||
50 | }; | ||
51 | |||
52 | /* SPI */ | ||
53 | static struct spi_board_info pcm037_spi_dev[] = { | ||
54 | { | ||
55 | .modalias = "dac124s085", | ||
56 | .max_speed_hz = 400000, | ||
57 | .bus_num = 0, | ||
58 | .chip_select = 0, /* Index in pcm037_spi1_cs[] */ | ||
59 | .mode = SPI_CPHA, | ||
60 | }, | ||
61 | }; | ||
62 | |||
63 | /* Platform Data for MXC CSPI */ | ||
64 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) | ||
65 | static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)}; | ||
66 | |||
67 | struct spi_imx_master pcm037_spi1_master = { | ||
68 | .chipselect = pcm037_spi1_cs, | ||
69 | .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs), | ||
70 | }; | ||
71 | #endif | ||
72 | |||
73 | /* GPIO-keys input device */ | ||
74 | static struct gpio_keys_button pcm037_gpio_keys[] = { | ||
75 | { | ||
76 | .type = EV_KEY, | ||
77 | .code = KEY_L, | ||
78 | .gpio = 0, | ||
79 | .desc = "Wheel Manual", | ||
80 | .wakeup = 0, | ||
81 | }, { | ||
82 | .type = EV_KEY, | ||
83 | .code = KEY_A, | ||
84 | .gpio = 1, | ||
85 | .desc = "Wheel AF", | ||
86 | .wakeup = 0, | ||
87 | }, { | ||
88 | .type = EV_KEY, | ||
89 | .code = KEY_V, | ||
90 | .gpio = 2, | ||
91 | .desc = "Wheel View", | ||
92 | .wakeup = 0, | ||
93 | }, { | ||
94 | .type = EV_KEY, | ||
95 | .code = KEY_M, | ||
96 | .gpio = 3, | ||
97 | .desc = "Wheel Menu", | ||
98 | .wakeup = 0, | ||
99 | }, { | ||
100 | .type = EV_KEY, | ||
101 | .code = KEY_UP, | ||
102 | .gpio = 32, | ||
103 | .desc = "Nav Pad Up", | ||
104 | .wakeup = 0, | ||
105 | }, { | ||
106 | .type = EV_KEY, | ||
107 | .code = KEY_RIGHT, | ||
108 | .gpio = 33, | ||
109 | .desc = "Nav Pad Right", | ||
110 | .wakeup = 0, | ||
111 | }, { | ||
112 | .type = EV_KEY, | ||
113 | .code = KEY_DOWN, | ||
114 | .gpio = 34, | ||
115 | .desc = "Nav Pad Down", | ||
116 | .wakeup = 0, | ||
117 | }, { | ||
118 | .type = EV_KEY, | ||
119 | .code = KEY_LEFT, | ||
120 | .gpio = 35, | ||
121 | .desc = "Nav Pad Left", | ||
122 | .wakeup = 0, | ||
123 | }, { | ||
124 | .type = EV_KEY, | ||
125 | .code = KEY_ENTER, | ||
126 | .gpio = 38, | ||
127 | .desc = "Nav Pad Ok", | ||
128 | .wakeup = 0, | ||
129 | }, { | ||
130 | .type = EV_KEY, | ||
131 | .code = KEY_O, | ||
132 | .gpio = 39, | ||
133 | .desc = "Wheel Off", | ||
134 | .wakeup = 0, | ||
135 | }, { | ||
136 | .type = EV_KEY, | ||
137 | .code = BTN_FORWARD, | ||
138 | .gpio = 50, | ||
139 | .desc = "Focus Forward", | ||
140 | .wakeup = 0, | ||
141 | }, { | ||
142 | .type = EV_KEY, | ||
143 | .code = BTN_BACK, | ||
144 | .gpio = 51, | ||
145 | .desc = "Focus Backward", | ||
146 | .wakeup = 0, | ||
147 | }, { | ||
148 | .type = EV_KEY, | ||
149 | .code = BTN_MIDDLE, | ||
150 | .gpio = 52, | ||
151 | .desc = "Release Half", | ||
152 | .wakeup = 0, | ||
153 | }, { | ||
154 | .type = EV_KEY, | ||
155 | .code = BTN_EXTRA, | ||
156 | .gpio = 53, | ||
157 | .desc = "Release Full", | ||
158 | .wakeup = 0, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct gpio_keys_platform_data pcm037_gpio_keys_platform_data = { | ||
163 | .buttons = pcm037_gpio_keys, | ||
164 | .nbuttons = ARRAY_SIZE(pcm037_gpio_keys), | ||
165 | .rep = 0, /* No auto-repeat */ | ||
166 | }; | ||
167 | |||
168 | static struct platform_device pcm037_gpio_keys_device = { | ||
169 | .name = "gpio-keys", | ||
170 | .id = -1, | ||
171 | .dev = { | ||
172 | .platform_data = &pcm037_gpio_keys_platform_data, | ||
173 | }, | ||
174 | }; | ||
175 | |||
176 | static int eet_init_devices(void) | ||
177 | { | ||
178 | if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET) | ||
179 | return 0; | ||
180 | |||
181 | mxc_iomux_setup_multiple_pins(pcm037_eet_pins, | ||
182 | ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet"); | ||
183 | |||
184 | /* SPI */ | ||
185 | spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev)); | ||
186 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) | ||
187 | mxc_register_device(&mxc_spi_device0, &pcm037_spi1_master); | ||
188 | #endif | ||
189 | |||
190 | platform_device_register(&pcm037_gpio_keys_device); | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | late_initcall(eet_init_devices); | ||