setup.c 3.5 KB

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