setup.c 3.3 KB

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