mach-exynos5-dt.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/io.h>
  14. #include <asm/mach/arch.h>
  15. #include <mach/regs-pmu.h>
  16. #include <plat/mfc.h>
  17. #include "common.h"
  18. static void __init exynos5_dt_machine_init(void)
  19. {
  20. struct device_node *i2c_np;
  21. const char *i2c_compat = "samsung,s3c2440-i2c";
  22. unsigned int tmp;
  23. /*
  24. * Exynos5's legacy i2c controller and new high speed i2c
  25. * controller have muxed interrupt sources. By default the
  26. * interrupts for 4-channel HS-I2C controller are enabled.
  27. * If node for first four channels of legacy i2c controller
  28. * are available then re-configure the interrupts via the
  29. * system register.
  30. */
  31. for_each_compatible_node(i2c_np, NULL, i2c_compat) {
  32. if (of_device_is_available(i2c_np)) {
  33. if (of_alias_get_id(i2c_np, "i2c") < 4) {
  34. tmp = readl(EXYNOS5_SYS_I2C_CFG);
  35. writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
  36. EXYNOS5_SYS_I2C_CFG);
  37. }
  38. }
  39. }
  40. exynos_cpuidle_init();
  41. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  42. }
  43. static char const *exynos5_dt_compat[] __initdata = {
  44. "samsung,exynos5250",
  45. "samsung,exynos5420",
  46. "samsung,exynos5440",
  47. NULL
  48. };
  49. static void __init exynos5_reserve(void)
  50. {
  51. #ifdef CONFIG_S5P_DEV_MFC
  52. struct s5p_mfc_dt_meminfo mfc_mem;
  53. /* Reserve memory for MFC only if it's available */
  54. mfc_mem.compatible = "samsung,mfc-v6";
  55. if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
  56. s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
  57. mfc_mem.lsize);
  58. #endif
  59. }
  60. DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
  61. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  62. .smp = smp_ops(exynos_smp_ops),
  63. .map_io = exynos_init_io,
  64. .init_machine = exynos5_dt_machine_init,
  65. .init_late = exynos_init_late,
  66. .dt_compat = exynos5_dt_compat,
  67. .restart = exynos5_restart,
  68. .reserve = exynos5_reserve,
  69. MACHINE_END