setup.c 3.5 KB

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