setup.c 3.3 KB

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