aspenite.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*
  2. * linux/arch/arm/mach-mmp/aspenite.c
  3. *
  4. * Support for the Marvell PXA168-based Aspenite and Zylonite2
  5. * Development Platform.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * publishhed by the Free Software Foundation.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/smc91x.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/mtd/nand.h>
  19. #include <linux/interrupt.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <mach/addr-map.h>
  23. #include <mach/mfp-pxa168.h>
  24. #include <mach/pxa168.h>
  25. #include <mach/irqs.h>
  26. #include <video/pxa168fb.h>
  27. #include <linux/input.h>
  28. #include <plat/pxa27x_keypad.h>
  29. #include "common.h"
  30. static unsigned long common_pin_config[] __initdata = {
  31. /* Data Flash Interface */
  32. GPIO0_DFI_D15,
  33. GPIO1_DFI_D14,
  34. GPIO2_DFI_D13,
  35. GPIO3_DFI_D12,
  36. GPIO4_DFI_D11,
  37. GPIO5_DFI_D10,
  38. GPIO6_DFI_D9,
  39. GPIO7_DFI_D8,
  40. GPIO8_DFI_D7,
  41. GPIO9_DFI_D6,
  42. GPIO10_DFI_D5,
  43. GPIO11_DFI_D4,
  44. GPIO12_DFI_D3,
  45. GPIO13_DFI_D2,
  46. GPIO14_DFI_D1,
  47. GPIO15_DFI_D0,
  48. /* Static Memory Controller */
  49. GPIO18_SMC_nCS0,
  50. GPIO34_SMC_nCS1,
  51. GPIO23_SMC_nLUA,
  52. GPIO25_SMC_nLLA,
  53. GPIO28_SMC_RDY,
  54. GPIO29_SMC_SCLK,
  55. GPIO35_SMC_BE1,
  56. GPIO36_SMC_BE2,
  57. GPIO27_GPIO, /* Ethernet IRQ */
  58. /* UART1 */
  59. GPIO107_UART1_RXD,
  60. GPIO108_UART1_TXD,
  61. /* SSP1 */
  62. GPIO113_I2S_MCLK,
  63. GPIO114_I2S_FRM,
  64. GPIO115_I2S_BCLK,
  65. GPIO116_I2S_RXD,
  66. GPIO117_I2S_TXD,
  67. /* LCD */
  68. GPIO56_LCD_FCLK_RD,
  69. GPIO57_LCD_LCLK_A0,
  70. GPIO58_LCD_PCLK_WR,
  71. GPIO59_LCD_DENA_BIAS,
  72. GPIO60_LCD_DD0,
  73. GPIO61_LCD_DD1,
  74. GPIO62_LCD_DD2,
  75. GPIO63_LCD_DD3,
  76. GPIO64_LCD_DD4,
  77. GPIO65_LCD_DD5,
  78. GPIO66_LCD_DD6,
  79. GPIO67_LCD_DD7,
  80. GPIO68_LCD_DD8,
  81. GPIO69_LCD_DD9,
  82. GPIO70_LCD_DD10,
  83. GPIO71_LCD_DD11,
  84. GPIO72_LCD_DD12,
  85. GPIO73_LCD_DD13,
  86. GPIO74_LCD_DD14,
  87. GPIO75_LCD_DD15,
  88. GPIO76_LCD_DD16,
  89. GPIO77_LCD_DD17,
  90. GPIO78_LCD_DD18,
  91. GPIO79_LCD_DD19,
  92. GPIO80_LCD_DD20,
  93. GPIO81_LCD_DD21,
  94. GPIO82_LCD_DD22,
  95. GPIO83_LCD_DD23,
  96. /* Keypad */
  97. GPIO109_KP_MKIN1,
  98. GPIO110_KP_MKIN0,
  99. GPIO111_KP_MKOUT7,
  100. GPIO112_KP_MKOUT6,
  101. GPIO121_KP_MKIN4,
  102. };
  103. static struct smc91x_platdata smc91x_info = {
  104. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  105. };
  106. static struct resource smc91x_resources[] = {
  107. [0] = {
  108. .start = SMC_CS1_PHYS_BASE + 0x300,
  109. .end = SMC_CS1_PHYS_BASE + 0xfffff,
  110. .flags = IORESOURCE_MEM,
  111. },
  112. [1] = {
  113. .start = MMP_GPIO_TO_IRQ(27),
  114. .end = MMP_GPIO_TO_IRQ(27),
  115. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  116. }
  117. };
  118. static struct platform_device smc91x_device = {
  119. .name = "smc91x",
  120. .id = 0,
  121. .dev = {
  122. .platform_data = &smc91x_info,
  123. },
  124. .num_resources = ARRAY_SIZE(smc91x_resources),
  125. .resource = smc91x_resources,
  126. };
  127. static struct mtd_partition aspenite_nand_partitions[] = {
  128. {
  129. .name = "bootloader",
  130. .offset = 0,
  131. .size = SZ_1M,
  132. .mask_flags = MTD_WRITEABLE,
  133. }, {
  134. .name = "reserved",
  135. .offset = MTDPART_OFS_APPEND,
  136. .size = SZ_128K,
  137. .mask_flags = MTD_WRITEABLE,
  138. }, {
  139. .name = "reserved",
  140. .offset = MTDPART_OFS_APPEND,
  141. .size = SZ_8M,
  142. .mask_flags = MTD_WRITEABLE,
  143. }, {
  144. .name = "kernel",
  145. .offset = MTDPART_OFS_APPEND,
  146. .size = (SZ_2M + SZ_1M),
  147. .mask_flags = 0,
  148. }, {
  149. .name = "filesystem",
  150. .offset = MTDPART_OFS_APPEND,
  151. .size = SZ_32M + SZ_16M,
  152. .mask_flags = 0,
  153. }
  154. };
  155. static struct pxa3xx_nand_platform_data aspenite_nand_info = {
  156. .enable_arbiter = 1,
  157. .num_cs = 1,
  158. .parts[0] = aspenite_nand_partitions,
  159. .nr_parts[0] = ARRAY_SIZE(aspenite_nand_partitions),
  160. };
  161. static struct i2c_board_info aspenite_i2c_info[] __initdata = {
  162. { I2C_BOARD_INFO("wm8753", 0x1b), },
  163. };
  164. static struct fb_videomode video_modes[] = {
  165. [0] = {
  166. .pixclock = 30120,
  167. .refresh = 60,
  168. .xres = 800,
  169. .yres = 480,
  170. .hsync_len = 1,
  171. .left_margin = 215,
  172. .right_margin = 40,
  173. .vsync_len = 1,
  174. .upper_margin = 34,
  175. .lower_margin = 10,
  176. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  177. },
  178. };
  179. struct pxa168fb_mach_info aspenite_lcd_info = {
  180. .id = "Graphic Frame",
  181. .modes = video_modes,
  182. .num_modes = ARRAY_SIZE(video_modes),
  183. .pix_fmt = PIX_FMT_RGB565,
  184. .io_pin_allocation_mode = PIN_MODE_DUMB_24,
  185. .dumb_mode = DUMB_MODE_RGB888,
  186. .active = 1,
  187. .panel_rbswap = 0,
  188. .invert_pixclock = 0,
  189. };
  190. static unsigned int aspenite_matrix_key_map[] = {
  191. KEY(0, 6, KEY_UP), /* SW 4 */
  192. KEY(0, 7, KEY_DOWN), /* SW 5 */
  193. KEY(1, 6, KEY_LEFT), /* SW 6 */
  194. KEY(1, 7, KEY_RIGHT), /* SW 7 */
  195. KEY(4, 6, KEY_ENTER), /* SW 8 */
  196. KEY(4, 7, KEY_ESC), /* SW 9 */
  197. };
  198. static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
  199. .matrix_key_rows = 5,
  200. .matrix_key_cols = 8,
  201. .matrix_key_map = aspenite_matrix_key_map,
  202. .matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map),
  203. .debounce_interval = 30,
  204. };
  205. static void __init common_init(void)
  206. {
  207. mfp_config(ARRAY_AND_SIZE(common_pin_config));
  208. /* on-chip devices */
  209. pxa168_add_uart(1);
  210. pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
  211. pxa168_add_ssp(1);
  212. pxa168_add_nand(&aspenite_nand_info);
  213. pxa168_add_fb(&aspenite_lcd_info);
  214. pxa168_add_keypad(&aspenite_keypad_info);
  215. platform_device_register(&pxa168_device_gpio);
  216. /* off-chip devices */
  217. platform_device_register(&smc91x_device);
  218. }
  219. MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
  220. .map_io = mmp_map_io,
  221. .nr_irqs = MMP_NR_IRQS,
  222. .init_irq = pxa168_init_irq,
  223. .timer = &pxa168_timer,
  224. .init_machine = common_init,
  225. .restart = pxa168_restart,
  226. MACHINE_END
  227. MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
  228. .map_io = mmp_map_io,
  229. .nr_irqs = MMP_NR_IRQS,
  230. .init_irq = pxa168_init_irq,
  231. .timer = &pxa168_timer,
  232. .init_machine = common_init,
  233. .restart = pxa168_restart,
  234. MACHINE_END