setup.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * arch/sh/boards/superh/microdev/setup.c
  4. *
  5. * Copyright (C) 2003 Sean McGoogan ([email protected])
  6. * Copyright (C) 2003, 2004 SuperH, Inc.
  7. * Copyright (C) 2004, 2005 Paul Mundt
  8. *
  9. * SuperH SH4-202 MicroDev board support.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/ioport.h>
  14. #include <video/s1d13xxxfb.h>
  15. #include <mach/microdev.h>
  16. #include <asm/io.h>
  17. #include <asm/machvec.h>
  18. #include <linux/sizes.h>
  19. static struct resource smc91x_resources[] = {
  20. [0] = {
  21. .start = 0x300,
  22. .end = 0x300 + SZ_4K - 1,
  23. .flags = IORESOURCE_MEM,
  24. },
  25. [1] = {
  26. .start = MICRODEV_LINUX_IRQ_ETHERNET,
  27. .end = MICRODEV_LINUX_IRQ_ETHERNET,
  28. .flags = IORESOURCE_IRQ,
  29. },
  30. };
  31. static struct platform_device smc91x_device = {
  32. .name = "smc91x",
  33. .id = -1,
  34. .num_resources = ARRAY_SIZE(smc91x_resources),
  35. .resource = smc91x_resources,
  36. };
  37. static struct s1d13xxxfb_regval s1d13806_initregs[] = {
  38. { S1DREG_MISC, 0x00 },
  39. { S1DREG_COM_DISP_MODE, 0x00 },
  40. { S1DREG_GPIO_CNF0, 0x00 },
  41. { S1DREG_GPIO_CNF1, 0x00 },
  42. { S1DREG_GPIO_CTL0, 0x00 },
  43. { S1DREG_GPIO_CTL1, 0x00 },
  44. { S1DREG_CLK_CNF, 0x02 },
  45. { S1DREG_LCD_CLK_CNF, 0x01 },
  46. { S1DREG_CRT_CLK_CNF, 0x03 },
  47. { S1DREG_MPLUG_CLK_CNF, 0x03 },
  48. { S1DREG_CPU2MEM_WST_SEL, 0x02 },
  49. { S1DREG_SDRAM_REF_RATE, 0x03 },
  50. { S1DREG_SDRAM_TC0, 0x00 },
  51. { S1DREG_SDRAM_TC1, 0x01 },
  52. { S1DREG_MEM_CNF, 0x80 },
  53. { S1DREG_PANEL_TYPE, 0x25 },
  54. { S1DREG_MOD_RATE, 0x00 },
  55. { S1DREG_LCD_DISP_HWIDTH, 0x63 },
  56. { S1DREG_LCD_NDISP_HPER, 0x1e },
  57. { S1DREG_TFT_FPLINE_START, 0x06 },
  58. { S1DREG_TFT_FPLINE_PWIDTH, 0x03 },
  59. { S1DREG_LCD_DISP_VHEIGHT0, 0x57 },
  60. { S1DREG_LCD_DISP_VHEIGHT1, 0x02 },
  61. { S1DREG_LCD_NDISP_VPER, 0x00 },
  62. { S1DREG_TFT_FPFRAME_START, 0x0a },
  63. { S1DREG_TFT_FPFRAME_PWIDTH, 0x81 },
  64. { S1DREG_LCD_DISP_MODE, 0x03 },
  65. { S1DREG_LCD_MISC, 0x00 },
  66. { S1DREG_LCD_DISP_START0, 0x00 },
  67. { S1DREG_LCD_DISP_START1, 0x00 },
  68. { S1DREG_LCD_DISP_START2, 0x00 },
  69. { S1DREG_LCD_MEM_OFF0, 0x90 },
  70. { S1DREG_LCD_MEM_OFF1, 0x01 },
  71. { S1DREG_LCD_PIX_PAN, 0x00 },
  72. { S1DREG_LCD_DISP_FIFO_HTC, 0x00 },
  73. { S1DREG_LCD_DISP_FIFO_LTC, 0x00 },
  74. { S1DREG_CRT_DISP_HWIDTH, 0x63 },
  75. { S1DREG_CRT_NDISP_HPER, 0x1f },
  76. { S1DREG_CRT_HRTC_START, 0x04 },
  77. { S1DREG_CRT_HRTC_PWIDTH, 0x8f },
  78. { S1DREG_CRT_DISP_VHEIGHT0, 0x57 },
  79. { S1DREG_CRT_DISP_VHEIGHT1, 0x02 },
  80. { S1DREG_CRT_NDISP_VPER, 0x1b },
  81. { S1DREG_CRT_VRTC_START, 0x00 },
  82. { S1DREG_CRT_VRTC_PWIDTH, 0x83 },
  83. { S1DREG_TV_OUT_CTL, 0x10 },
  84. { S1DREG_CRT_DISP_MODE, 0x05 },
  85. { S1DREG_CRT_DISP_START0, 0x00 },
  86. { S1DREG_CRT_DISP_START1, 0x00 },
  87. { S1DREG_CRT_DISP_START2, 0x00 },
  88. { S1DREG_CRT_MEM_OFF0, 0x20 },
  89. { S1DREG_CRT_MEM_OFF1, 0x03 },
  90. { S1DREG_CRT_PIX_PAN, 0x00 },
  91. { S1DREG_CRT_DISP_FIFO_HTC, 0x00 },
  92. { S1DREG_CRT_DISP_FIFO_LTC, 0x00 },
  93. { S1DREG_LCD_CUR_CTL, 0x00 },
  94. { S1DREG_LCD_CUR_START, 0x01 },
  95. { S1DREG_LCD_CUR_XPOS0, 0x00 },
  96. { S1DREG_LCD_CUR_XPOS1, 0x00 },
  97. { S1DREG_LCD_CUR_YPOS0, 0x00 },
  98. { S1DREG_LCD_CUR_YPOS1, 0x00 },
  99. { S1DREG_LCD_CUR_BCTL0, 0x00 },
  100. { S1DREG_LCD_CUR_GCTL0, 0x00 },
  101. { S1DREG_LCD_CUR_RCTL0, 0x00 },
  102. { S1DREG_LCD_CUR_BCTL1, 0x1f },
  103. { S1DREG_LCD_CUR_GCTL1, 0x3f },
  104. { S1DREG_LCD_CUR_RCTL1, 0x1f },
  105. { S1DREG_LCD_CUR_FIFO_HTC, 0x00 },
  106. { S1DREG_CRT_CUR_CTL, 0x00 },
  107. { S1DREG_CRT_CUR_START, 0x01 },
  108. { S1DREG_CRT_CUR_XPOS0, 0x00 },
  109. { S1DREG_CRT_CUR_XPOS1, 0x00 },
  110. { S1DREG_CRT_CUR_YPOS0, 0x00 },
  111. { S1DREG_CRT_CUR_YPOS1, 0x00 },
  112. { S1DREG_CRT_CUR_BCTL0, 0x00 },
  113. { S1DREG_CRT_CUR_GCTL0, 0x00 },
  114. { S1DREG_CRT_CUR_RCTL0, 0x00 },
  115. { S1DREG_CRT_CUR_BCTL1, 0x1f },
  116. { S1DREG_CRT_CUR_GCTL1, 0x3f },
  117. { S1DREG_CRT_CUR_RCTL1, 0x1f },
  118. { S1DREG_CRT_CUR_FIFO_HTC, 0x00 },
  119. { S1DREG_BBLT_CTL0, 0x00 },
  120. { S1DREG_BBLT_CTL1, 0x00 },
  121. { S1DREG_BBLT_CC_EXP, 0x00 },
  122. { S1DREG_BBLT_OP, 0x00 },
  123. { S1DREG_BBLT_SRC_START0, 0x00 },
  124. { S1DREG_BBLT_SRC_START1, 0x00 },
  125. { S1DREG_BBLT_SRC_START2, 0x00 },
  126. { S1DREG_BBLT_DST_START0, 0x00 },
  127. { S1DREG_BBLT_DST_START1, 0x00 },
  128. { S1DREG_BBLT_DST_START2, 0x00 },
  129. { S1DREG_BBLT_MEM_OFF0, 0x00 },
  130. { S1DREG_BBLT_MEM_OFF1, 0x00 },
  131. { S1DREG_BBLT_WIDTH0, 0x00 },
  132. { S1DREG_BBLT_WIDTH1, 0x00 },
  133. { S1DREG_BBLT_HEIGHT0, 0x00 },
  134. { S1DREG_BBLT_HEIGHT1, 0x00 },
  135. { S1DREG_BBLT_BGC0, 0x00 },
  136. { S1DREG_BBLT_BGC1, 0x00 },
  137. { S1DREG_BBLT_FGC0, 0x00 },
  138. { S1DREG_BBLT_FGC1, 0x00 },
  139. { S1DREG_LKUP_MODE, 0x00 },
  140. { S1DREG_LKUP_ADDR, 0x00 },
  141. { S1DREG_PS_CNF, 0x10 },
  142. { S1DREG_PS_STATUS, 0x00 },
  143. { S1DREG_CPU2MEM_WDOGT, 0x00 },
  144. { S1DREG_COM_DISP_MODE, 0x02 },
  145. };
  146. static struct s1d13xxxfb_pdata s1d13806_platform_data = {
  147. .initregs = s1d13806_initregs,
  148. .initregssize = ARRAY_SIZE(s1d13806_initregs),
  149. };
  150. static struct resource s1d13806_resources[] = {
  151. [0] = {
  152. .start = 0x07200000,
  153. .end = 0x07200000 + SZ_2M - 1,
  154. .flags = IORESOURCE_MEM,
  155. },
  156. [1] = {
  157. .start = 0x07000000,
  158. .end = 0x07000000 + SZ_2M - 1,
  159. .flags = IORESOURCE_MEM,
  160. },
  161. };
  162. static struct platform_device s1d13806_device = {
  163. .name = "s1d13806fb",
  164. .id = -1,
  165. .num_resources = ARRAY_SIZE(s1d13806_resources),
  166. .resource = s1d13806_resources,
  167. .dev = {
  168. .platform_data = &s1d13806_platform_data,
  169. },
  170. };
  171. static struct platform_device *microdev_devices[] __initdata = {
  172. &smc91x_device,
  173. &s1d13806_device,
  174. };
  175. static int __init microdev_devices_setup(void)
  176. {
  177. return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices));
  178. }
  179. device_initcall(microdev_devices_setup);
  180. /*
  181. * The Machine Vector
  182. */
  183. static struct sh_machine_vector mv_sh4202_microdev __initmv = {
  184. .mv_name = "SH4-202 MicroDev",
  185. .mv_ioport_map = microdev_ioport_map,
  186. .mv_init_irq = init_microdev_irq,
  187. };