board-samarium.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* Copyright (c) 2013, The Linux Foundation. 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/err.h>
  13. #include <linux/kernel.h>
  14. #include <linux/of.h>
  15. #include <linux/of_address.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/memory.h>
  18. #include <linux/msm_tsens.h>
  19. #include <asm/hardware/gic.h>
  20. #include <asm/mach/map.h>
  21. #include <asm/mach/arch.h>
  22. #include <mach/board.h>
  23. #include <mach/gpiomux.h>
  24. #include <mach/msm_iomap.h>
  25. #include <mach/msm_memtypes.h>
  26. #include <mach/restart.h>
  27. #include <mach/socinfo.h>
  28. #include <mach/clk-provider.h>
  29. #include <mach/msm_smem.h>
  30. #include <mach/msm_smd.h>
  31. #include "board-dt.h"
  32. #include "clock.h"
  33. #include "devices.h"
  34. #include "platsmp.h"
  35. #include "modem_notifier.h"
  36. static struct clk_lookup msm_clocks_dummy[] = {
  37. CLK_DUMMY("xo", CXO_CLK, "fc880000.qcom,mss", OFF),
  38. CLK_DUMMY("bus_clk", MSS_BIMC_Q6_CLK, "fc880000.qcom,mss", OFF),
  39. CLK_DUMMY("iface_clk", MSS_CFG_AHB_CLK, "fc880000.qcom,mss", OFF),
  40. CLK_DUMMY("mem_clk", BOOT_ROM_AHB_CLK, "fc880000.qcom,mss", OFF),
  41. CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
  42. CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF),
  43. CLK_DUMMY("core_clk", SDC1_CLK, "msm_sdcc.1", OFF),
  44. CLK_DUMMY("iface_clk", SDC1_P_CLK, "msm_sdcc.1", OFF),
  45. CLK_DUMMY("core_clk", SDC2_CLK, "msm_sdcc.2", OFF),
  46. CLK_DUMMY("iface_clk", SDC2_P_CLK, "msm_sdcc.2", OFF),
  47. CLK_DUMMY("core_clk", USB_HS_SYSTEM_CLK, "msm_otg", OFF),
  48. CLK_DUMMY("iface_clk", USB_HS_AHB_CLK, "msm_otg", OFF),
  49. CLK_DUMMY("xo", CXO_OTG_CLK, "msm_otg", OFF),
  50. CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF),
  51. CLK_DUMMY("dma_bam_pclk", DMA_BAM_P_CLK, "msm_sps", OFF),
  52. };
  53. static struct clock_init_data msm_dummy_clock_init_data __initdata = {
  54. .table = msm_clocks_dummy,
  55. .size = ARRAY_SIZE(msm_clocks_dummy),
  56. };
  57. static struct of_dev_auxdata msmsamarium_auxdata_lookup[] __initdata = {
  58. OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF9824000, \
  59. "msm_sdcc.1", NULL),
  60. OF_DEV_AUXDATA("qcom,msm-sdcc", 0xF98A4000, \
  61. "msm_sdcc.2", NULL),
  62. OF_DEV_AUXDATA("qcom,hsusb-otg", 0xF9A55000, \
  63. "msm_otg", NULL),
  64. {},
  65. };
  66. static struct memtype_reserve msmsamarium_reserve_table[] __initdata = {
  67. [MEMTYPE_SMI] = {
  68. },
  69. [MEMTYPE_EBI0] = {
  70. .flags = MEMTYPE_FLAGS_1M_ALIGN,
  71. },
  72. [MEMTYPE_EBI1] = {
  73. .flags = MEMTYPE_FLAGS_1M_ALIGN,
  74. },
  75. };
  76. static int msmsamarium_paddr_to_memtype(phys_addr_t paddr)
  77. {
  78. return MEMTYPE_EBI1;
  79. }
  80. static struct reserve_info msmsamarium_reserve_info __initdata = {
  81. .memtype_reserve_table = msmsamarium_reserve_table,
  82. .paddr_to_memtype = msmsamarium_paddr_to_memtype,
  83. };
  84. void __init msmsamarium_reserve(void)
  85. {
  86. reserve_info = &msmsamarium_reserve_info;
  87. of_scan_flat_dt(dt_scan_for_memory_reserve, msmsamarium_reserve_table);
  88. msm_reserve();
  89. }
  90. static void __init msmsamarium_early_memory(void)
  91. {
  92. reserve_info = &msmsamarium_reserve_info;
  93. of_scan_flat_dt(dt_scan_for_memory_hole, msmsamarium_reserve_table);
  94. }
  95. /*
  96. * Used to satisfy dependencies for devices that need to be
  97. * run early or in a particular order. Most likely your device doesn't fall
  98. * into this category, and thus the driver should not be added here. The
  99. * EPROBE_DEFER can satisfy most dependency problems.
  100. */
  101. void __init msmsamarium_add_drivers(void)
  102. {
  103. msm_smem_init();
  104. msm_init_modem_notifier_list();
  105. msm_smd_init();
  106. msm_clock_init(&msm_dummy_clock_init_data);
  107. tsens_tm_init_driver();
  108. }
  109. static void __init msmsamarium_map_io(void)
  110. {
  111. msm_map_msmsamarium_io();
  112. }
  113. void __init msmsamarium_init(void)
  114. {
  115. struct of_dev_auxdata *adata = msmsamarium_auxdata_lookup;
  116. if (socinfo_init() < 0)
  117. pr_err("%s: socinfo_init() failed\n", __func__);
  118. msmsamarium_init_gpiomux();
  119. board_dt_populate(adata);
  120. msmsamarium_add_drivers();
  121. }
  122. void __init msmsamarium_init_very_early(void)
  123. {
  124. msmsamarium_early_memory();
  125. }
  126. static const char *msmsamarium_dt_match[] __initconst = {
  127. "qcom,msmsamarium",
  128. NULL
  129. };
  130. DT_MACHINE_START(MSMSAMARIUM_DT, "Qualcomm MSM Samarium(Flattened Device Tree)")
  131. .map_io = msmsamarium_map_io,
  132. .init_irq = msm_dt_init_irq,
  133. .init_machine = msmsamarium_init,
  134. .handle_irq = gic_handle_irq,
  135. .timer = &msm_dt_timer,
  136. .dt_compat = msmsamarium_dt_match,
  137. .reserve = msmsamarium_reserve,
  138. .init_very_early = msmsamarium_init_very_early,
  139. .restart = msm_restart,
  140. .smp = &msm8974_smp_ops,
  141. MACHINE_END