diff options
author | Tony Lindgren <tony@atomide.com> | 2012-01-20 08:31:52 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-01-20 08:31:52 -0500 |
commit | 967809bd7faf71ddc29c8081e0f21db8b201a0f4 (patch) | |
tree | 256bcce2b13a45b573b02ef73dcebe1f08a03593 /arch/arm/mach-omap1 | |
parent | dcd6c92267155e70a94b3927bce681ce74b80d1f (diff) | |
parent | 8d09a1bb3147ddbcf0a9483021ca699c54c54732 (diff) |
Merge branch 'omap1-part2' into omap1
Conflicts:
drivers/leds/leds-ams-delta.c
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 226 |
2 files changed, 189 insertions, 39 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index 4f8d66f044e7..5b1edbae6893 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig | |||
@@ -155,6 +155,8 @@ config MACH_AMS_DELTA | |||
155 | bool "Amstrad E3 (Delta)" | 155 | bool "Amstrad E3 (Delta)" |
156 | depends on ARCH_OMAP1 && ARCH_OMAP15XX | 156 | depends on ARCH_OMAP1 && ARCH_OMAP15XX |
157 | select FIQ | 157 | select FIQ |
158 | select GPIO_GENERIC_PLATFORM | ||
159 | select LEDS_GPIO_REGISTER | ||
158 | help | 160 | help |
159 | Support for the Amstrad E3 (codename Delta) videophone. Say Y here | 161 | Support for the Amstrad E3 (codename Delta) videophone. Say Y here |
160 | if you have such a device. | 162 | if you have such a device. |
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 88909cc0b254..87b13039f936 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | #include <linux/basic_mmio_gpio.h> | ||
14 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
@@ -40,9 +41,6 @@ | |||
40 | 41 | ||
41 | #include <mach/ams-delta-fiq.h> | 42 | #include <mach/ams-delta-fiq.h> |
42 | 43 | ||
43 | static u8 ams_delta_latch1_reg; | ||
44 | static u16 ams_delta_latch2_reg; | ||
45 | |||
46 | static const unsigned int ams_delta_keymap[] = { | 44 | static const unsigned int ams_delta_keymap[] = { |
47 | KEY(0, 0, KEY_F1), /* Advert */ | 45 | KEY(0, 0, KEY_F1), /* Advert */ |
48 | 46 | ||
@@ -121,39 +119,32 @@ static const unsigned int ams_delta_keymap[] = { | |||
121 | KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ | 119 | KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ |
122 | }; | 120 | }; |
123 | 121 | ||
124 | void ams_delta_latch1_write(u8 mask, u8 value) | 122 | #define LATCH1_PHYS 0x01000000 |
125 | { | 123 | #define LATCH1_VIRT 0xEA000000 |
126 | ams_delta_latch1_reg &= ~mask; | 124 | #define MODEM_PHYS 0x04000000 |
127 | ams_delta_latch1_reg |= value; | 125 | #define MODEM_VIRT 0xEB000000 |
128 | *(volatile __u8 *) AMS_DELTA_LATCH1_VIRT = ams_delta_latch1_reg; | 126 | #define LATCH2_PHYS 0x08000000 |
129 | } | 127 | #define LATCH2_VIRT 0xEC000000 |
130 | |||
131 | void ams_delta_latch2_write(u16 mask, u16 value) | ||
132 | { | ||
133 | ams_delta_latch2_reg &= ~mask; | ||
134 | ams_delta_latch2_reg |= value; | ||
135 | *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg; | ||
136 | } | ||
137 | 128 | ||
138 | static struct map_desc ams_delta_io_desc[] __initdata = { | 129 | static struct map_desc ams_delta_io_desc[] __initdata = { |
139 | /* AMS_DELTA_LATCH1 */ | 130 | /* AMS_DELTA_LATCH1 */ |
140 | { | 131 | { |
141 | .virtual = AMS_DELTA_LATCH1_VIRT, | 132 | .virtual = LATCH1_VIRT, |
142 | .pfn = __phys_to_pfn(AMS_DELTA_LATCH1_PHYS), | 133 | .pfn = __phys_to_pfn(LATCH1_PHYS), |
143 | .length = 0x01000000, | 134 | .length = 0x01000000, |
144 | .type = MT_DEVICE | 135 | .type = MT_DEVICE |
145 | }, | 136 | }, |
146 | /* AMS_DELTA_LATCH2 */ | 137 | /* AMS_DELTA_LATCH2 */ |
147 | { | 138 | { |
148 | .virtual = AMS_DELTA_LATCH2_VIRT, | 139 | .virtual = LATCH2_VIRT, |
149 | .pfn = __phys_to_pfn(AMS_DELTA_LATCH2_PHYS), | 140 | .pfn = __phys_to_pfn(LATCH2_PHYS), |
150 | .length = 0x01000000, | 141 | .length = 0x01000000, |
151 | .type = MT_DEVICE | 142 | .type = MT_DEVICE |
152 | }, | 143 | }, |
153 | /* AMS_DELTA_MODEM */ | 144 | /* AMS_DELTA_MODEM */ |
154 | { | 145 | { |
155 | .virtual = AMS_DELTA_MODEM_VIRT, | 146 | .virtual = MODEM_VIRT, |
156 | .pfn = __phys_to_pfn(AMS_DELTA_MODEM_PHYS), | 147 | .pfn = __phys_to_pfn(MODEM_PHYS), |
157 | .length = 0x01000000, | 148 | .length = 0x01000000, |
158 | .type = MT_DEVICE | 149 | .type = MT_DEVICE |
159 | } | 150 | } |
@@ -173,6 +164,113 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = { | |||
173 | { OMAP_TAG_LCD, &ams_delta_lcd_config }, | 164 | { OMAP_TAG_LCD, &ams_delta_lcd_config }, |
174 | }; | 165 | }; |
175 | 166 | ||
167 | #define LATCH1_GPIO_BASE 232 | ||
168 | #define LATCH1_NGPIO 8 | ||
169 | |||
170 | static struct resource latch1_resources[] __initconst = { | ||
171 | [0] = { | ||
172 | .name = "dat", | ||
173 | .start = LATCH1_PHYS, | ||
174 | .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8, | ||
175 | .flags = IORESOURCE_MEM, | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | static struct bgpio_pdata latch1_pdata __initconst = { | ||
180 | .base = LATCH1_GPIO_BASE, | ||
181 | .ngpio = LATCH1_NGPIO, | ||
182 | }; | ||
183 | |||
184 | static struct platform_device latch1_gpio_device = { | ||
185 | .name = "basic-mmio-gpio", | ||
186 | .id = 0, | ||
187 | .resource = latch1_resources, | ||
188 | .num_resources = ARRAY_SIZE(latch1_resources), | ||
189 | .dev = { | ||
190 | .platform_data = &latch1_pdata, | ||
191 | }, | ||
192 | }; | ||
193 | |||
194 | static struct resource latch2_resources[] __initconst = { | ||
195 | [0] = { | ||
196 | .name = "dat", | ||
197 | .start = LATCH2_PHYS, | ||
198 | .end = LATCH2_PHYS + (AMS_DELTA_LATCH2_NGPIO - 1) / 8, | ||
199 | .flags = IORESOURCE_MEM, | ||
200 | }, | ||
201 | }; | ||
202 | |||
203 | static struct bgpio_pdata latch2_pdata __initconst = { | ||
204 | .base = AMS_DELTA_LATCH2_GPIO_BASE, | ||
205 | .ngpio = AMS_DELTA_LATCH2_NGPIO, | ||
206 | }; | ||
207 | |||
208 | static struct platform_device latch2_gpio_device = { | ||
209 | .name = "basic-mmio-gpio", | ||
210 | .id = 1, | ||
211 | .resource = latch2_resources, | ||
212 | .num_resources = ARRAY_SIZE(latch2_resources), | ||
213 | .dev = { | ||
214 | .platform_data = &latch2_pdata, | ||
215 | }, | ||
216 | }; | ||
217 | |||
218 | static struct gpio latch_gpios[] __initconst = { | ||
219 | { | ||
220 | .gpio = LATCH1_GPIO_BASE + 6, | ||
221 | .flags = GPIOF_OUT_INIT_LOW, | ||
222 | .label = "dockit1", | ||
223 | }, | ||
224 | { | ||
225 | .gpio = LATCH1_GPIO_BASE + 7, | ||
226 | .flags = GPIOF_OUT_INIT_LOW, | ||
227 | .label = "dockit2", | ||
228 | }, | ||
229 | { | ||
230 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_RSTIN, | ||
231 | .flags = GPIOF_OUT_INIT_LOW, | ||
232 | .label = "scard_rstin", | ||
233 | }, | ||
234 | { | ||
235 | .gpio = AMS_DELTA_GPIO_PIN_SCARD_CMDVCC, | ||
236 | .flags = GPIOF_OUT_INIT_LOW, | ||
237 | .label = "scard_cmdvcc", | ||
238 | }, | ||
239 | { | ||
240 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET, | ||
241 | .flags = GPIOF_OUT_INIT_LOW, | ||
242 | .label = "modem_nreset", | ||
243 | }, | ||
244 | { | ||
245 | .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, | ||
246 | .flags = GPIOF_OUT_INIT_LOW, | ||
247 | .label = "modem_codec", | ||
248 | }, | ||
249 | { | ||
250 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14, | ||
251 | .flags = GPIOF_OUT_INIT_LOW, | ||
252 | .label = "hookflash1", | ||
253 | }, | ||
254 | { | ||
255 | .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 15, | ||
256 | .flags = GPIOF_OUT_INIT_LOW, | ||
257 | .label = "hookflash2", | ||
258 | }, | ||
259 | }; | ||
260 | |||
261 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | ||
262 | { | ||
263 | int bit = 0; | ||
264 | u16 bitpos = 1 << bit; | ||
265 | |||
266 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { | ||
267 | if (!(mask & bitpos)) | ||
268 | continue; | ||
269 | gpio_set_value(base + bit, (value & bitpos) != 0); | ||
270 | } | ||
271 | } | ||
272 | EXPORT_SYMBOL(ams_delta_latch_write); | ||
273 | |||
176 | static struct resource ams_delta_nand_resources[] = { | 274 | static struct resource ams_delta_nand_resources[] = { |
177 | [0] = { | 275 | [0] = { |
178 | .start = OMAP1_MPUIO_BASE, | 276 | .start = OMAP1_MPUIO_BASE, |
@@ -224,9 +322,45 @@ static struct platform_device ams_delta_lcd_device = { | |||
224 | .id = -1, | 322 | .id = -1, |
225 | }; | 323 | }; |
226 | 324 | ||
227 | static struct platform_device ams_delta_led_device = { | 325 | static struct gpio_led gpio_leds[] __initconst = { |
228 | .name = "ams-delta-led", | 326 | { |
229 | .id = -1 | 327 | .name = "camera", |
328 | .gpio = LATCH1_GPIO_BASE + 0, | ||
329 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
330 | #ifdef CONFIG_LEDS_TRIGGERS | ||
331 | .default_trigger = "ams_delta_camera", | ||
332 | #endif | ||
333 | }, | ||
334 | { | ||
335 | .name = "advert", | ||
336 | .gpio = LATCH1_GPIO_BASE + 1, | ||
337 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
338 | }, | ||
339 | { | ||
340 | .name = "email", | ||
341 | .gpio = LATCH1_GPIO_BASE + 2, | ||
342 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
343 | }, | ||
344 | { | ||
345 | .name = "handsfree", | ||
346 | .gpio = LATCH1_GPIO_BASE + 3, | ||
347 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
348 | }, | ||
349 | { | ||
350 | .name = "voicemail", | ||
351 | .gpio = LATCH1_GPIO_BASE + 4, | ||
352 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
353 | }, | ||
354 | { | ||
355 | .name = "voice", | ||
356 | .gpio = LATCH1_GPIO_BASE + 5, | ||
357 | .default_state = LEDS_GPIO_DEFSTATE_OFF, | ||
358 | }, | ||
359 | }; | ||
360 | |||
361 | static struct gpio_led_platform_data leds_pdata __initconst = { | ||
362 | .leds = gpio_leds, | ||
363 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
230 | }; | 364 | }; |
231 | 365 | ||
232 | static struct i2c_board_info ams_delta_camera_board_info[] = { | 366 | static struct i2c_board_info ams_delta_camera_board_info[] = { |
@@ -275,13 +409,17 @@ static struct omap1_cam_platform_data ams_delta_camera_platform_data = { | |||
275 | }; | 409 | }; |
276 | 410 | ||
277 | static struct platform_device *ams_delta_devices[] __initdata = { | 411 | static struct platform_device *ams_delta_devices[] __initdata = { |
278 | &ams_delta_nand_device, | 412 | &latch1_gpio_device, |
413 | &latch2_gpio_device, | ||
279 | &ams_delta_kp_device, | 414 | &ams_delta_kp_device, |
280 | &ams_delta_lcd_device, | ||
281 | &ams_delta_led_device, | ||
282 | &ams_delta_camera_device, | 415 | &ams_delta_camera_device, |
283 | }; | 416 | }; |
284 | 417 | ||
418 | static struct platform_device *late_devices[] __initconst = { | ||
419 | &ams_delta_nand_device, | ||
420 | &ams_delta_lcd_device, | ||
421 | }; | ||
422 | |||
285 | static void __init ams_delta_init(void) | 423 | static void __init ams_delta_init(void) |
286 | { | 424 | { |
287 | /* mux pins for uarts */ | 425 | /* mux pins for uarts */ |
@@ -307,15 +445,13 @@ static void __init ams_delta_init(void) | |||
307 | omap_serial_init(); | 445 | omap_serial_init(); |
308 | omap_register_i2c_bus(1, 100, NULL, 0); | 446 | omap_register_i2c_bus(1, 100, NULL, 0); |
309 | 447 | ||
310 | /* Clear latch2 (NAND, LCD, modem enable) */ | ||
311 | ams_delta_latch2_write(~0, 0); | ||
312 | |||
313 | omap1_usb_init(&ams_delta_usb_config); | 448 | omap1_usb_init(&ams_delta_usb_config); |
314 | omap1_set_camera_info(&ams_delta_camera_platform_data); | 449 | omap1_set_camera_info(&ams_delta_camera_platform_data); |
315 | #ifdef CONFIG_LEDS_TRIGGERS | 450 | #ifdef CONFIG_LEDS_TRIGGERS |
316 | led_trigger_register_simple("ams_delta_camera", | 451 | led_trigger_register_simple("ams_delta_camera", |
317 | &ams_delta_camera_led_trigger); | 452 | &ams_delta_camera_led_trigger); |
318 | #endif | 453 | #endif |
454 | gpio_led_register_device(-1, &leds_pdata); | ||
319 | platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); | 455 | platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); |
320 | 456 | ||
321 | ams_delta_init_fiq(); | 457 | ams_delta_init_fiq(); |
@@ -325,8 +461,8 @@ static void __init ams_delta_init(void) | |||
325 | 461 | ||
326 | static struct plat_serial8250_port ams_delta_modem_ports[] = { | 462 | static struct plat_serial8250_port ams_delta_modem_ports[] = { |
327 | { | 463 | { |
328 | .membase = IOMEM(AMS_DELTA_MODEM_VIRT), | 464 | .membase = IOMEM(MODEM_VIRT), |
329 | .mapbase = AMS_DELTA_MODEM_PHYS, | 465 | .mapbase = MODEM_PHYS, |
330 | .irq = -EINVAL, /* changed later */ | 466 | .irq = -EINVAL, /* changed later */ |
331 | .flags = UPF_BOOT_AUTOCONF, | 467 | .flags = UPF_BOOT_AUTOCONF, |
332 | .irqflags = IRQF_TRIGGER_RISING, | 468 | .irqflags = IRQF_TRIGGER_RISING, |
@@ -345,13 +481,21 @@ static struct platform_device ams_delta_modem_device = { | |||
345 | }, | 481 | }, |
346 | }; | 482 | }; |
347 | 483 | ||
348 | static int __init ams_delta_modem_init(void) | 484 | static int __init late_init(void) |
349 | { | 485 | { |
350 | int err; | 486 | int err; |
351 | 487 | ||
352 | if (!machine_is_ams_delta()) | 488 | if (!machine_is_ams_delta()) |
353 | return -ENODEV; | 489 | return -ENODEV; |
354 | 490 | ||
491 | err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); | ||
492 | if (err) { | ||
493 | pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); | ||
494 | return err; | ||
495 | } | ||
496 | |||
497 | platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); | ||
498 | |||
355 | omap_cfg_reg(M14_1510_GPIO2); | 499 | omap_cfg_reg(M14_1510_GPIO2); |
356 | ams_delta_modem_ports[0].irq = | 500 | ams_delta_modem_ports[0].irq = |
357 | gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | 501 | gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); |
@@ -367,9 +511,16 @@ static int __init ams_delta_modem_init(void) | |||
367 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, | 511 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, |
368 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); | 512 | AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); |
369 | 513 | ||
370 | return platform_device_register(&ams_delta_modem_device); | 514 | err = platform_device_register(&ams_delta_modem_device); |
515 | if (err) | ||
516 | goto gpio_free; | ||
517 | return 0; | ||
518 | |||
519 | gpio_free: | ||
520 | gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | ||
521 | return err; | ||
371 | } | 522 | } |
372 | arch_initcall(ams_delta_modem_init); | 523 | late_initcall(late_init); |
373 | 524 | ||
374 | static void __init ams_delta_map_io(void) | 525 | static void __init ams_delta_map_io(void) |
375 | { | 526 | { |
@@ -388,6 +539,3 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") | |||
388 | .timer = &omap1_timer, | 539 | .timer = &omap1_timer, |
389 | .restart = omap1_restart, | 540 | .restart = omap1_restart, |
390 | MACHINE_END | 541 | MACHINE_END |
391 | |||
392 | EXPORT_SYMBOL(ams_delta_latch1_write); | ||
393 | EXPORT_SYMBOL(ams_delta_latch2_write); | ||