mach-mxs.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright 2012 Freescale Semiconductor, Inc.
  3. * Copyright 2012 Linaro Ltd.
  4. *
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #include <linux/clk.h>
  13. #include <linux/clkdev.h>
  14. #include <linux/err.h>
  15. #include <linux/init.h>
  16. #include <linux/init.h>
  17. #include <linux/irqdomain.h>
  18. #include <linux/of_irq.h>
  19. #include <linux/of_platform.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach/time.h>
  22. #include <mach/common.h>
  23. static int __init mxs_icoll_add_irq_domain(struct device_node *np,
  24. struct device_node *interrupt_parent)
  25. {
  26. irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL);
  27. return 0;
  28. }
  29. static const struct of_device_id mxs_irq_match[] __initconst = {
  30. { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, },
  31. { /* sentinel */ }
  32. };
  33. static void __init mxs_dt_init_irq(void)
  34. {
  35. icoll_init_irq();
  36. of_irq_init(mxs_irq_match);
  37. }
  38. static void __init imx23_timer_init(void)
  39. {
  40. mx23_clocks_init();
  41. }
  42. static struct sys_timer imx23_timer = {
  43. .init = imx23_timer_init,
  44. };
  45. static void __init imx28_timer_init(void)
  46. {
  47. mx28_clocks_init();
  48. }
  49. static struct sys_timer imx28_timer = {
  50. .init = imx28_timer_init,
  51. };
  52. static void __init imx28_evk_init(void)
  53. {
  54. struct clk *clk;
  55. /* Enable fec phy clock */
  56. clk = clk_get_sys("enet_out", NULL);
  57. if (!IS_ERR(clk))
  58. clk_prepare_enable(clk);
  59. }
  60. static void __init mxs_machine_init(void)
  61. {
  62. if (of_machine_is_compatible("fsl,imx28-evk"))
  63. imx28_evk_init();
  64. of_platform_populate(NULL, of_default_bus_match_table,
  65. NULL, NULL);
  66. }
  67. static const char *imx23_dt_compat[] __initdata = {
  68. "fsl,imx23-evk",
  69. "fsl,imx23",
  70. NULL,
  71. };
  72. static const char *imx28_dt_compat[] __initdata = {
  73. "fsl,imx28-evk",
  74. "fsl,imx28",
  75. NULL,
  76. };
  77. DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
  78. .map_io = mx23_map_io,
  79. .init_irq = mxs_dt_init_irq,
  80. .timer = &imx23_timer,
  81. .init_machine = mxs_machine_init,
  82. .dt_compat = imx23_dt_compat,
  83. .restart = mxs_restart,
  84. MACHINE_END
  85. DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
  86. .map_io = mx28_map_io,
  87. .init_irq = mxs_dt_init_irq,
  88. .timer = &imx28_timer,
  89. .init_machine = mxs_machine_init,
  90. .dt_compat = imx28_dt_compat,
  91. .restart = mxs_restart,
  92. MACHINE_END