cpu-db5500.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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_uart_io_desc[] __initdata = {
  19. __IO_DEV_DESC(U5500_UART0_BASE, SZ_4K),
  20. __IO_DEV_DESC(U5500_UART2_BASE, SZ_4K),
  21. };
  22. static struct map_desc u5500_io_desc[] __initdata = {
  23. __IO_DEV_DESC(U5500_GIC_CPU_BASE, SZ_4K),
  24. __IO_DEV_DESC(U5500_GIC_DIST_BASE, SZ_4K),
  25. __IO_DEV_DESC(U5500_L2CC_BASE, SZ_4K),
  26. __IO_DEV_DESC(U5500_TWD_BASE, SZ_4K),
  27. __IO_DEV_DESC(U5500_MTU0_BASE, SZ_4K),
  28. __IO_DEV_DESC(U5500_SCU_BASE, SZ_4K),
  29. __IO_DEV_DESC(U5500_BACKUPRAM0_BASE, SZ_8K),
  30. __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
  31. __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
  32. __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
  33. __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
  34. __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
  35. __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
  36. };
  37. static struct resource mbox0_resources[] = {
  38. {
  39. .name = "mbox_peer",
  40. .start = U5500_MBOX0_PEER_START,
  41. .end = U5500_MBOX0_PEER_END,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. {
  45. .name = "mbox_local",
  46. .start = U5500_MBOX0_LOCAL_START,
  47. .end = U5500_MBOX0_LOCAL_END,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. {
  51. .name = "mbox_irq",
  52. .start = MBOX_PAIR0_VIRT_IRQ,
  53. .end = MBOX_PAIR0_VIRT_IRQ,
  54. .flags = IORESOURCE_IRQ,
  55. }
  56. };
  57. static struct resource mbox1_resources[] = {
  58. {
  59. .name = "mbox_peer",
  60. .start = U5500_MBOX1_PEER_START,
  61. .end = U5500_MBOX1_PEER_END,
  62. .flags = IORESOURCE_MEM,
  63. },
  64. {
  65. .name = "mbox_local",
  66. .start = U5500_MBOX1_LOCAL_START,
  67. .end = U5500_MBOX1_LOCAL_END,
  68. .flags = IORESOURCE_MEM,
  69. },
  70. {
  71. .name = "mbox_irq",
  72. .start = MBOX_PAIR1_VIRT_IRQ,
  73. .end = MBOX_PAIR1_VIRT_IRQ,
  74. .flags = IORESOURCE_IRQ,
  75. }
  76. };
  77. static struct resource mbox2_resources[] = {
  78. {
  79. .name = "mbox_peer",
  80. .start = U5500_MBOX2_PEER_START,
  81. .end = U5500_MBOX2_PEER_END,
  82. .flags = IORESOURCE_MEM,
  83. },
  84. {
  85. .name = "mbox_local",
  86. .start = U5500_MBOX2_LOCAL_START,
  87. .end = U5500_MBOX2_LOCAL_END,
  88. .flags = IORESOURCE_MEM,
  89. },
  90. {
  91. .name = "mbox_irq",
  92. .start = MBOX_PAIR2_VIRT_IRQ,
  93. .end = MBOX_PAIR2_VIRT_IRQ,
  94. .flags = IORESOURCE_IRQ,
  95. }
  96. };
  97. static struct platform_device mbox0_device = {
  98. .id = 0,
  99. .name = "mbox",
  100. .resource = mbox0_resources,
  101. .num_resources = ARRAY_SIZE(mbox0_resources),
  102. };
  103. static struct platform_device mbox1_device = {
  104. .id = 1,
  105. .name = "mbox",
  106. .resource = mbox1_resources,
  107. .num_resources = ARRAY_SIZE(mbox1_resources),
  108. };
  109. static struct platform_device mbox2_device = {
  110. .id = 2,
  111. .name = "mbox",
  112. .resource = mbox2_resources,
  113. .num_resources = ARRAY_SIZE(mbox2_resources),
  114. };
  115. static struct platform_device *u5500_platform_devs[] __initdata = {
  116. &mbox0_device,
  117. &mbox1_device,
  118. &mbox2_device,
  119. };
  120. static resource_size_t __initdata db5500_gpio_base[] = {
  121. U5500_GPIOBANK0_BASE,
  122. U5500_GPIOBANK1_BASE,
  123. U5500_GPIOBANK2_BASE,
  124. U5500_GPIOBANK3_BASE,
  125. U5500_GPIOBANK4_BASE,
  126. U5500_GPIOBANK5_BASE,
  127. U5500_GPIOBANK6_BASE,
  128. U5500_GPIOBANK7_BASE,
  129. };
  130. static void __init db5500_add_gpios(void)
  131. {
  132. struct nmk_gpio_platform_data pdata = {
  133. /* No custom data yet */
  134. };
  135. dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
  136. IRQ_DB5500_GPIO0, &pdata);
  137. }
  138. void __init u5500_map_io(void)
  139. {
  140. /*
  141. * Map the UARTs early so that the DEBUG_LL stuff continues to work.
  142. */
  143. iotable_init(u5500_uart_io_desc, ARRAY_SIZE(u5500_uart_io_desc));
  144. ux500_map_io();
  145. iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
  146. }
  147. void __init u5500_init_devices(void)
  148. {
  149. db5500_add_gpios();
  150. db5500_dma_init();
  151. db5500_add_rtc();
  152. platform_add_devices(u5500_platform_devs,
  153. ARRAY_SIZE(u5500_platform_devs));
  154. }