board-msm8x60.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* Copyright (c) 2010, 2011, Code Aurora Forum. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/io.h>
  15. #include <linux/irq.h>
  16. #include <linux/irqdomain.h>
  17. #include <linux/of.h>
  18. #include <linux/of_address.h>
  19. #include <linux/of_irq.h>
  20. #include <linux/of_platform.h>
  21. #include <linux/memblock.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/hardware/gic.h>
  25. #include <asm/setup.h>
  26. #include <mach/board.h>
  27. #include <mach/msm_iomap.h>
  28. static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
  29. struct meminfo *mi)
  30. {
  31. for (; tag->hdr.size; tag = tag_next(tag))
  32. if (tag->hdr.tag == ATAG_MEM &&
  33. tag->u.mem.start == 0x40200000) {
  34. tag->u.mem.start = 0x40000000;
  35. tag->u.mem.size += SZ_2M;
  36. }
  37. }
  38. static void __init msm8x60_reserve(void)
  39. {
  40. memblock_remove(0x40000000, SZ_2M);
  41. }
  42. static void __init msm8x60_map_io(void)
  43. {
  44. msm_map_msm8x60_io();
  45. }
  46. #ifdef CONFIG_OF
  47. static struct of_device_id msm_dt_gic_match[] __initdata = {
  48. { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init },
  49. {}
  50. };
  51. #endif
  52. static void __init msm8x60_init_irq(void)
  53. {
  54. if (!of_have_populated_dt())
  55. gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
  56. (void *)MSM_QGIC_CPU_BASE);
  57. #ifdef CONFIG_OF
  58. else
  59. of_irq_init(msm_dt_gic_match);
  60. #endif
  61. /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
  62. writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
  63. /* RUMI does not adhere to GIC spec by enabling STIs by default.
  64. * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
  65. */
  66. if (!machine_is_msm8x60_sim())
  67. writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
  68. }
  69. static void __init msm8x60_init(void)
  70. {
  71. }
  72. static void __init msm8x60_init_late(void)
  73. {
  74. smd_debugfs_init();
  75. }
  76. #ifdef CONFIG_OF
  77. static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
  78. {}
  79. };
  80. static void __init msm8x60_dt_init(void)
  81. {
  82. if (of_machine_is_compatible("qcom,msm8660-surf")) {
  83. printk(KERN_INFO "Init surf UART registers\n");
  84. msm8x60_init_uart12dm();
  85. }
  86. of_platform_populate(NULL, of_default_bus_match_table,
  87. msm_auxdata_lookup, NULL);
  88. }
  89. static const char *msm8x60_fluid_match[] __initdata = {
  90. "qcom,msm8660-fluid",
  91. "qcom,msm8660-surf",
  92. NULL
  93. };
  94. #endif /* CONFIG_OF */
  95. MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
  96. .fixup = msm8x60_fixup,
  97. .reserve = msm8x60_reserve,
  98. .map_io = msm8x60_map_io,
  99. .init_irq = msm8x60_init_irq,
  100. .handle_irq = gic_handle_irq,
  101. .init_machine = msm8x60_init,
  102. .init_late = msm8x60_init_late,
  103. .timer = &msm_timer,
  104. MACHINE_END
  105. MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
  106. .fixup = msm8x60_fixup,
  107. .reserve = msm8x60_reserve,
  108. .map_io = msm8x60_map_io,
  109. .init_irq = msm8x60_init_irq,
  110. .handle_irq = gic_handle_irq,
  111. .init_machine = msm8x60_init,
  112. .init_late = msm8x60_init_late,
  113. .timer = &msm_timer,
  114. MACHINE_END
  115. MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
  116. .fixup = msm8x60_fixup,
  117. .reserve = msm8x60_reserve,
  118. .map_io = msm8x60_map_io,
  119. .init_irq = msm8x60_init_irq,
  120. .handle_irq = gic_handle_irq,
  121. .init_machine = msm8x60_init,
  122. .init_late = msm8x60_init_late,
  123. .timer = &msm_timer,
  124. MACHINE_END
  125. MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
  126. .fixup = msm8x60_fixup,
  127. .reserve = msm8x60_reserve,
  128. .map_io = msm8x60_map_io,
  129. .init_irq = msm8x60_init_irq,
  130. .handle_irq = gic_handle_irq,
  131. .init_machine = msm8x60_init,
  132. .init_late = msm8x60_init_late,
  133. .timer = &msm_timer,
  134. MACHINE_END
  135. #ifdef CONFIG_OF
  136. /* TODO: General device tree support for all MSM. */
  137. DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
  138. .map_io = msm8x60_map_io,
  139. .init_irq = msm8x60_init_irq,
  140. .init_machine = msm8x60_dt_init,
  141. .init_late = msm8x60_init_late,
  142. .timer = &msm_timer,
  143. .dt_compat = msm8x60_fluid_match,
  144. MACHINE_END
  145. #endif /* CONFIG_OF */