setup.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /*
  2. * arch/sh/boards/renesas/x3proto/setup.c
  3. *
  4. * Renesas SH-X3 Prototype Board Support.
  5. *
  6. * Copyright (C) 2007 - 2008 Paul Mundt
  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. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/kernel.h>
  15. #include <linux/io.h>
  16. #include <linux/smc91x.h>
  17. #include <linux/irq.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/usb/r8a66597.h>
  20. #include <linux/usb/m66592.h>
  21. #include <asm/ilsel.h>
  22. #include <asm/smp-ops.h>
  23. static struct resource heartbeat_resources[] = {
  24. [0] = {
  25. .start = 0xb8140020,
  26. .end = 0xb8140020,
  27. .flags = IORESOURCE_MEM,
  28. },
  29. };
  30. static struct platform_device heartbeat_device = {
  31. .name = "heartbeat",
  32. .id = -1,
  33. .num_resources = ARRAY_SIZE(heartbeat_resources),
  34. .resource = heartbeat_resources,
  35. };
  36. static struct smc91x_platdata smc91x_info = {
  37. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  38. };
  39. static struct resource smc91x_resources[] = {
  40. [0] = {
  41. .start = 0x18000300,
  42. .end = 0x18000300 + 0x10 - 1,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. /* Filled in by ilsel */
  47. .flags = IORESOURCE_IRQ,
  48. },
  49. };
  50. static struct platform_device smc91x_device = {
  51. .name = "smc91x",
  52. .id = -1,
  53. .resource = smc91x_resources,
  54. .num_resources = ARRAY_SIZE(smc91x_resources),
  55. .dev = {
  56. .platform_data = &smc91x_info,
  57. },
  58. };
  59. static struct r8a66597_platdata r8a66597_data = {
  60. .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
  61. .vif = 1,
  62. };
  63. static struct resource r8a66597_usb_host_resources[] = {
  64. [0] = {
  65. .start = 0x18040000,
  66. .end = 0x18080000 - 1,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. /* Filled in by ilsel */
  71. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  72. },
  73. };
  74. static struct platform_device r8a66597_usb_host_device = {
  75. .name = "r8a66597_hcd",
  76. .id = -1,
  77. .dev = {
  78. .dma_mask = NULL, /* don't use dma */
  79. .coherent_dma_mask = 0xffffffff,
  80. .platform_data = &r8a66597_data,
  81. },
  82. .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
  83. .resource = r8a66597_usb_host_resources,
  84. };
  85. static struct m66592_platdata usbf_platdata = {
  86. .xtal = M66592_PLATDATA_XTAL_24MHZ,
  87. .vif = 1,
  88. };
  89. static struct resource m66592_usb_peripheral_resources[] = {
  90. [0] = {
  91. .name = "m66592_udc",
  92. .start = 0x18080000,
  93. .end = 0x180c0000 - 1,
  94. .flags = IORESOURCE_MEM,
  95. },
  96. [1] = {
  97. .name = "m66592_udc",
  98. /* Filled in by ilsel */
  99. .flags = IORESOURCE_IRQ,
  100. },
  101. };
  102. static struct platform_device m66592_usb_peripheral_device = {
  103. .name = "m66592_udc",
  104. .id = -1,
  105. .dev = {
  106. .dma_mask = NULL, /* don't use dma */
  107. .coherent_dma_mask = 0xffffffff,
  108. .platform_data = &usbf_platdata,
  109. },
  110. .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
  111. .resource = m66592_usb_peripheral_resources,
  112. };
  113. static struct platform_device *x3proto_devices[] __initdata = {
  114. &heartbeat_device,
  115. &smc91x_device,
  116. &r8a66597_usb_host_device,
  117. &m66592_usb_peripheral_device,
  118. };
  119. static int __init x3proto_devices_setup(void)
  120. {
  121. r8a66597_usb_host_resources[1].start =
  122. r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
  123. m66592_usb_peripheral_resources[1].start =
  124. m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
  125. smc91x_resources[1].start =
  126. smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
  127. return platform_add_devices(x3proto_devices,
  128. ARRAY_SIZE(x3proto_devices));
  129. }
  130. device_initcall(x3proto_devices_setup);
  131. static void __init x3proto_init_irq(void)
  132. {
  133. plat_irq_setup_pins(IRQ_MODE_IRL3210);
  134. /* Set ICR0.LVLMODE */
  135. __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
  136. }
  137. static void __init x3proto_setup(char **cmdline_p)
  138. {
  139. register_smp_ops(&shx3_smp_ops);
  140. }
  141. static struct sh_machine_vector mv_x3proto __initmv = {
  142. .mv_name = "x3proto",
  143. .mv_setup = x3proto_setup,
  144. .mv_init_irq = x3proto_init_irq,
  145. };