synchronousMemoryDatabase.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /*
  2. * linux/arch/arm/mach-pxa/zylonite.c
  3. *
  4. * Support for the PXA3xx Development Platform (aka Zylonite)
  5. *
  6. * Copyright (C) 2006 Marvell International Ltd.
  7. *
  8. * 2007-09-04: eric miao <eric.miao@marvell.com>
  9. * rewrite to align with latest kernel
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/module.h>
  16. #include <linux/kernel.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/init.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <linux/pwm_backlight.h>
  22. #include <linux/smc91x.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <mach/pxa3xx.h>
  26. #include <mach/audio.h>
  27. #include <linux/platform_data/video-pxafb.h>
  28. #include <mach/zylonite.h>
  29. #include <linux/platform_data/mmc-pxamci.h>
  30. #include <linux/platform_data/usb-ohci-pxa27x.h>
  31. #include <linux/platform_data/keypad-pxa27x.h>
  32. #include <linux/platform_data/mtd-nand-pxa3xx.h>
  33. #include "devices.h"
  34. #include "generic.h"
  35. int gpio_eth_irq;
  36. int gpio_debug_led1;
  37. int gpio_debug_led2;
  38. int wm9713_irq;
  39. int lcd_id;
  40. int lcd_orientation;
  41. struct platform_device pxa_device_wm9713_audio = {
  42. .name = "wm9713-codec",
  43. .id = -1,
  44. };
  45. static void __init zylonite_init_wm9713_audio(void)
  46. {
  47. platform_device_register(&pxa_device_wm9713_audio);
  48. }
  49. static struct resource smc91x_resources[] = {
  50. [0] = {
  51. .start = ZYLONITE_ETH_PHYS + 0x300,
  52. .end = ZYLONITE_ETH_PHYS + 0xfffff,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. [1] = {
  56. .start = -1, /* for run-time assignment */
  57. .end = -1,
  58. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  59. }
  60. };
  61. static struct smc91x_platdata zylonite_smc91x_info = {
  62. .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
  63. SMC91X_NOWAIT | SMC91X_USE_DMA,
  64. };
  65. static struct platform_device smc91x_device = {
  66. .name = "smc91x",
  67. .id = 0,
  68. .num_resources = ARRAY_SIZE(smc91x_resources),
  69. .resource = smc91x_resources,
  70. .dev = {
  71. .platform_data = &zylonite_smc91x_info,
  72. },
  73. };
  74. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  75. static struct gpio_led zylonite_debug_leds[] = {
  76. [0] = {
  77. .name = "zylonite:yellow:1",
  78. .default_trigger = "heartbeat",
  79. },
  80. [1] = {
  81. .name = "zylonite:yellow:2",
  82. .default_trigger = "default-on",
  83. },
  84. };
  85. static struct gpio_led_platform_data zylonite_debug_leds_info = {
  86. .leds = zylonite_debug_leds,
  87. .num_leds = ARRAY_SIZE(zylonite_debug_leds),
  88. };
  89. static struct platform_device zylonite_device_leds = {
  90. .name = "leds-gpio",
  91. .id = -1,
  92. .dev = {
  93. .platform_data = &zylonite_debug_leds_info,
  94. }
  95. };
  96. static void __init zylonite_init_leds(void)
  97. {
  98. zylonite_debug_leds[0].gpio = gpio_debug_led1;
  99. zylonite_debug_leds[1].gpio = gpio_debug_led2;
  100. platform_device_register(&zylonite_device_leds);
  101. }
  102. #else
  103. static inline void zylonite_init_leds(void) {}
  104. #endif
  105. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  106. static struct platform_pwm_backlight_data zylonite_backlight_data = {
  107. .pwm_id = 3,
  108. .max_brightness = 100,
  109. .dft_brightness = 100,
  110. .pwm_period_ns = 10000,
  111. };
  112. static struct platform_device zylonite_backlight_device = {
  113. .name = "pwm-backlight",
  114. .dev = {
  115. .parent = &pxa27x_device_pwm1.dev,
  116. .platform_data = &zylonite_backlight_data,
  117. },
  118. };
  119. static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
  120. .pixclock = 110000,
  121. .xres = 240,
  122. .yres = 320,
  123. .bpp = 16,
  124. .hsync_len = 4,
  125. .left_margin = 6,
  126. .right_margin = 4,
  127. .vsync_len = 2,
  128. .upper_margin = 2,
  129. .lower_margin = 3,
  130. .sync = FB_SYNC_VERT_HIGH_ACT,
  131. };
  132. static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
  133. .pixclock = 50000,
  134. .xres = 640,
  135. .yres = 480,
  136. .bpp = 16,
  137. .hsync_len = 1,
  138. .left_margin = 0x9f,
  139. .right_margin = 1,
  140. .vsync_len = 44,
  141. .upper_margin = 0,
  142. .lower_margin = 0,
  143. .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
  144. };
  145. static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
  146. .num_modes = 1,
  147. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  148. };
  149. static struct pxafb_mode_info sharp_ls037_modes[] = {
  150. [0] = {
  151. .pixclock = 158000,
  152. .xres = 240,
  153. .yres = 320,
  154. .bpp = 16,
  155. .hsync_len = 4,
  156. .left_margin = 39,
  157. .right_margin = 39,
  158. .vsync_len = 1,
  159. .upper_margin = 2,
  160. .lower_margin = 3,
  161. .sync = 0,
  162. },
  163. [1] = {
  164. .pixclock = 39700,
  165. .xres = 480,
  166. .yres = 640,
  167. .bpp = 16,
  168. .hsync_len = 8,
  169. .left_margin = 81,
  170. .right_margin = 81,
  171. .vsync_len = 1,
  172. .upper_margin = 2,
  173. .lower_margin = 7,
  174. .sync = 0,
  175. },
  176. };
  177. static struct pxafb_mach_info zylonite_sharp_lcd_info = {
  178. .modes = sharp_ls037_modes,
  179. .num_modes = 2,
  180. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  181. };
  182. static void __init zylonite_init_lcd(void)
  183. {
  184. platform_device_register(&zylonite_backlight_device);
  185. if (lcd_id & 0x20) {
  186. pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
  187. return;
  188. }
  189. /* legacy LCD panels, it would be handy here if LCD panel type can
  190. * be decided at run-time
  191. */
  192. if (1)
  193. zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
  194. else
  195. zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
  196. pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
  197. }
  198. #else
  199. static inline void zylonite_init_lcd(void) {}
  200. #endif
  201. #if defined(CONFIG_MMC)
  202. static struct pxamci_platform_data zylonite_mci_platform_data = {
  203. .detect_delay_ms= 200,
  204. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  205. .gpio_card_detect = EXT_GPIO(0),
  206. .gpio_card_ro = EXT_GPIO(2),
  207. .gpio_power = -1,
  208. };
  209. static struct pxamci_platform_data zylonite_mci2_platform_data = {
  210. .detect_delay_ms= 200,
  211. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  212. .gpio_card_detect = EXT_GPIO(1),
  213. .gpio_card_ro = EXT_GPIO(3),
  214. .gpio_power = -1,
  215. };
  216. static struct pxamci_platform_data zylonite_mci3_platform_data = {
  217. .detect_delay_ms= 200,
  218. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  219. .gpio_card_detect = EXT_GPIO(30),
  220. .gpio_card_ro = EXT_GPIO(31),
  221. .gpio_power = -1,
  222. };
  223. static void __init zylonite_init_mmc(void)
  224. {
  225. pxa_set_mci_info(&zylonite_mci_platform_data);
  226. pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
  227. if (cpu_is_pxa310())
  228. pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
  229. }
  230. #else
  231. static inline void zylonite_init_mmc(void) {}
  232. #endif
  233. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  234. static unsigned int zylonite_matrix_key_map[] = {
  235. /* KEY(row, col, key_code) */
  236. KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
  237. KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
  238. KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
  239. KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
  240. KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
  241. KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
  242. KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
  243. KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
  244. KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
  245. KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
  246. KEY(4, 5, KEY_SPACE),
  247. KEY(5, 3, KEY_KPASTERISK), /* * */
  248. KEY(5, 4, KEY_KPDOT), /* #" */
  249. KEY(0, 7, KEY_UP),
  250. KEY(1, 7, KEY_DOWN),
  251. KEY(2, 7, KEY_LEFT),
  252. KEY(3, 7, KEY_RIGHT),
  253. KEY(2, 6, KEY_HOME),
  254. KEY(3, 6, KEY_END),
  255. KEY(6, 4, KEY_DELETE),
  256. KEY(6, 6, KEY_BACK),
  257. KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
  258. KEY(4, 6, KEY_ENTER), /* scroll push */
  259. KEY(5, 7, KEY_ENTER), /* keypad action */
  260. KEY(0, 4, KEY_EMAIL),
  261. KEY(5, 6, KEY_SEND),
  262. KEY(4, 0, KEY_CALENDAR),
  263. KEY(7, 6, KEY_RECORD),
  264. KEY(6, 7, KEY_VOLUMEUP),
  265. KEY(7, 7, KEY_VOLUMEDOWN),
  266. KEY(0, 6, KEY_F22), /* soft1 */
  267. KEY(1, 6, KEY_F23), /* soft2 */
  268. KEY(0, 3, KEY_AUX), /* contact */
  269. };
  270. static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
  271. .matrix_key_rows = 8,
  272. .matrix_key_cols = 8,
  273. .matrix_key_map = zylonite_matrix_key_map,
  274. .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map),
  275. .enable_rotary0 = 1,
  276. .rotary0_up_key = KEY_UP,
  277. .rotary0_down_key = KEY_DOWN,
  278. .debounce_interval = 30,
  279. };
  280. static void __init zylonite_init_keypad(void)
  281. {
  282. pxa_set_keypad_info(&zylonite_keypad_info);
  283. }
  284. #else
  285. static inline void zylonite_init_keypad(void) {}
  286. #endif
  287. #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)