mach-s3c64xx-dt.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Samsung's S3C64XX flattened device tree enabled machine
  3. *
  4. * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/clk-provider.h>
  11. #include <linux/irqchip.h>
  12. #include <linux/of_platform.h>
  13. #include <asm/mach/arch.h>
  14. #include <asm/mach/map.h>
  15. #include <asm/system_misc.h>
  16. #include <plat/cpu.h>
  17. #include <plat/watchdog-reset.h>
  18. #include <mach/map.h>
  19. #include "common.h"
  20. /*
  21. * IO mapping for shared system controller IP.
  22. *
  23. * FIXME: Make remaining drivers use dynamic mapping.
  24. */
  25. static struct map_desc s3c64xx_dt_iodesc[] __initdata = {
  26. {
  27. .virtual = (unsigned long)S3C_VA_SYS,
  28. .pfn = __phys_to_pfn(S3C64XX_PA_SYSCON),
  29. .length = SZ_4K,
  30. .type = MT_DEVICE,
  31. },
  32. };
  33. static void __init s3c64xx_dt_map_io(void)
  34. {
  35. debug_ll_io_init();
  36. iotable_init(s3c64xx_dt_iodesc, ARRAY_SIZE(s3c64xx_dt_iodesc));
  37. s3c64xx_init_cpu();
  38. if (!soc_is_s3c64xx())
  39. panic("SoC is not S3C64xx!");
  40. }
  41. static void __init s3c64xx_dt_init_irq(void)
  42. {
  43. of_clk_init(NULL);
  44. samsung_wdt_reset_of_init();
  45. irqchip_init();
  46. };
  47. static void __init s3c64xx_dt_init_machine(void)
  48. {
  49. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  50. }
  51. static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
  52. {
  53. if (mode != REBOOT_SOFT)
  54. samsung_wdt_reset();
  55. /* if all else fails, or mode was for soft, jump to 0 */
  56. soft_restart(0);
  57. }
  58. static char const *s3c64xx_dt_compat[] __initdata = {
  59. "samsung,s3c6400",
  60. "samsung,s3c6410",
  61. NULL
  62. };
  63. DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)")
  64. /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
  65. .dt_compat = s3c64xx_dt_compat,
  66. .map_io = s3c64xx_dt_map_io,
  67. .init_irq = s3c64xx_dt_init_irq,
  68. .init_machine = s3c64xx_dt_init_machine,
  69. .restart = s3c64xx_dt_restart,
  70. MACHINE_END