s5pv210.c 1.7 KB

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