setup.c 3.3 KB

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