setup.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/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. /*
  22. * The Machine Vector
  23. */
  24. struct sh_machine_vector mv_r7780rp __initmv = {
  25. .mv_nr_irqs = 109,
  26. .mv_inb = r7780rp_inb,
  27. .mv_inw = r7780rp_inw,
  28. .mv_inl = r7780rp_inl,
  29. .mv_outb = r7780rp_outb,
  30. .mv_outw = r7780rp_outw,
  31. .mv_outl = r7780rp_outl,
  32. .mv_inb_p = r7780rp_inb_p,
  33. .mv_inw_p = r7780rp_inw,
  34. .mv_inl_p = r7780rp_inl,
  35. .mv_outb_p = r7780rp_outb_p,
  36. .mv_outw_p = r7780rp_outw,
  37. .mv_outl_p = r7780rp_outl,
  38. .mv_insb = r7780rp_insb,
  39. .mv_insw = r7780rp_insw,
  40. .mv_insl = r7780rp_insl,
  41. .mv_outsb = r7780rp_outsb,
  42. .mv_outsw = r7780rp_outsw,
  43. .mv_outsl = r7780rp_outsl,
  44. .mv_ioport_map = r7780rp_ioport_map,
  45. .mv_init_irq = init_r7780rp_IRQ,
  46. #ifdef CONFIG_HEARTBEAT
  47. .mv_heartbeat = heartbeat_r7780rp,
  48. #endif
  49. };
  50. ALIAS_MV(r7780rp)
  51. static struct resource m66596_usb_host_resources[] = {
  52. [0] = {
  53. .start = 0xa4800000,
  54. .end = 0xa4ffffff,
  55. .flags = IORESOURCE_MEM,
  56. },
  57. [1] = {
  58. .start = 6, /* irq number */
  59. .end = 6,
  60. .flags = IORESOURCE_IRQ,
  61. },
  62. };
  63. static struct platform_device m66596_usb_host_device = {
  64. .name = "m66596-hcd",
  65. .id = 0,
  66. .dev = {
  67. .dma_mask = NULL, /* don't use dma */
  68. .coherent_dma_mask = 0xffffffff,
  69. },
  70. .num_resources = ARRAY_SIZE(m66596_usb_host_resources),
  71. .resource = m66596_usb_host_resources,
  72. };
  73. static struct platform_device *r7780rp_devices[] __initdata = {
  74. &m66596_usb_host_device,
  75. };
  76. static int __init r7780rp_devices_setup(void)
  77. {
  78. return platform_add_devices(r7780rp_devices,
  79. ARRAY_SIZE(r7780rp_devices));
  80. }
  81. __initcall(r7780rp_devices_setup);
  82. /*
  83. * Platform specific clocks
  84. */
  85. static void ivdr_clk_enable(struct clk *clk)
  86. {
  87. ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL);
  88. }
  89. static void ivdr_clk_disable(struct clk *clk)
  90. {
  91. ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL);
  92. }
  93. static struct clk_ops ivdr_clk_ops = {
  94. .enable = ivdr_clk_enable,
  95. .disable = ivdr_clk_disable,
  96. };
  97. static struct clk ivdr_clk = {
  98. .name = "ivdr_clk",
  99. .ops = &ivdr_clk_ops,
  100. };
  101. static struct clk *r7780rp_clocks[] = {
  102. &ivdr_clk,
  103. };
  104. const char *get_system_type(void)
  105. {
  106. return "Highlander R7780RP-1";
  107. }
  108. static void r7780rp_power_off(void)
  109. {
  110. #ifdef CONFIG_SH_R7780MP
  111. ctrl_outw(0x0001, PA_POFF);
  112. #endif
  113. }
  114. /*
  115. * Initialize the board
  116. */
  117. void __init platform_setup(void)
  118. {
  119. u16 ver = ctrl_inw(PA_VERREG);
  120. int i;
  121. printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
  122. printk(KERN_INFO "Board version: %d (revision %d), "
  123. "FPGA version: %d (revision %d)\n",
  124. (ver >> 12) & 0xf, (ver >> 8) & 0xf,
  125. (ver >> 4) & 0xf, ver & 0xf);
  126. /*
  127. * Enable the important clocks right away..
  128. */
  129. for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
  130. struct clk *clk = r7780rp_clocks[i];
  131. clk_register(clk);
  132. clk_enable(clk);
  133. }
  134. ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
  135. #ifndef CONFIG_SH_R7780MP
  136. ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
  137. #endif
  138. ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x0100, PA_IVDRCTL); /* Si13112 */
  139. pm_power_off = r7780rp_power_off;
  140. }