aspenite.c 5.6 KB

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