board-ams-delta.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * linux/arch/arm/mach-omap1/board-ams-delta.c
  3. *
  4. * Modified from board-generic.c
  5. *
  6. * Board specific inits for the Amstrad E3 (codename Delta) videophone
  7. *
  8. * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/input.h>
  17. #include <linux/platform_device.h>
  18. #include <mach/hardware.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/map.h>
  22. #include <mach/board-ams-delta.h>
  23. #include <mach/gpio.h>
  24. #include <mach/keypad.h>
  25. #include <mach/mux.h>
  26. #include <mach/usb.h>
  27. #include <mach/board.h>
  28. #include <mach/common.h>
  29. static u8 ams_delta_latch1_reg;
  30. static u16 ams_delta_latch2_reg;
  31. static int ams_delta_keymap[] = {
  32. KEY(0, 0, KEY_F1), /* Advert */
  33. KEY(3, 0, KEY_COFFEE), /* Games */
  34. KEY(2, 0, KEY_QUESTION), /* Directory */
  35. KEY(3, 2, KEY_CONNECT), /* Internet */
  36. KEY(2, 1, KEY_SHOP), /* Services */
  37. KEY(1, 1, KEY_PHONE), /* VoiceMail */
  38. KEY(1, 0, KEY_DELETE), /* Delete */
  39. KEY(2, 2, KEY_PLAY), /* Play */
  40. KEY(0, 1, KEY_PAGEUP), /* Up */
  41. KEY(3, 1, KEY_PAGEDOWN), /* Down */
  42. KEY(0, 2, KEY_EMAIL), /* ReadEmail */
  43. KEY(1, 2, KEY_STOP), /* Stop */
  44. /* Numeric keypad portion */
  45. KEY(7, 0, KEY_KP1),
  46. KEY(6, 0, KEY_KP2),
  47. KEY(5, 0, KEY_KP3),
  48. KEY(7, 1, KEY_KP4),
  49. KEY(6, 1, KEY_KP5),
  50. KEY(5, 1, KEY_KP6),
  51. KEY(7, 2, KEY_KP7),
  52. KEY(6, 2, KEY_KP8),
  53. KEY(5, 2, KEY_KP9),
  54. KEY(6, 3, KEY_KP0),
  55. KEY(7, 3, KEY_KPASTERISK),
  56. KEY(5, 3, KEY_KPDOT), /* # key */
  57. KEY(2, 7, KEY_NUMLOCK), /* Mute */
  58. KEY(1, 7, KEY_KPMINUS), /* Recall */
  59. KEY(1, 6, KEY_KPPLUS), /* Redial */
  60. KEY(6, 7, KEY_KPSLASH), /* Handsfree */
  61. KEY(0, 6, KEY_ENTER), /* Video */
  62. KEY(4, 7, KEY_CAMERA), /* Photo */
  63. KEY(4, 0, KEY_F2), /* Home */
  64. KEY(4, 1, KEY_F3), /* Office */
  65. KEY(4, 2, KEY_F4), /* Mobile */
  66. KEY(7, 7, KEY_F5), /* SMS */
  67. KEY(5, 7, KEY_F6), /* Email */
  68. /* QWERTY portion of keypad */
  69. KEY(4, 3, KEY_Q),
  70. KEY(3, 3, KEY_W),
  71. KEY(2, 3, KEY_E),
  72. KEY(1, 3, KEY_R),
  73. KEY(0, 3, KEY_T),
  74. KEY(7, 4, KEY_Y),
  75. KEY(6, 4, KEY_U),
  76. KEY(5, 4, KEY_I),
  77. KEY(4, 4, KEY_O),
  78. KEY(3, 4, KEY_P),
  79. KEY(2, 4, KEY_A),
  80. KEY(1, 4, KEY_S),
  81. KEY(0, 4, KEY_D),
  82. KEY(7, 5, KEY_F),
  83. KEY(6, 5, KEY_G),
  84. KEY(5, 5, KEY_H),
  85. KEY(4, 5, KEY_J),
  86. KEY(3, 5, KEY_K),
  87. KEY(2, 5, KEY_L),
  88. KEY(1, 5, KEY_Z),
  89. KEY(0, 5, KEY_X),
  90. KEY(7, 6, KEY_C),
  91. KEY(6, 6, KEY_V),
  92. KEY(5, 6, KEY_B),
  93. KEY(4, 6, KEY_N),
  94. KEY(3, 6, KEY_M),
  95. KEY(2, 6, KEY_SPACE),
  96. KEY(0, 7, KEY_LEFTSHIFT), /* Vol up */
  97. KEY(3, 7, KEY_LEFTCTRL), /* Vol down */
  98. 0
  99. };
  100. void ams_delta_latch1_write(u8 mask, u8 value)
  101. {
  102. ams_delta_latch1_reg &= ~mask;
  103. ams_delta_latch1_reg |= value;
  104. *(volatile __u8 *) AMS_DELTA_LATCH1_VIRT = ams_delta_latch1_reg;
  105. }
  106. void ams_delta_latch2_write(u16 mask, u16 value)
  107. {
  108. ams_delta_latch2_reg &= ~mask;
  109. ams_delta_latch2_reg |= value;
  110. *(volatile __u16 *) AMS_DELTA_LATCH2_VIRT = ams_delta_latch2_reg;
  111. }
  112. static void __init ams_delta_init_irq(void)
  113. {
  114. omap1_init_common_hw();
  115. omap_init_irq();
  116. omap_gpio_init();
  117. }
  118. static struct map_desc ams_delta_io_desc[] __initdata = {
  119. /* AMS_DELTA_LATCH1 */
  120. {
  121. .virtual = AMS_DELTA_LATCH1_VIRT,
  122. .pfn = __phys_to_pfn(AMS_DELTA_LATCH1_PHYS),
  123. .length = 0x01000000,
  124. .type = MT_DEVICE
  125. },
  126. /* AMS_DELTA_LATCH2 */
  127. {
  128. .virtual = AMS_DELTA_LATCH2_VIRT,
  129. .pfn = __phys_to_pfn(AMS_DELTA_LATCH2_PHYS),
  130. .length = 0x01000000,
  131. .type = MT_DEVICE
  132. },
  133. /* AMS_DELTA_MODEM */
  134. {
  135. .virtual = AMS_DELTA_MODEM_VIRT,
  136. .pfn = __phys_to_pfn(AMS_DELTA_MODEM_PHYS),
  137. .length = 0x01000000,
  138. .type = MT_DEVICE
  139. }
  140. };
  141. static struct omap_lcd_config ams_delta_lcd_config __initdata = {
  142. .ctrl_name = "internal",
  143. };
  144. static struct omap_uart_config ams_delta_uart_config __initdata = {
  145. .enabled_uarts = 1,
  146. };
  147. static struct omap_usb_config ams_delta_usb_config __initdata = {
  148. .register_host = 1,
  149. .hmc_mode = 16,
  150. .pins[0] = 2,
  151. };
  152. static struct omap_board_config_kernel ams_delta_config[] = {
  153. { OMAP_TAG_LCD, &ams_delta_lcd_config },
  154. { OMAP_TAG_UART, &ams_delta_uart_config },
  155. };
  156. static struct resource ams_delta_kp_resources[] = {
  157. [0] = {
  158. .start = INT_KEYBOARD,
  159. .end = INT_KEYBOARD,
  160. .flags = IORESOURCE_IRQ,
  161. },
  162. };
  163. static struct omap_kp_platform_data ams_delta_kp_data = {
  164. .rows = 8,
  165. .cols = 8,
  166. .keymap = ams_delta_keymap,
  167. .keymapsize = ARRAY_SIZE(ams_delta_keymap),
  168. .delay = 9,
  169. };
  170. static struct platform_device ams_delta_kp_device = {
  171. .name = "omap-keypad",
  172. .id = -1,
  173. .dev = {
  174. .platform_data = &ams_delta_kp_data,
  175. },
  176. .num_resources = ARRAY_SIZE(ams_delta_kp_resources),
  177. .resource = ams_delta_kp_resources,
  178. };
  179. static struct platform_device ams_delta_lcd_device = {
  180. .name = "lcd_ams_delta",
  181. .id = -1,
  182. };
  183. static struct platform_device ams_delta_led_device = {
  184. .name = "ams-delta-led",
  185. .id = -1
  186. };
  187. static struct platform_device *ams_delta_devices[] __initdata = {
  188. &ams_delta_kp_device,
  189. &ams_delta_lcd_device,
  190. &ams_delta_led_device,
  191. };
  192. static void __init ams_delta_init(void)
  193. {
  194. iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
  195. omap_board_config = ams_delta_config;
  196. omap_board_config_size = ARRAY_SIZE(ams_delta_config);
  197. omap_serial_init();
  198. omap_register_i2c_bus(1, 100, NULL, 0);
  199. /* Clear latch2 (NAND, LCD, modem enable) */
  200. ams_delta_latch2_write(~0, 0);
  201. omap_usb_init(&ams_delta_usb_config);
  202. platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
  203. }
  204. static void __init ams_delta_map_io(void)
  205. {
  206. omap1_map_common_io();
  207. }
  208. MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
  209. /* Maintainer: Jonathan McDowell <noodles@earth.li> */
  210. .phys_io = 0xfff00000,
  211. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  212. .boot_params = 0x10000100,
  213. .map_io = ams_delta_map_io,
  214. .init_irq = ams_delta_init_irq,
  215. .init_machine = ams_delta_init,
  216. .timer = &omap_timer,
  217. MACHINE_END
  218. EXPORT_SYMBOL(ams_delta_latch1_write);
  219. EXPORT_SYMBOL(ams_delta_latch2_write);