setup.c 4.6 KB

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