zylonite.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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.h>
  22. #include <linux/pwm_backlight.h>
  23. #include <linux/smc91x.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include "pxa3xx.h"
  27. #include <mach/audio.h>
  28. #include <linux/platform_data/video-pxafb.h>
  29. #include "zylonite.h"
  30. #include <linux/platform_data/mmc-pxamci.h>
  31. #include <linux/platform_data/usb-ohci-pxa27x.h>
  32. #include <linux/platform_data/keypad-pxa27x.h>
  33. #include <linux/platform_data/mtd-nand-pxa3xx.h>
  34. #include "devices.h"
  35. #include "generic.h"
  36. int gpio_eth_irq;
  37. int gpio_debug_led1;
  38. int gpio_debug_led2;
  39. int wm9713_irq;
  40. int lcd_id;
  41. int lcd_orientation;
  42. struct platform_device pxa_device_wm9713_audio = {
  43. .name = "wm9713-codec",
  44. .id = -1,
  45. };
  46. static void __init zylonite_init_wm9713_audio(void)
  47. {
  48. platform_device_register(&pxa_device_wm9713_audio);
  49. }
  50. static struct resource smc91x_resources[] = {
  51. [0] = {
  52. .start = ZYLONITE_ETH_PHYS + 0x300,
  53. .end = ZYLONITE_ETH_PHYS + 0xfffff,
  54. .flags = IORESOURCE_MEM,
  55. },
  56. [1] = {
  57. .start = -1, /* for run-time assignment */
  58. .end = -1,
  59. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  60. }
  61. };
  62. static struct smc91x_platdata zylonite_smc91x_info = {
  63. .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
  64. SMC91X_NOWAIT | SMC91X_USE_DMA,
  65. };
  66. static struct platform_device smc91x_device = {
  67. .name = "smc91x",
  68. .id = 0,
  69. .num_resources = ARRAY_SIZE(smc91x_resources),
  70. .resource = smc91x_resources,
  71. .dev = {
  72. .platform_data = &zylonite_smc91x_info,
  73. },
  74. };
  75. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  76. static struct gpio_led zylonite_debug_leds[] = {
  77. [0] = {
  78. .name = "zylonite:yellow:1",
  79. .default_trigger = "heartbeat",
  80. },
  81. [1] = {
  82. .name = "zylonite:yellow:2",
  83. .default_trigger = "default-on",
  84. },
  85. };
  86. static struct gpio_led_platform_data zylonite_debug_leds_info = {
  87. .leds = zylonite_debug_leds,
  88. .num_leds = ARRAY_SIZE(zylonite_debug_leds),
  89. };
  90. static struct platform_device zylonite_device_leds = {
  91. .name = "leds-gpio",
  92. .id = -1,
  93. .dev = {
  94. .platform_data = &zylonite_debug_leds_info,
  95. }
  96. };
  97. static void __init zylonite_init_leds(void)
  98. {
  99. zylonite_debug_leds[0].gpio = gpio_debug_led1;
  100. zylonite_debug_leds[1].gpio = gpio_debug_led2;
  101. platform_device_register(&zylonite_device_leds);
  102. }
  103. #else
  104. static inline void zylonite_init_leds(void) {}
  105. #endif
  106. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  107. static struct pwm_lookup zylonite_pwm_lookup[] = {
  108. PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000,
  109. PWM_POLARITY_NORMAL),
  110. };
  111. static struct platform_pwm_backlight_data zylonite_backlight_data = {
  112. .max_brightness = 100,
  113. .dft_brightness = 100,
  114. .enable_gpio = -1,
  115. };
  116. static struct platform_device zylonite_backlight_device = {
  117. .name = "pwm-backlight",
  118. .dev = {
  119. .parent = &pxa27x_device_pwm1.dev,
  120. .platform_data = &zylonite_backlight_data,
  121. },
  122. };
  123. static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
  124. .pixclock = 110000,
  125. .xres = 240,
  126. .yres = 320,
  127. .bpp = 16,
  128. .hsync_len = 4,
  129. .left_margin = 6,
  130. .right_margin = 4,
  131. .vsync_len = 2,
  132. .upper_margin = 2,
  133. .lower_margin = 3,
  134. .sync = FB_SYNC_VERT_HIGH_ACT,
  135. };
  136. static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
  137. .pixclock = 50000,
  138. .xres = 640,
  139. .yres = 480,
  140. .bpp = 16,
  141. .hsync_len = 1,
  142. .left_margin = 0x9f,
  143. .right_margin = 1,
  144. .vsync_len = 44,
  145. .upper_margin = 0,
  146. .lower_margin = 0,
  147. .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
  148. };
  149. static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
  150. .num_modes = 1,
  151. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  152. };
  153. static struct pxafb_mode_info sharp_ls037_modes[] = {
  154. [0] = {
  155. .pixclock = 158000,
  156. .xres = 240,
  157. .yres = 320,
  158. .bpp = 16,
  159. .hsync_len = 4,
  160. .left_margin = 39,
  161. .right_margin = 39,
  162. .vsync_len = 1,
  163. .upper_margin = 2,
  164. .lower_margin = 3,
  165. .sync = 0,
  166. },
  167. [1] = {
  168. .pixclock = 39700,
  169. .xres = 480,
  170. .yres = 640,
  171. .bpp = 16,
  172. .hsync_len = 8,
  173. .left_margin = 81,
  174. .right_margin = 81,
  175. .vsync_len = 1,
  176. .upper_margin = 2,
  177. .lower_margin = 7,
  178. .sync = 0,
  179. },
  180. };
  181. static struct pxafb_mach_info zylonite_sharp_lcd_info = {
  182. .modes = sharp_ls037_modes,
  183. .num_modes = 2,
  184. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  185. };
  186. static void __init zylonite_init_lcd(void)
  187. {
  188. pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup));
  189. platform_device_register(&zylonite_backlight_device);
  190. if (lcd_id & 0x20) {
  191. pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
  192. return;
  193. }
  194. /* legacy LCD panels, it would be handy here if LCD panel type can
  195. * be decided at run-time
  196. */
  197. if (1)
  198. zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
  199. else
  200. zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
  201. pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
  202. }
  203. #else
  204. static inline void zylonite_init_lcd(void) {}
  205. #endif
  206. #if defined(CONFIG_MMC)
  207. static struct pxamci_platform_data zylonite_mci_platform_data = {
  208. .detect_delay_ms= 200,
  209. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  210. .gpio_card_detect = EXT_GPIO(0),
  211. .gpio_card_ro = EXT_GPIO(2),
  212. .gpio_power = -1,
  213. };
  214. static struct pxamci_platform_data zylonite_mci2_platform_data = {
  215. .detect_delay_ms= 200,
  216. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  217. .gpio_card_detect = EXT_GPIO(1),
  218. .gpio_card_ro = EXT_GPIO(3),
  219. .gpio_power = -1,
  220. };
  221. static struct pxamci_platform_data zylonite_mci3_platform_data = {
  222. .detect_delay_ms= 200,
  223. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  224. .gpio_card_detect = EXT_GPIO(30),
  225. .gpio_card_ro = EXT_GPIO(31),
  226. .gpio_power = -1,
  227. };
  228. static void __init zylonite_init_mmc(void)
  229. {
  230. pxa_set_mci_info(&zylonite_mci_platform_data);
  231. pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
  232. if (cpu_is_pxa310())
  233. pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
  234. }
  235. #else
  236. static inline void zylonite_init_mmc(void) {}
  237. #endif
  238. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  239. static const unsigned int zylonite_matrix_key_map[] = {
  240. /* KEY(row, col, key_code) */
  241. KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
  242. KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
  243. KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
  244. KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
  245. KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
  246. KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
  247. KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
  248. KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
  249. KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
  250. KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
  251. KEY(4, 5, KEY_SPACE),
  252. KEY(5, 3, KEY_KPASTERISK), /* * */
  253. KEY(5, 4, KEY_KPDOT), /* #" */
  254. KEY(0, 7, KEY_UP),
  255. KEY(1, 7, KEY_DOWN),
  256. KEY(2, 7, KEY_LEFT),
  257. KEY(3, 7, KEY_RIGHT),
  258. KEY(2, 6, KEY_HOME),
  259. KEY(3, 6, KEY_END),
  260. KEY(6, 4, KEY_DELETE),
  261. KEY(6, 6, KEY_BACK),
  262. KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
  263. KEY(4, 6, KEY_ENTER), /* scroll push */
  264. KEY(5, 7, KEY_ENTER), /* keypad action */
  265. KEY(0, 4, KEY_EMAIL),
  266. KEY(5, 6, KEY_SEND),
  267. KEY(4, 0, KEY_CALENDAR),
  268. KEY(7, 6, KEY_RECORD),
  269. KEY(6, 7, KEY_VOLUMEUP),
  270. KEY(7, 7, KEY_VOLUMEDOWN),
  271. KEY(0, 6, KEY_F22), /* soft1 */
  272. KEY(1, 6, KEY_F23), /* soft2 */
  273. KEY(0, 3, KEY_AUX), /* contact */
  274. };
  275. static struct matrix_keymap_data zylonite_matrix_keymap_data = {
  276. .keymap = zylonite_matrix_key_map,
  277. .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
  278. };
  279. static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
  280. .matrix_key_rows = 8,
  281. .matrix_key_cols = 8,
  282. .matrix_keymap_data = &zylonite_matrix_keymap_data,
  283. .enable_rotary0 = 1,
  284. .rotary0_up_key = KEY_UP,
  285. .rotary0_down_key = KEY_DOWN,
  286. .debounce_interval = 30,
  287. };
  288. static void __init zylonite_init_keypad(void)
  289. {
  290. pxa_set_keypad_info(&zylonite_keypad_info);
  291. }
  292. #else
  293. static inline void zylonite_init_keypad(void) {}
  294. #endif
  295. #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
  296. static struct mtd_partition zylonite_nand_partitions[] = {
  297. [0] = {
  298. .name = "Bootloader",
  299. .offset = 0,
  300. .size = 0x060000,
  301. .mask_flags = MTD_WRITEABLE, /* force read-only */
  302. },
  303. [1] = {
  304. .name = "Kernel",
  305. .offset = 0x060000,
  306. .size = 0x200000,
  307. .mask_flags = MTD_WRITEABLE, /* force read-only */
  308. },
  309. [2] = {
  310. .name = "Filesystem",
  311. .offset = 0x0260000,
  312. .size = 0x3000000, /* 48M - rootfs */
  313. },
  314. [3] = {
  315. .name = "MassStorage",
  316. .offset = 0x3260000,
  317. .size = 0x3d40000,
  318. },
  319. [4] = {
  320. .name = "BBT",
  321. .offset = 0x6FA0000,
  322. .size = 0x80000,
  323. .mask_flags = MTD_WRITEABLE, /* force read-only */
  324. },
  325. /* NOTE: we reserve some blocks at the end of the NAND flash for
  326. * bad block management, and the max number of relocation blocks
  327. * differs on different platforms. Please take care with it when
  328. * defining the partition table.
  329. */
  330. };
  331. static struct pxa3xx_nand_platform_data zylonite_nand_info = {
  332. .enable_arbiter = 1,
  333. .num_cs = 1,
  334. .parts[0] = zylonite_nand_partitions,
  335. .nr_parts[0] = ARRAY_SIZE(zylonite_nand_partitions),
  336. };
  337. static void __init zylonite_init_nand(void)
  338. {
  339. pxa3xx_set_nand_info(&zylonite_nand_info);
  340. }
  341. #else
  342. static inline void zylonite_init_nand(void) {}
  343. #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
  344. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  345. static struct pxaohci_platform_data zylonite_ohci_info = {
  346. .port_mode = PMM_PERPORT_MODE,
  347. .flags = ENABLE_PORT1 | ENABLE_PORT2 |
  348. POWER_CONTROL_LOW | POWER_SENSE_LOW,
  349. };
  350. static void __init zylonite_init_ohci(void)
  351. {
  352. pxa_set_ohci_info(&zylonite_ohci_info);
  353. }
  354. #else
  355. static inline void zylonite_init_ohci(void) {}
  356. #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
  357. static void __init zylonite_init(void)
  358. {
  359. pxa_set_ffuart_info(NULL);
  360. pxa_set_btuart_info(NULL);
  361. pxa_set_stuart_info(NULL);
  362. /* board-processor specific initialization */
  363. zylonite_pxa300_init();
  364. zylonite_pxa320_init();
  365. /*
  366. * Note: We depend that the bootloader set
  367. * the correct value to MSC register for SMC91x.
  368. */
  369. smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
  370. smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
  371. platform_device_register(&smc91x_device);
  372. pxa_set_ac97_info(NULL);
  373. zylonite_init_lcd();
  374. zylonite_init_mmc();
  375. zylonite_init_keypad();
  376. zylonite_init_nand();
  377. zylonite_init_leds();
  378. zylonite_init_ohci();
  379. zylonite_init_wm9713_audio();
  380. }
  381. MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
  382. .atag_offset = 0x100,
  383. .map_io = pxa3xx_map_io,
  384. .nr_irqs = ZYLONITE_NR_IRQS,
  385. .init_irq = pxa3xx_init_irq,
  386. .handle_irq = pxa3xx_handle_irq,
  387. .init_time = pxa_timer_init,
  388. .init_machine = zylonite_init,
  389. .restart = pxa_restart,
  390. MACHINE_END