setup.c 3.5 KB

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