/arch/arm/mach-msm/board-dt.c

https://github.com/AICP/kernel_google_msm · C · 90 lines · 67 code · 12 blank · 11 comment · 7 complexity · c10c59f06d16e9456a8947458809994c MD5 · raw file

  1. /* Copyright (c) 2011-2012, 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/kernel.h>
  13. #include <linux/errno.h>
  14. #include <linux/of.h>
  15. #include <linux/of_address.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/of_fdt.h>
  18. #include <linux/of_irq.h>
  19. #include <asm/hardware/gic.h>
  20. #include <asm/arch_timer.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/time.h>
  23. #include <mach/socinfo.h>
  24. #include <mach/board.h>
  25. static void __init msm_dt_timer_init(void)
  26. {
  27. arch_timer_of_register();
  28. }
  29. static struct sys_timer msm_dt_timer = {
  30. .init = msm_dt_timer_init
  31. };
  32. static void __init msm_dt_init_irq(void)
  33. {
  34. if (machine_is_msm8974())
  35. msm_8974_init_irq();
  36. }
  37. static void __init msm_dt_map_io(void)
  38. {
  39. if (early_machine_is_msm8974())
  40. msm_map_8974_io();
  41. if (socinfo_init() < 0)
  42. pr_err("%s: socinfo_init() failed\n", __func__);
  43. }
  44. static void __init msm_dt_init(void)
  45. {
  46. struct of_dev_auxdata *adata = NULL;
  47. if (machine_is_msm8974())
  48. msm_8974_init(&adata);
  49. of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
  50. if (machine_is_msm8974()) {
  51. msm_8974_add_devices();
  52. msm_8974_add_drivers();
  53. }
  54. }
  55. static const char *msm_dt_match[] __initconst = {
  56. "qcom,msm8974",
  57. NULL
  58. };
  59. static void __init msm_dt_reserve(void)
  60. {
  61. if (early_machine_is_msm8974())
  62. msm_8974_reserve();
  63. }
  64. static void __init msm_dt_init_very_early(void)
  65. {
  66. if (early_machine_is_msm8974())
  67. msm_8974_very_early();
  68. }
  69. DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
  70. .map_io = msm_dt_map_io,
  71. .init_irq = msm_dt_init_irq,
  72. .init_machine = msm_dt_init,
  73. .handle_irq = gic_handle_irq,
  74. .timer = &msm_dt_timer,
  75. .dt_compat = msm_dt_match,
  76. .reserve = msm_dt_reserve,
  77. .init_very_early = msm_dt_init_very_early,
  78. MACHINE_END