spear6xx.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * arch/arm/mach-spear6xx/spear6xx.c
  3. *
  4. * SPEAr6XX machines common source file
  5. *
  6. * Copyright (C) 2009 ST Microelectronics
  7. * Rajeev Kumar<rajeev-dlh.kumar@st.com>
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #include <linux/types.h>
  14. #include <linux/amba/pl061.h>
  15. #include <linux/ptrace.h>
  16. #include <linux/io.h>
  17. #include <asm/hardware/vic.h>
  18. #include <asm/irq.h>
  19. #include <asm/mach/arch.h>
  20. #include <mach/irqs.h>
  21. #include <mach/generic.h>
  22. #include <mach/spear.h>
  23. /* Add spear6xx machines common devices here */
  24. /* uart device registeration */
  25. struct amba_device uart_device[] = {
  26. {
  27. .dev = {
  28. .init_name = "uart0",
  29. },
  30. .res = {
  31. .start = SPEAR6XX_ICM1_UART0_BASE,
  32. .end = SPEAR6XX_ICM1_UART0_BASE +
  33. SPEAR6XX_ICM1_UART0_SIZE - 1,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. .irq = {IRQ_UART_0, NO_IRQ},
  37. }, {
  38. .dev = {
  39. .init_name = "uart1",
  40. },
  41. .res = {
  42. .start = SPEAR6XX_ICM1_UART1_BASE,
  43. .end = SPEAR6XX_ICM1_UART1_BASE +
  44. SPEAR6XX_ICM1_UART1_SIZE - 1,
  45. .flags = IORESOURCE_MEM,
  46. },
  47. .irq = {IRQ_UART_1, NO_IRQ},
  48. }
  49. };
  50. /* gpio device registeration */
  51. static struct pl061_platform_data gpio_plat_data[] = {
  52. {
  53. .gpio_base = 0,
  54. .irq_base = SPEAR_GPIO0_INT_BASE,
  55. }, {
  56. .gpio_base = 8,
  57. .irq_base = SPEAR_GPIO1_INT_BASE,
  58. }, {
  59. .gpio_base = 16,
  60. .irq_base = SPEAR_GPIO2_INT_BASE,
  61. },
  62. };
  63. struct amba_device gpio_device[] = {
  64. {
  65. .dev = {
  66. .init_name = "gpio0",
  67. .platform_data = &gpio_plat_data[0],
  68. },
  69. .res = {
  70. .start = SPEAR6XX_CPU_GPIO_BASE,
  71. .end = SPEAR6XX_CPU_GPIO_BASE +
  72. SPEAR6XX_CPU_GPIO_SIZE - 1,
  73. .flags = IORESOURCE_MEM,
  74. },
  75. .irq = {IRQ_LOCAL_GPIO, NO_IRQ},
  76. }, {
  77. .dev = {
  78. .init_name = "gpio1",
  79. .platform_data = &gpio_plat_data[1],
  80. },
  81. .res = {
  82. .start = SPEAR6XX_ICM3_GPIO_BASE,
  83. .end = SPEAR6XX_ICM3_GPIO_BASE +
  84. SPEAR6XX_ICM3_GPIO_SIZE - 1,
  85. .flags = IORESOURCE_MEM,
  86. },
  87. .irq = {IRQ_BASIC_GPIO, NO_IRQ},
  88. }, {
  89. .dev = {
  90. .init_name = "gpio2",
  91. .platform_data = &gpio_plat_data[2],
  92. },
  93. .res = {
  94. .start = SPEAR6XX_ICM2_GPIO_BASE,
  95. .end = SPEAR6XX_ICM2_GPIO_BASE +
  96. SPEAR6XX_ICM2_GPIO_SIZE - 1,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. .irq = {IRQ_APPL_GPIO, NO_IRQ},
  100. }
  101. };
  102. /* This will add devices, and do machine specific tasks */
  103. void __init spear6xx_init(void)
  104. {
  105. /* nothing to do for now */
  106. }
  107. /* This will initialize vic */
  108. void __init spear6xx_init_irq(void)
  109. {
  110. vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_PRI_BASE, 0, ~0, 0);
  111. vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_SEC_BASE, 32, ~0, 0);
  112. }
  113. /* Following will create static virtual/physical mappings */
  114. static struct map_desc spear6xx_io_desc[] __initdata = {
  115. {
  116. .virtual = VA_SPEAR6XX_ICM1_UART0_BASE,
  117. .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE),
  118. .length = SPEAR6XX_ICM1_UART0_SIZE,
  119. .type = MT_DEVICE
  120. }, {
  121. .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE,
  122. .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE),
  123. .length = SPEAR6XX_CPU_VIC_PRI_SIZE,
  124. .type = MT_DEVICE
  125. }, {
  126. .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE,
  127. .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE),
  128. .length = SPEAR6XX_CPU_VIC_SEC_SIZE,
  129. .type = MT_DEVICE
  130. }, {
  131. .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE,
  132. .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE),
  133. .length = SPEAR6XX_ICM3_MISC_REG_BASE,
  134. .type = MT_DEVICE
  135. }, {
  136. .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE,
  137. .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE),
  138. .length = SPEAR6XX_ICM3_MISC_REG_SIZE,
  139. .type = MT_DEVICE
  140. },
  141. };
  142. /* This will create static memory mapping for selected devices */
  143. void __init spear6xx_map_io(void)
  144. {
  145. iotable_init(spear6xx_io_desc, ARRAY_SIZE(spear6xx_io_desc));
  146. /* This will initialize clock framework */
  147. clk_init();
  148. }