mach-exynos5-dt.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
  3. *
  4. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/of_platform.h>
  12. #include <linux/of_fdt.h>
  13. #include <linux/memblock.h>
  14. #include <linux/io.h>
  15. #include <linux/clocksource.h>
  16. #include <asm/mach/arch.h>
  17. #include <mach/regs-pmu.h>
  18. #include <plat/cpu.h>
  19. #include <plat/mfc.h>
  20. #include "common.h"
  21. static void __init exynos5_dt_machine_init(void)
  22. {
  23. struct device_node *i2c_np;
  24. const char *i2c_compat = "samsung,s3c2440-i2c";
  25. unsigned int tmp;
  26. /*
  27. * Exynos5's legacy i2c controller and new high speed i2c
  28. * controller have muxed interrupt sources. By default the
  29. * interrupts for 4-channel HS-I2C controller are enabled.
  30. * If node for first four channels of legacy i2c controller
  31. * are available then re-configure the interrupts via the
  32. * system register.
  33. */
  34. for_each_compatible_node(i2c_np, NULL, i2c_compat) {
  35. if (of_device_is_available(i2c_np)) {
  36. if (of_alias_get_id(i2c_np, "i2c") < 4) {
  37. tmp = readl(EXYNOS5_SYS_I2C_CFG);
  38. writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
  39. EXYNOS5_SYS_I2C_CFG);
  40. }
  41. }
  42. }
  43. exynos_cpuidle_init();
  44. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  45. }
  46. static char const *exynos5_dt_compat[] __initdata = {
  47. "samsung,exynos5250",
  48. "samsung,exynos5420",
  49. "samsung,exynos5440",
  50. NULL
  51. };
  52. static void __init exynos5_reserve(void)
  53. {
  54. #ifdef CONFIG_S5P_DEV_MFC
  55. struct s5p_mfc_dt_meminfo mfc_mem;
  56. /* Reserve memory for MFC only if it's available */
  57. mfc_mem.compatible = "samsung,mfc-v6";
  58. if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
  59. s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
  60. mfc_mem.lsize);
  61. #endif
  62. }
  63. DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
  64. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  65. .smp = smp_ops(exynos_smp_ops),
  66. .map_io = exynos_init_io,
  67. .init_machine = exynos5_dt_machine_init,
  68. .init_late = exynos_init_late,
  69. .init_time = exynos_init_time,
  70. .dt_compat = exynos5_dt_compat,
  71. .restart = exynos5_restart,
  72. .reserve = exynos5_reserve,
  73. MACHINE_END