aspenite.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-mmp/aspenite.c
  4. *
  5. * Support for the Marvell PXA168-based Aspenite and Zylonite2
  6. * Development Platform.
  7. */
  8. #include <linux/gpio.h>
  9. #include <linux/gpio-pxa.h>
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/smc91x.h>
  14. #include <linux/mtd/mtd.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/mtd/rawnand.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/platform_data/mv_usb.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <video/pxa168fb.h>
  22. #include <linux/input.h>
  23. #include <linux/platform_data/keypad-pxa27x.h>
  24. #include "addr-map.h"
  25. #include "mfp-pxa168.h"
  26. #include "pxa168.h"
  27. #include "pxa910.h"
  28. #include "irqs.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 pxa_gpio_platform_data pxa168_gpio_pdata = {
  104. .irq_base = MMP_GPIO_TO_IRQ(0),
  105. };
  106. static struct smc91x_platdata smc91x_info = {
  107. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  108. };
  109. static struct resource smc91x_resources[] = {
  110. [0] = {
  111. .start = SMC_CS1_PHYS_BASE + 0x300,
  112. .end = SMC_CS1_PHYS_BASE + 0xfffff,
  113. .flags = IORESOURCE_MEM,
  114. },
  115. [1] = {
  116. .start = MMP_GPIO_TO_IRQ(27),
  117. .end = MMP_GPIO_TO_IRQ(27),
  118. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  119. }
  120. };
  121. static struct platform_device smc91x_device = {
  122. .name = "smc91x",
  123. .id = 0,
  124. .dev = {
  125. .platform_data = &smc91x_info,
  126. },
  127. .num_resources = ARRAY_SIZE(smc91x_resources),
  128. .resource = smc91x_resources,
  129. };
  130. static struct mtd_partition aspenite_nand_partitions[] = {
  131. {
  132. .name = "bootloader",
  133. .offset = 0,
  134. .size = SZ_1M,
  135. .mask_flags = MTD_WRITEABLE,
  136. }, {
  137. .name = "reserved",
  138. .offset = MTDPART_OFS_APPEND,
  139. .size = SZ_128K,
  140. .mask_flags = MTD_WRITEABLE,
  141. }, {
  142. .name = "reserved",
  143. .offset = MTDPART_OFS_APPEND,
  144. .size = SZ_8M,
  145. .mask_flags = MTD_WRITEABLE,
  146. }, {
  147. .name = "kernel",
  148. .offset = MTDPART_OFS_APPEND,
  149. .size = (SZ_2M + SZ_1M),
  150. .mask_flags = 0,
  151. }, {
  152. .name = "filesystem",
  153. .offset = MTDPART_OFS_APPEND,
  154. .size = SZ_32M + SZ_16M,
  155. .mask_flags = 0,
  156. }
  157. };
  158. static struct pxa3xx_nand_platform_data aspenite_nand_info = {
  159. .parts = aspenite_nand_partitions,
  160. .nr_parts = ARRAY_SIZE(aspenite_nand_partitions),
  161. };
  162. static struct i2c_board_info aspenite_i2c_info[] __initdata = {
  163. { I2C_BOARD_INFO("wm8753", 0x1b), },
  164. };
  165. static struct fb_videomode video_modes[] = {
  166. [0] = {
  167. .pixclock = 30120,
  168. .refresh = 60,
  169. .xres = 800,
  170. .yres = 480,
  171. .hsync_len = 1,
  172. .left_margin = 215,
  173. .right_margin = 40,
  174. .vsync_len = 1,
  175. .upper_margin = 34,
  176. .lower_margin = 10,
  177. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  178. },
  179. };
  180. struct pxa168fb_mach_info aspenite_lcd_info = {
  181. .id = "Graphic Frame",
  182. .modes = video_modes,
  183. .num_modes = ARRAY_SIZE(video_modes),
  184. .pix_fmt = PIX_FMT_RGB565,
  185. .io_pin_allocation_mode = PIN_MODE_DUMB_24,
  186. .dumb_mode = DUMB_MODE_RGB888,
  187. .active = 1,
  188. .panel_rbswap = 0,
  189. .invert_pixclock = 0,
  190. };
  191. static const unsigned int aspenite_matrix_key_map[] = {
  192. KEY(0, 6, KEY_UP), /* SW 4 */
  193. KEY(0, 7, KEY_DOWN), /* SW 5 */
  194. KEY(1, 6, KEY_LEFT), /* SW 6 */
  195. KEY(1, 7, KEY_RIGHT), /* SW 7 */
  196. KEY(4, 6, KEY_ENTER), /* SW 8 */
  197. KEY(4, 7, KEY_ESC), /* SW 9 */
  198. };
  199. static struct matrix_keymap_data aspenite_matrix_keymap_data = {
  200. .keymap = aspenite_matrix_key_map,
  201. .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map),
  202. };
  203. static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
  204. .matrix_key_rows = 5,
  205. .matrix_key_cols = 8,
  206. .matrix_keymap_data = &aspenite_matrix_keymap_data,
  207. .debounce_interval = 30,
  208. };
  209. #if IS_ENABLED(CONFIG_USB_EHCI_MV)
  210. static struct mv_usb_platform_data pxa168_sph_pdata = {
  211. .mode = MV_USB_MODE_HOST,
  212. .phy_init = pxa_usb_phy_init,
  213. .phy_deinit = pxa_usb_phy_deinit,
  214. .set_vbus = NULL,
  215. };
  216. #endif
  217. static void __init common_init(void)
  218. {
  219. mfp_config(ARRAY_AND_SIZE(common_pin_config));
  220. /* on-chip devices */
  221. pxa168_add_uart(1);
  222. pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
  223. pxa168_add_ssp(1);
  224. pxa168_add_nand(&aspenite_nand_info);
  225. pxa168_add_fb(&aspenite_lcd_info);
  226. pxa168_add_keypad(&aspenite_keypad_info);
  227. platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
  228. sizeof(struct pxa_gpio_platform_data));
  229. platform_device_register(&pxa168_device_gpio);
  230. /* off-chip devices */
  231. platform_device_register(&smc91x_device);
  232. #if IS_ENABLED(CONFIG_USB_SUPPORT)
  233. #if IS_ENABLED(CONFIG_PHY_PXA_USB)
  234. platform_device_register(&pxa168_device_usb_phy);
  235. #endif
  236. #if IS_ENABLED(CONFIG_USB_EHCI_MV)
  237. pxa168_add_usb_host(&pxa168_sph_pdata);
  238. #endif
  239. #endif
  240. }
  241. MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
  242. .map_io = mmp_map_io,
  243. .nr_irqs = MMP_NR_IRQS,
  244. .init_irq = pxa168_init_irq,
  245. .init_time = pxa168_timer_init,
  246. .init_machine = common_init,
  247. .restart = pxa168_restart,
  248. MACHINE_END
  249. MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
  250. .map_io = mmp_map_io,
  251. .nr_irqs = MMP_NR_IRQS,
  252. .init_irq = pxa168_init_irq,
  253. .init_time = pxa168_timer_init,
  254. .init_machine = common_init,
  255. .restart = pxa168_restart,
  256. MACHINE_END