aspenite.c 6.3 KB

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