setup.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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/pata_platform.h>
  16. #include <asm/machvec.h>
  17. #include <asm/se7722.h>
  18. #include <asm/io.h>
  19. #include <asm/heartbeat.h>
  20. /* Heartbeat */
  21. static struct heartbeat_data heartbeat_data = {
  22. .regsize = 16,
  23. };
  24. static struct resource heartbeat_resources[] = {
  25. [0] = {
  26. .start = PA_LED,
  27. .end = PA_LED,
  28. .flags = IORESOURCE_MEM,
  29. },
  30. };
  31. static struct platform_device heartbeat_device = {
  32. .name = "heartbeat",
  33. .id = -1,
  34. .dev = {
  35. .platform_data = &heartbeat_data,
  36. },
  37. .num_resources = ARRAY_SIZE(heartbeat_resources),
  38. .resource = heartbeat_resources,
  39. };
  40. /* SMC91x */
  41. static struct resource smc91x_eth_resources[] = {
  42. [0] = {
  43. .name = "smc91x-regs" ,
  44. .start = PA_LAN + 0x300,
  45. .end = PA_LAN + 0x300 + 0x10 ,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. [1] = {
  49. .start = SMC_IRQ,
  50. .end = SMC_IRQ,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. static struct platform_device smc91x_eth_device = {
  55. .name = "smc91x",
  56. .id = 0,
  57. .dev = {
  58. .dma_mask = NULL, /* don't use dma */
  59. .coherent_dma_mask = 0xffffffff,
  60. },
  61. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  62. .resource = smc91x_eth_resources,
  63. };
  64. static struct resource cf_ide_resources[] = {
  65. [0] = {
  66. .start = PA_MRSHPC_IO + 0x1f0,
  67. .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
  68. .flags = IORESOURCE_IO,
  69. },
  70. [1] = {
  71. .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
  72. .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
  73. .flags = IORESOURCE_IO,
  74. },
  75. [2] = {
  76. .start = MRSHPC_IRQ0,
  77. .end = MRSHPC_IRQ0,
  78. .flags = IORESOURCE_IRQ,
  79. },
  80. };
  81. static struct platform_device cf_ide_device = {
  82. .name = "pata_platform",
  83. .id = -1,
  84. .num_resources = ARRAY_SIZE(cf_ide_resources),
  85. .resource = cf_ide_resources,
  86. };
  87. static struct platform_device *se7722_devices[] __initdata = {
  88. &heartbeat_device,
  89. &smc91x_eth_device,
  90. &cf_ide_device,
  91. };
  92. static int __init se7722_devices_setup(void)
  93. {
  94. return platform_add_devices(se7722_devices,
  95. ARRAY_SIZE(se7722_devices));
  96. }
  97. device_initcall(se7722_devices_setup);
  98. static void __init se7722_setup(char **cmdline_p)
  99. {
  100. ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
  101. ctrl_outl(0x00051001, MSTPCR0);
  102. ctrl_outl(0x00000000, MSTPCR1);
  103. /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
  104. ctrl_outl(0xffffb7c0, MSTPCR2);
  105. ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
  106. ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
  107. /* LCDC I/O */
  108. ctrl_outw(0x0020, PORT_PSELD);
  109. /* SIOF1*/
  110. ctrl_outw(0x0003, PORT_PSELB);
  111. ctrl_outw(0xe000, PORT_PSELC);
  112. ctrl_outw(0x0000, PORT_PKCR);
  113. /* LCDC */
  114. ctrl_outw(0x4020, PORT_PHCR);
  115. ctrl_outw(0x0000, PORT_PLCR);
  116. ctrl_outw(0x0000, PORT_PMCR);
  117. ctrl_outw(0x0002, PORT_PRCR);
  118. ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
  119. /* KEYSC */
  120. ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
  121. ctrl_outw(0x0000, PORT_PYCR);
  122. ctrl_outw(0x0000, PORT_PZCR);
  123. }
  124. /*
  125. * The Machine Vector
  126. */
  127. static struct sh_machine_vector mv_se7722 __initmv = {
  128. .mv_name = "Solution Engine 7722" ,
  129. .mv_setup = se7722_setup ,
  130. .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
  131. .mv_init_irq = init_se7722_IRQ,
  132. };