cpu-db5500.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #include <linux/platform_device.h>
  8. #include <linux/amba/bus.h>
  9. #include <linux/io.h>
  10. #include <linux/irq.h>
  11. #include <asm/mach/map.h>
  12. #include <mach/hardware.h>
  13. #include <mach/devices.h>
  14. #include <mach/setup.h>
  15. #include <mach/irqs.h>
  16. #include "devices-db5500.h"
  17. static struct map_desc u5500_io_desc[] __initdata = {
  18. __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
  19. __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
  20. __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
  21. __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
  22. __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
  23. __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
  24. };
  25. static struct resource mbox0_resources[] = {
  26. {
  27. .name = "mbox_peer",
  28. .start = U5500_MBOX0_PEER_START,
  29. .end = U5500_MBOX0_PEER_END,
  30. .flags = IORESOURCE_MEM,
  31. },
  32. {
  33. .name = "mbox_local",
  34. .start = U5500_MBOX0_LOCAL_START,
  35. .end = U5500_MBOX0_LOCAL_END,
  36. .flags = IORESOURCE_MEM,
  37. },
  38. {
  39. .name = "mbox_irq",
  40. .start = MBOX_PAIR0_VIRT_IRQ,
  41. .end = MBOX_PAIR0_VIRT_IRQ,
  42. .flags = IORESOURCE_IRQ,
  43. }
  44. };
  45. static struct resource mbox1_resources[] = {
  46. {
  47. .name = "mbox_peer",
  48. .start = U5500_MBOX1_PEER_START,
  49. .end = U5500_MBOX1_PEER_END,
  50. .flags = IORESOURCE_MEM,
  51. },
  52. {
  53. .name = "mbox_local",
  54. .start = U5500_MBOX1_LOCAL_START,
  55. .end = U5500_MBOX1_LOCAL_END,
  56. .flags = IORESOURCE_MEM,
  57. },
  58. {
  59. .name = "mbox_irq",
  60. .start = MBOX_PAIR1_VIRT_IRQ,
  61. .end = MBOX_PAIR1_VIRT_IRQ,
  62. .flags = IORESOURCE_IRQ,
  63. }
  64. };
  65. static struct resource mbox2_resources[] = {
  66. {
  67. .name = "mbox_peer",
  68. .start = U5500_MBOX2_PEER_START,
  69. .end = U5500_MBOX2_PEER_END,
  70. .flags = IORESOURCE_MEM,
  71. },
  72. {
  73. .name = "mbox_local",
  74. .start = U5500_MBOX2_LOCAL_START,
  75. .end = U5500_MBOX2_LOCAL_END,
  76. .flags = IORESOURCE_MEM,
  77. },
  78. {
  79. .name = "mbox_irq",
  80. .start = MBOX_PAIR2_VIRT_IRQ,
  81. .end = MBOX_PAIR2_VIRT_IRQ,
  82. .flags = IORESOURCE_IRQ,
  83. }
  84. };
  85. static struct platform_device mbox0_device = {
  86. .id = 0,
  87. .name = "mbox",
  88. .resource = mbox0_resources,
  89. .num_resources = ARRAY_SIZE(mbox0_resources),
  90. };
  91. static struct platform_device mbox1_device = {
  92. .id = 1,
  93. .name = "mbox",
  94. .resource = mbox1_resources,
  95. .num_resources = ARRAY_SIZE(mbox1_resources),
  96. };
  97. static struct platform_device mbox2_device = {
  98. .id = 2,
  99. .name = "mbox",
  100. .resource = mbox2_resources,
  101. .num_resources = ARRAY_SIZE(mbox2_resources),
  102. };
  103. static struct platform_device *u5500_platform_devs[] __initdata = {
  104. &u5500_gpio_devs[0],
  105. &u5500_gpio_devs[1],
  106. &u5500_gpio_devs[2],
  107. &u5500_gpio_devs[3],
  108. &u5500_gpio_devs[4],
  109. &u5500_gpio_devs[5],
  110. &u5500_gpio_devs[6],
  111. &u5500_gpio_devs[7],
  112. &mbox0_device,
  113. &mbox1_device,
  114. &mbox2_device,
  115. };
  116. void __init u5500_map_io(void)
  117. {
  118. ux500_map_io();
  119. iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
  120. }
  121. void __init u5500_init_devices(void)
  122. {
  123. db5500_add_rtc();
  124. platform_add_devices(u5500_platform_devs,
  125. ARRAY_SIZE(u5500_platform_devs));
  126. }