aspenite.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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/rawnand.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. .parts = aspenite_nand_partitions,
  162. .nr_parts = ARRAY_SIZE(aspenite_nand_partitions),
  163. };
  164. static struct i2c_board_info aspenite_i2c_info[] __initdata = {
  165. { I2C_BOARD_INFO("wm8753", 0x1b), },
  166. };
  167. static struct fb_videomode video_modes[] = {
  168. [0] = {
  169. .pixclock = 30120,
  170. .refresh = 60,
  171. .xres = 800,
  172. .yres = 480,
  173. .hsync_len = 1,
  174. .left_margin = 215,
  175. .right_margin = 40,
  176. .vsync_len = 1,
  177. .upper_margin = 34,
  178. .lower_margin = 10,
  179. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  180. },
  181. };
  182. struct pxa168fb_mach_info aspenite_lcd_info = {
  183. .id = "Graphic Frame",
  184. .modes = video_modes,
  185. .num_modes = ARRAY_SIZE(video_modes),
  186. .pix_fmt = PIX_FMT_RGB565,
  187. .io_pin_allocation_mode = PIN_MODE_DUMB_24,
  188. .dumb_mode = DUMB_MODE_RGB888,
  189. .active = 1,
  190. .panel_rbswap = 0,
  191. .invert_pixclock = 0,
  192. };
  193. static const unsigned int aspenite_matrix_key_map[] = {
  194. KEY(0, 6, KEY_UP), /* SW 4 */
  195. KEY(0, 7, KEY_DOWN), /* SW 5 */
  196. KEY(1, 6, KEY_LEFT), /* SW 6 */
  197. KEY(1, 7, KEY_RIGHT), /* SW 7 */
  198. KEY(4, 6, KEY_ENTER), /* SW 8 */
  199. KEY(4, 7, KEY_ESC), /* SW 9 */
  200. };
  201. static struct matrix_keymap_data aspenite_matrix_keymap_data = {
  202. .keymap = aspenite_matrix_key_map,
  203. .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map),
  204. };
  205. static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
  206. .matrix_key_rows = 5,
  207. .matrix_key_cols = 8,
  208. .matrix_keymap_data = &aspenite_matrix_keymap_data,
  209. .debounce_interval = 30,
  210. };
  211. #if IS_ENABLED(CONFIG_USB_EHCI_MV)
  212. static struct mv_usb_platform_data pxa168_sph_pdata = {
  213. .mode = MV_USB_MODE_HOST,
  214. .phy_init = pxa_usb_phy_init,
  215. .phy_deinit = pxa_usb_phy_deinit,
  216. .set_vbus = NULL,
  217. };
  218. #endif
  219. static void __init common_init(void)
  220. {
  221. mfp_config(ARRAY_AND_SIZE(common_pin_config));
  222. /* on-chip devices */
  223. pxa168_add_uart(1);
  224. pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
  225. pxa168_add_ssp(1);
  226. pxa168_add_nand(&aspenite_nand_info);
  227. pxa168_add_fb(&aspenite_lcd_info);
  228. pxa168_add_keypad(&aspenite_keypad_info);
  229. platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
  230. sizeof(struct pxa_gpio_platform_data));
  231. platform_device_register(&pxa168_device_gpio);
  232. /* off-chip devices */
  233. platform_device_register(&smc91x_device);
  234. #if IS_ENABLED(CONFIG_USB_EHCI_MV)
  235. pxa168_add_usb_host(&pxa168_sph_pdata);
  236. #endif
  237. }
  238. MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
  239. .map_io = mmp_map_io,
  240. .nr_irqs = MMP_NR_IRQS,
  241. .init_irq = pxa168_init_irq,
  242. .init_time = pxa168_timer_init,
  243. .init_machine = common_init,
  244. .restart = pxa168_restart,
  245. MACHINE_END
  246. MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
  247. .map_io = mmp_map_io,
  248. .nr_irqs = MMP_NR_IRQS,
  249. .init_irq = pxa168_init_irq,
  250. .init_time = pxa168_timer_init,
  251. .init_machine = common_init,
  252. .restart = pxa168_restart,
  253. MACHINE_END