mach-exynos4-dt.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Samsung's EXYNOS4 flattened device tree enabled machine
  3. *
  4. * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. * Copyright (c) 2010-2011 Linaro Ltd.
  7. * www.linaro.org
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/of_platform.h>
  14. #include <linux/serial_core.h>
  15. #include <asm/mach/arch.h>
  16. #include <asm/hardware/gic.h>
  17. #include <mach/map.h>
  18. #include <plat/cpu.h>
  19. #include <plat/regs-serial.h>
  20. #include "common.h"
  21. /*
  22. * The following lookup table is used to override device names when devices
  23. * are registered from device tree. This is temporarily added to enable
  24. * device tree support addition for the Exynos4 architecture.
  25. *
  26. * For drivers that require platform data to be provided from the machine
  27. * file, a platform data pointer can also be supplied along with the
  28. * devices names. Usually, the platform data elements that cannot be parsed
  29. * from the device tree by the drivers (example: function pointers) are
  30. * supplied. But it should be noted that this is a temporary mechanism and
  31. * at some point, the drivers should be capable of parsing all the platform
  32. * data from the device tree.
  33. */
  34. static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = {
  35. OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0,
  36. "exynos4210-uart.0", NULL),
  37. OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1,
  38. "exynos4210-uart.1", NULL),
  39. OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2,
  40. "exynos4210-uart.2", NULL),
  41. OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3,
  42. "exynos4210-uart.3", NULL),
  43. OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0),
  44. "exynos4-sdhci.0", NULL),
  45. OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(1),
  46. "exynos4-sdhci.1", NULL),
  47. OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(2),
  48. "exynos4-sdhci.2", NULL),
  49. OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(3),
  50. "exynos4-sdhci.3", NULL),
  51. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0),
  52. "s3c2440-i2c.0", NULL),
  53. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(1),
  54. "s3c2440-i2c.1", NULL),
  55. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(2),
  56. "s3c2440-i2c.2", NULL),
  57. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(3),
  58. "s3c2440-i2c.3", NULL),
  59. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(4),
  60. "s3c2440-i2c.4", NULL),
  61. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(5),
  62. "s3c2440-i2c.5", NULL),
  63. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(6),
  64. "s3c2440-i2c.6", NULL),
  65. OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(7),
  66. "s3c2440-i2c.7", NULL),
  67. OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0,
  68. "exynos4210-spi.0", NULL),
  69. OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1,
  70. "exynos4210-spi.1", NULL),
  71. OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI2,
  72. "exynos4210-spi.2", NULL),
  73. OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
  74. OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
  75. OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL),
  76. OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU,
  77. "exynos-tmu", NULL),
  78. {},
  79. };
  80. static void __init exynos4_dt_map_io(void)
  81. {
  82. exynos_init_io(NULL, 0);
  83. s3c24xx_init_clocks(24000000);
  84. }
  85. static void __init exynos4_dt_machine_init(void)
  86. {
  87. of_platform_populate(NULL, of_default_bus_match_table,
  88. exynos4_auxdata_lookup, NULL);
  89. }
  90. static char const *exynos4_dt_compat[] __initdata = {
  91. "samsung,exynos4210",
  92. "samsung,exynos4212",
  93. "samsung,exynos4412",
  94. NULL
  95. };
  96. DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
  97. /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */
  98. .smp = smp_ops(exynos_smp_ops),
  99. .init_irq = exynos4_init_irq,
  100. .map_io = exynos4_dt_map_io,
  101. .handle_irq = gic_handle_irq,
  102. .init_machine = exynos4_dt_machine_init,
  103. .init_late = exynos_init_late,
  104. .timer = &exynos4_timer,
  105. .dt_compat = exynos4_dt_compat,
  106. .restart = exynos4_restart,
  107. MACHINE_END