s5pv210.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Samsung's S5PC110/S5PV210 flattened device tree enabled machine.
  3. *
  4. * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
  5. * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
  6. * Tomasz Figa <t.figa@samsung.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/of_fdt.h>
  13. #include <linux/of_platform.h>
  14. #include <asm/mach/arch.h>
  15. #include <asm/mach/map.h>
  16. #include <asm/system_misc.h>
  17. #include <plat/map-base.h>
  18. #include "common.h"
  19. #include "regs-clock.h"
  20. static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
  21. int depth, void *data)
  22. {
  23. struct map_desc iodesc;
  24. const __be32 *reg;
  25. int len;
  26. if (!of_flat_dt_is_compatible(node, "samsung,s5pv210-clock"))
  27. return 0;
  28. reg = of_get_flat_dt_prop(node, "reg", &len);
  29. if (reg == NULL || len != (sizeof(unsigned long) * 2))
  30. return 0;
  31. iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
  32. iodesc.length = be32_to_cpu(reg[1]) - 1;
  33. iodesc.virtual = (unsigned long)S3C_VA_SYS;
  34. iodesc.type = MT_DEVICE;
  35. iotable_init(&iodesc, 1);
  36. return 1;
  37. }
  38. static void __init s5pv210_dt_map_io(void)
  39. {
  40. debug_ll_io_init();
  41. of_scan_flat_dt(s5pv210_fdt_map_sys, NULL);
  42. }
  43. static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
  44. {
  45. __raw_writel(0x1, S5P_SWRESET);
  46. }
  47. static void __init s5pv210_dt_init_late(void)
  48. {
  49. platform_device_register_simple("s5pv210-cpufreq", -1, NULL, 0);
  50. s5pv210_pm_init();
  51. }
  52. static char const *const s5pv210_dt_compat[] __initconst = {
  53. "samsung,s5pc110",
  54. "samsung,s5pv210",
  55. NULL
  56. };
  57. DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
  58. .dt_compat = s5pv210_dt_compat,
  59. .map_io = s5pv210_dt_map_io,
  60. .restart = s5pv210_dt_restart,
  61. .init_late = s5pv210_dt_init_late,
  62. MACHINE_END