setup.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * arch/sh/boards/renesas/r7780rp/setup.c
  3. *
  4. * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
  5. * Copyright (C) 2005, 2006 Paul Mundt
  6. *
  7. * Renesas Solutions Highlander R7780RP-1 Support.
  8. *
  9. * This file is subject to the terms and conditions of the GNU General Public
  10. * License. See the file "COPYING" in the main directory of this archive
  11. * for more details.
  12. */
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <asm/machvec.h>
  16. #include <asm/r7780rp.h>
  17. #include <asm/clock.h>
  18. #include <asm/io.h>
  19. extern void heartbeat_r7780rp(void);
  20. extern void init_r7780rp_IRQ(void);
  21. static struct resource m66596_usb_host_resources[] = {
  22. [0] = {
  23. .start = 0xa4800000,
  24. .end = 0xa4ffffff,
  25. .flags = IORESOURCE_MEM,
  26. },
  27. [1] = {
  28. .start = 6, /* irq number */
  29. .end = 6,
  30. .flags = IORESOURCE_IRQ,
  31. },
  32. };
  33. static struct platform_device m66596_usb_host_device = {
  34. .name = "m66596-hcd",
  35. .id = 0,
  36. .dev = {
  37. .dma_mask = NULL, /* don't use dma */
  38. .coherent_dma_mask = 0xffffffff,
  39. },
  40. .num_resources = ARRAY_SIZE(m66596_usb_host_resources),
  41. .resource = m66596_usb_host_resources,
  42. };
  43. static struct resource cf_ide_resources[] = {
  44. [0] = {
  45. .start = 0x1f0,
  46. .end = 0x1f0 + 8,
  47. .flags = IORESOURCE_IO,
  48. },
  49. [1] = {
  50. .start = 0x1f0 + 0x206,
  51. .end = 0x1f0 + 8 + 0x206 + 8,
  52. .flags = IORESOURCE_IO,
  53. },
  54. [2] = {
  55. #ifdef CONFIG_SH_R7780MP
  56. .start = 1,
  57. #else
  58. .start = 4,
  59. #endif
  60. .flags = IORESOURCE_IRQ,
  61. },
  62. };
  63. static struct platform_device cf_ide_device = {
  64. .name = "pata_platform",
  65. .id = -1,
  66. .num_resources = ARRAY_SIZE(cf_ide_resources),
  67. .resource = cf_ide_resources,
  68. };
  69. static struct platform_device *r7780rp_devices[] __initdata = {
  70. &m66596_usb_host_device,
  71. &cf_ide_device,
  72. };
  73. static int __init r7780rp_devices_setup(void)
  74. {
  75. return platform_add_devices(r7780rp_devices,
  76. ARRAY_SIZE(r7780rp_devices));
  77. }
  78. /*
  79. * Platform specific clocks
  80. */
  81. static void ivdr_clk_enable(struct clk *clk)
  82. {
  83. ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL);
  84. }
  85. static void ivdr_clk_disable(struct clk *clk)
  86. {
  87. ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL);
  88. }
  89. static struct clk_ops ivdr_clk_ops = {
  90. .enable = ivdr_clk_enable,
  91. .disable = ivdr_clk_disable,
  92. };
  93. static struct clk ivdr_clk = {
  94. .name = "ivdr_clk",
  95. .ops = &ivdr_clk_ops,
  96. };
  97. static struct clk *r7780rp_clocks[] = {
  98. &ivdr_clk,
  99. };
  100. static void r7780rp_power_off(void)
  101. {
  102. #ifdef CONFIG_SH_R7780MP
  103. ctrl_outw(0x0001, PA_POFF);
  104. #endif
  105. }
  106. /*
  107. * Initialize the board
  108. */
  109. static void __init r7780rp_setup(char **cmdline_p)
  110. {
  111. u16 ver = ctrl_inw(PA_VERREG);
  112. int i;
  113. device_initcall(r7780rp_devices_setup);
  114. printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
  115. printk(KERN_INFO "Board version: %d (revision %d), "
  116. "FPGA version: %d (revision %d)\n",
  117. (ver >> 12) & 0xf, (ver >> 8) & 0xf,
  118. (ver >> 4) & 0xf, ver & 0xf);
  119. /*
  120. * Enable the important clocks right away..
  121. */
  122. for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
  123. struct clk *clk = r7780rp_clocks[i];
  124. clk_register(clk);
  125. clk_enable(clk);
  126. }
  127. ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
  128. #ifndef CONFIG_SH_R7780MP
  129. ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
  130. #endif
  131. ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x0100, PA_IVDRCTL); /* Si13112 */
  132. pm_power_off = r7780rp_power_off;
  133. }
  134. /*
  135. * The Machine Vector
  136. */
  137. struct sh_machine_vector mv_r7780rp __initmv = {
  138. .mv_name = "Highlander R7780RP-1",
  139. .mv_setup = r7780rp_setup,
  140. .mv_nr_irqs = 109,
  141. .mv_inb = r7780rp_inb,
  142. .mv_inw = r7780rp_inw,
  143. .mv_inl = r7780rp_inl,
  144. .mv_outb = r7780rp_outb,
  145. .mv_outw = r7780rp_outw,
  146. .mv_outl = r7780rp_outl,
  147. .mv_inb_p = r7780rp_inb_p,
  148. .mv_inw_p = r7780rp_inw,
  149. .mv_inl_p = r7780rp_inl,
  150. .mv_outb_p = r7780rp_outb_p,
  151. .mv_outw_p = r7780rp_outw,
  152. .mv_outl_p = r7780rp_outl,
  153. .mv_insb = r7780rp_insb,
  154. .mv_insw = r7780rp_insw,
  155. .mv_insl = r7780rp_insl,
  156. .mv_outsb = r7780rp_outsb,
  157. .mv_outsw = r7780rp_outsw,
  158. .mv_outsl = r7780rp_outsl,
  159. .mv_ioport_map = r7780rp_ioport_map,
  160. .mv_init_irq = init_r7780rp_IRQ,
  161. #ifdef CONFIG_HEARTBEAT
  162. .mv_heartbeat = heartbeat_r7780rp,
  163. #endif
  164. };
  165. ALIAS_MV(r7780rp)