mach-s3c2416-dt.c 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Samsung's S3C2416 flattened device tree enabled machine
  3. *
  4. * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
  5. *
  6. * based on mach-exynos/mach-exynos4-dt.c
  7. *
  8. * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  9. * http://www.samsung.com
  10. * Copyright (c) 2010-2011 Linaro Ltd.
  11. * www.linaro.org
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #include <linux/clocksource.h>
  18. #include <linux/irqchip.h>
  19. #include <linux/of_platform.h>
  20. #include <linux/serial_core.h>
  21. #include <asm/mach/arch.h>
  22. #include <mach/map.h>
  23. #include <plat/cpu.h>
  24. #include <plat/pm.h>
  25. #include <plat/regs-serial.h>
  26. #include "common.h"
  27. /*
  28. * The following lookup table is used to override device names when devices
  29. * are registered from device tree. This is temporarily added to enable
  30. * device tree support addition for the S3C2416 architecture.
  31. *
  32. * For drivers that require platform data to be provided from the machine
  33. * file, a platform data pointer can also be supplied along with the
  34. * devices names. Usually, the platform data elements that cannot be parsed
  35. * from the device tree by the drivers (example: function pointers) are
  36. * supplied. But it should be noted that this is a temporary mechanism and
  37. * at some point, the drivers should be capable of parsing all the platform
  38. * data from the device tree.
  39. */
  40. static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = {
  41. OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART,
  42. "s3c2440-uart.0", NULL),
  43. OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000,
  44. "s3c2440-uart.1", NULL),
  45. OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000,
  46. "s3c2440-uart.2", NULL),
  47. OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000,
  48. "s3c2440-uart.3", NULL),
  49. OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0,
  50. "s3c-sdhci.0", NULL),
  51. OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1,
  52. "s3c-sdhci.1", NULL),
  53. OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC,
  54. "s3c2440-i2c.0", NULL),
  55. {},
  56. };
  57. static void __init s3c2416_dt_map_io(void)
  58. {
  59. s3c24xx_init_io(NULL, 0);
  60. s3c24xx_init_clocks(12000000);
  61. }
  62. static void __init s3c2416_dt_machine_init(void)
  63. {
  64. of_platform_populate(NULL, of_default_bus_match_table,
  65. s3c2416_auxdata_lookup, NULL);
  66. s3c_pm_init();
  67. }
  68. static char const *s3c2416_dt_compat[] __initdata = {
  69. "samsung,s3c2416",
  70. "samsung,s3c2450",
  71. NULL
  72. };
  73. DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
  74. /* Maintainer: Heiko Stuebner <heiko@sntech.de> */
  75. .dt_compat = s3c2416_dt_compat,
  76. .map_io = s3c2416_dt_map_io,
  77. .init_irq = irqchip_init,
  78. .init_machine = s3c2416_dt_machine_init,
  79. .init_time = clocksource_of_init,
  80. .restart = s3c2416_restart,
  81. MACHINE_END