setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. static struct resource heartbeat_resources[] = {
  23. [0] = {
  24. .start = 0xb8140020,
  25. .end = 0xb8140020,
  26. .flags = IORESOURCE_MEM,
  27. },
  28. };
  29. static struct platform_device heartbeat_device = {
  30. .name = "heartbeat",
  31. .id = -1,
  32. .num_resources = ARRAY_SIZE(heartbeat_resources),
  33. .resource = heartbeat_resources,
  34. };
  35. static struct smc91x_platdata smc91x_info = {
  36. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  37. };
  38. static struct resource smc91x_resources[] = {
  39. [0] = {
  40. .start = 0x18000300,
  41. .end = 0x18000300 + 0x10 - 1,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. /* Filled in by ilsel */
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. static struct platform_device smc91x_device = {
  50. .name = "smc91x",
  51. .id = -1,
  52. .resource = smc91x_resources,
  53. .num_resources = ARRAY_SIZE(smc91x_resources),
  54. .dev = {
  55. .platform_data = &smc91x_info,
  56. },
  57. };
  58. static struct r8a66597_platdata r8a66597_data = {
  59. .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
  60. .vif = 1,
  61. };
  62. static struct resource r8a66597_usb_host_resources[] = {
  63. [0] = {
  64. .start = 0x18040000,
  65. .end = 0x18080000 - 1,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [1] = {
  69. /* Filled in by ilsel */
  70. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  71. },
  72. };
  73. static struct platform_device r8a66597_usb_host_device = {
  74. .name = "r8a66597_hcd",
  75. .id = -1,
  76. .dev = {
  77. .dma_mask = NULL, /* don't use dma */
  78. .coherent_dma_mask = 0xffffffff,
  79. .platform_data = &r8a66597_data,
  80. },
  81. .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
  82. .resource = r8a66597_usb_host_resources,
  83. };
  84. static struct m66592_platdata usbf_platdata = {
  85. .xtal = M66592_PLATDATA_XTAL_24MHZ,
  86. .vif = 1,
  87. };
  88. static struct resource m66592_usb_peripheral_resources[] = {
  89. [0] = {
  90. .name = "m66592_udc",
  91. .start = 0x18080000,
  92. .end = 0x180c0000 - 1,
  93. .flags = IORESOURCE_MEM,
  94. },
  95. [1] = {
  96. .name = "m66592_udc",
  97. /* Filled in by ilsel */
  98. .flags = IORESOURCE_IRQ,
  99. },
  100. };
  101. static struct platform_device m66592_usb_peripheral_device = {
  102. .name = "m66592_udc",
  103. .id = -1,
  104. .dev = {
  105. .dma_mask = NULL, /* don't use dma */
  106. .coherent_dma_mask = 0xffffffff,
  107. .platform_data = &usbf_platdata,
  108. },
  109. .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
  110. .resource = m66592_usb_peripheral_resources,
  111. };
  112. static struct platform_device *x3proto_devices[] __initdata = {
  113. &heartbeat_device,
  114. &smc91x_device,
  115. &r8a66597_usb_host_device,
  116. &m66592_usb_peripheral_device,
  117. };
  118. static int __init x3proto_devices_setup(void)
  119. {
  120. r8a66597_usb_host_resources[1].start =
  121. r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
  122. m66592_usb_peripheral_resources[1].start =
  123. m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);
  124. smc91x_resources[1].start =
  125. smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);
  126. return platform_add_devices(x3proto_devices,
  127. ARRAY_SIZE(x3proto_devices));
  128. }
  129. device_initcall(x3proto_devices_setup);
  130. static void __init x3proto_init_irq(void)
  131. {
  132. plat_irq_setup_pins(IRQ_MODE_IRL3210);
  133. /* Set ICR0.LVLMODE */
  134. ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000);
  135. }
  136. static struct sh_machine_vector mv_x3proto __initmv = {
  137. .mv_name = "x3proto",
  138. .mv_init_irq = x3proto_init_irq,
  139. };