setup.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * linux/arch/sh/boards/se/7722/setup.c
  3. *
  4. * Copyright (C) 2007 Nobuhiro Iwamatsu
  5. *
  6. * Hitachi UL SolutionEngine 7722 Support.
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. *
  12. */
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/ata_platform.h>
  16. #include <linux/input.h>
  17. #include <linux/smc91x.h>
  18. #include <mach-se/mach/se7722.h>
  19. #include <mach-se/mach/mrshpc.h>
  20. #include <asm/machvec.h>
  21. #include <asm/clock.h>
  22. #include <asm/io.h>
  23. #include <asm/heartbeat.h>
  24. #include <asm/sh_keysc.h>
  25. #include <cpu/sh7722.h>
  26. /* Heartbeat */
  27. static struct heartbeat_data heartbeat_data = {
  28. .regsize = 16,
  29. };
  30. static struct resource heartbeat_resources[] = {
  31. [0] = {
  32. .start = PA_LED,
  33. .end = PA_LED,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. };
  37. static struct platform_device heartbeat_device = {
  38. .name = "heartbeat",
  39. .id = -1,
  40. .dev = {
  41. .platform_data = &heartbeat_data,
  42. },
  43. .num_resources = ARRAY_SIZE(heartbeat_resources),
  44. .resource = heartbeat_resources,
  45. };
  46. /* SMC91x */
  47. static struct smc91x_platdata smc91x_info = {
  48. .flags = SMC91X_USE_16BIT,
  49. };
  50. static struct resource smc91x_eth_resources[] = {
  51. [0] = {
  52. .name = "smc91x-regs" ,
  53. .start = PA_LAN + 0x300,
  54. .end = PA_LAN + 0x300 + 0x10 ,
  55. .flags = IORESOURCE_MEM,
  56. },
  57. [1] = {
  58. .start = SMC_IRQ,
  59. .end = SMC_IRQ,
  60. .flags = IORESOURCE_IRQ,
  61. },
  62. };
  63. static struct platform_device smc91x_eth_device = {
  64. .name = "smc91x",
  65. .id = 0,
  66. .dev = {
  67. .dma_mask = NULL, /* don't use dma */
  68. .coherent_dma_mask = 0xffffffff,
  69. .platform_data = &smc91x_info,
  70. },
  71. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  72. .resource = smc91x_eth_resources,
  73. };
  74. static struct resource cf_ide_resources[] = {
  75. [0] = {
  76. .start = PA_MRSHPC_IO + 0x1f0,
  77. .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
  78. .flags = IORESOURCE_IO,
  79. },
  80. [1] = {
  81. .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
  82. .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
  83. .flags = IORESOURCE_IO,
  84. },
  85. [2] = {
  86. .start = MRSHPC_IRQ0,
  87. .end = MRSHPC_IRQ0,
  88. .flags = IORESOURCE_IRQ,
  89. },
  90. };
  91. static struct platform_device cf_ide_device = {
  92. .name = "pata_platform",
  93. .id = -1,
  94. .num_resources = ARRAY_SIZE(cf_ide_resources),
  95. .resource = cf_ide_resources,
  96. };
  97. static struct sh_keysc_info sh_keysc_info = {
  98. .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
  99. .scan_timing = 3,
  100. .delay = 5,
  101. .keycodes = { /* SW1 -> SW30 */
  102. KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
  103. KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
  104. KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
  105. KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
  106. KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
  107. KEY_Z,
  108. KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */
  109. },
  110. };
  111. static struct resource sh_keysc_resources[] = {
  112. [0] = {
  113. .start = 0x044b0000,
  114. .end = 0x044b000f,
  115. .flags = IORESOURCE_MEM,
  116. },
  117. [1] = {
  118. .start = 79,
  119. .flags = IORESOURCE_IRQ,
  120. },
  121. };
  122. static struct platform_device sh_keysc_device = {
  123. .name = "sh_keysc",
  124. .id = 0, /* "keysc0" clock */
  125. .num_resources = ARRAY_SIZE(sh_keysc_resources),
  126. .resource = sh_keysc_resources,
  127. .dev = {
  128. .platform_data = &sh_keysc_info,
  129. },
  130. .archdata = {
  131. .hwblk_id = HWBLK_KEYSC,
  132. },
  133. };
  134. static struct platform_device *se7722_devices[] __initdata = {
  135. &heartbeat_device,
  136. &smc91x_eth_device,
  137. &cf_ide_device,
  138. &sh_keysc_device,
  139. };
  140. static int __init se7722_devices_setup(void)
  141. {
  142. mrshpc_setup_windows();
  143. return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices));
  144. }
  145. device_initcall(se7722_devices_setup);
  146. static void __init se7722_setup(char **cmdline_p)
  147. {
  148. ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
  149. ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
  150. ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
  151. /* LCDC I/O */
  152. ctrl_outw(0x0020, PORT_PSELD);
  153. /* SIOF1*/
  154. ctrl_outw(0x0003, PORT_PSELB);
  155. ctrl_outw(0xe000, PORT_PSELC);
  156. ctrl_outw(0x0000, PORT_PKCR);
  157. /* LCDC */
  158. ctrl_outw(0x4020, PORT_PHCR);
  159. ctrl_outw(0x0000, PORT_PLCR);
  160. ctrl_outw(0x0000, PORT_PMCR);
  161. ctrl_outw(0x0002, PORT_PRCR);
  162. ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
  163. /* KEYSC */
  164. ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
  165. ctrl_outw(0x0000, PORT_PYCR);
  166. ctrl_outw(0x0000, PORT_PZCR);
  167. ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
  168. ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
  169. }
  170. /*
  171. * The Machine Vector
  172. */
  173. static struct sh_machine_vector mv_se7722 __initmv = {
  174. .mv_name = "Solution Engine 7722" ,
  175. .mv_setup = se7722_setup ,
  176. .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
  177. .mv_init_irq = init_se7722_IRQ,
  178. };