cpu-db5500.c 2.9 KB

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