cpu-db5500.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 <plat/gpio.h>
  13. #include <mach/hardware.h>
  14. #include <mach/devices.h>
  15. #include <mach/setup.h>
  16. #include <mach/irqs.h>
  17. #include "devices-db5500.h"
  18. static struct map_desc u5500_io_desc[] __initdata = {
  19. __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
  20. __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
  21. __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
  22. __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
  23. __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
  24. __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
  25. };
  26. static struct resource mbox0_resources[] = {
  27. {
  28. .name = "mbox_peer",
  29. .start = U5500_MBOX0_PEER_START,
  30. .end = U5500_MBOX0_PEER_END,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. {
  34. .name = "mbox_local",
  35. .start = U5500_MBOX0_LOCAL_START,
  36. .end = U5500_MBOX0_LOCAL_END,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. {
  40. .name = "mbox_irq",
  41. .start = MBOX_PAIR0_VIRT_IRQ,
  42. .end = MBOX_PAIR0_VIRT_IRQ,
  43. .flags = IORESOURCE_IRQ,
  44. }
  45. };
  46. static struct resource mbox1_resources[] = {
  47. {
  48. .name = "mbox_peer",
  49. .start = U5500_MBOX1_PEER_START,
  50. .end = U5500_MBOX1_PEER_END,
  51. .flags = IORESOURCE_MEM,
  52. },
  53. {
  54. .name = "mbox_local",
  55. .start = U5500_MBOX1_LOCAL_START,
  56. .end = U5500_MBOX1_LOCAL_END,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. {
  60. .name = "mbox_irq",
  61. .start = MBOX_PAIR1_VIRT_IRQ,
  62. .end = MBOX_PAIR1_VIRT_IRQ,
  63. .flags = IORESOURCE_IRQ,
  64. }
  65. };
  66. static struct resource mbox2_resources[] = {
  67. {
  68. .name = "mbox_peer",
  69. .start = U5500_MBOX2_PEER_START,
  70. .end = U5500_MBOX2_PEER_END,
  71. .flags = IORESOURCE_MEM,
  72. },
  73. {
  74. .name = "mbox_local",
  75. .start = U5500_MBOX2_LOCAL_START,
  76. .end = U5500_MBOX2_LOCAL_END,
  77. .flags = IORESOURCE_MEM,
  78. },
  79. {
  80. .name = "mbox_irq",
  81. .start = MBOX_PAIR2_VIRT_IRQ,
  82. .end = MBOX_PAIR2_VIRT_IRQ,
  83. .flags = IORESOURCE_IRQ,
  84. }
  85. };
  86. static struct platform_device mbox0_device = {
  87. .id = 0,
  88. .name = "mbox",
  89. .resource = mbox0_resources,
  90. .num_resources = ARRAY_SIZE(mbox0_resources),
  91. };
  92. static struct platform_device mbox1_device = {
  93. .id = 1,
  94. .name = "mbox",
  95. .resource = mbox1_resources,
  96. .num_resources = ARRAY_SIZE(mbox1_resources),
  97. };
  98. static struct platform_device mbox2_device = {
  99. .id = 2,
  100. .name = "mbox",
  101. .resource = mbox2_resources,
  102. .num_resources = ARRAY_SIZE(mbox2_resources),
  103. };
  104. static struct platform_device *u5500_platform_devs[] __initdata = {
  105. &mbox0_device,
  106. &mbox1_device,
  107. &mbox2_device,
  108. };
  109. static resource_size_t __initdata db5500_gpio_base[] = {
  110. U5500_GPIOBANK0_BASE,
  111. U5500_GPIOBANK1_BASE,
  112. U5500_GPIOBANK2_BASE,
  113. U5500_GPIOBANK3_BASE,
  114. U5500_GPIOBANK4_BASE,
  115. U5500_GPIOBANK5_BASE,
  116. U5500_GPIOBANK6_BASE,
  117. U5500_GPIOBANK7_BASE,
  118. };
  119. static void __init db5500_add_gpios(void)
  120. {
  121. struct nmk_gpio_platform_data pdata = {
  122. /* No custom data yet */
  123. };
  124. dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
  125. IRQ_DB5500_GPIO0, &pdata);
  126. }
  127. void __init u5500_map_io(void)
  128. {
  129. ux500_map_io();
  130. iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
  131. }
  132. void __init u5500_init_devices(void)
  133. {
  134. db5500_add_gpios();
  135. db5500_dma_init();
  136. db5500_add_rtc();
  137. platform_add_devices(u5500_platform_devs,
  138. ARRAY_SIZE(u5500_platform_devs));
  139. }