setup.c 3.1 KB

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