tegra.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * NVIDIA Tegra SoC device tree board support
  3. *
  4. * Copyright (C) 2011, 2013, NVIDIA Corporation
  5. * Copyright (C) 2010 Secret Lab Technologies, Ltd.
  6. * Copyright (C) 2010 Google, Inc.
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #include <linux/clk.h>
  19. #include <linux/clk/tegra.h>
  20. #include <linux/dma-mapping.h>
  21. #include <linux/init.h>
  22. #include <linux/io.h>
  23. #include <linux/irqchip.h>
  24. #include <linux/irqdomain.h>
  25. #include <linux/kernel.h>
  26. #include <linux/of_address.h>
  27. #include <linux/of_fdt.h>
  28. #include <linux/of.h>
  29. #include <linux/of_platform.h>
  30. #include <linux/pda_power.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/serial_8250.h>
  33. #include <linux/slab.h>
  34. #include <linux/sys_soc.h>
  35. #include <linux/usb/tegra_usb_phy.h>
  36. #include <soc/tegra/fuse.h>
  37. #include <soc/tegra/pmc.h>
  38. #include <asm/hardware/cache-l2x0.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/time.h>
  41. #include <asm/mach-types.h>
  42. #include <asm/setup.h>
  43. #include <asm/trusted_foundations.h>
  44. #include "board.h"
  45. #include "common.h"
  46. #include "cpuidle.h"
  47. #include "flowctrl.h"
  48. #include "iomap.h"
  49. #include "irq.h"
  50. #include "pm.h"
  51. #include "reset.h"
  52. #include "sleep.h"
  53. /*
  54. * Storage for debug-macro.S's state.
  55. *
  56. * This must be in .data not .bss so that it gets initialized each time the
  57. * kernel is loaded. The data is declared here rather than debug-macro.S so
  58. * that multiple inclusions of debug-macro.S point at the same data.
  59. */
  60. u32 tegra_uart_config[3] = {
  61. /* Debug UART initialization required */
  62. 1,
  63. /* Debug UART physical address */
  64. 0,
  65. /* Debug UART virtual address */
  66. 0,
  67. };
  68. static void __init tegra_init_early(void)
  69. {
  70. of_register_trusted_foundations();
  71. tegra_cpu_reset_handler_init();
  72. tegra_flowctrl_init();
  73. }
  74. static void __init tegra_dt_init_irq(void)
  75. {
  76. tegra_init_irq();
  77. irqchip_init();
  78. }
  79. static void __init tegra_dt_init(void)
  80. {
  81. struct soc_device_attribute *soc_dev_attr;
  82. struct soc_device *soc_dev;
  83. struct device *parent = NULL;
  84. soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
  85. if (!soc_dev_attr)
  86. goto out;
  87. soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
  88. soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
  89. tegra_sku_info.revision);
  90. soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
  91. soc_dev = soc_device_register(soc_dev_attr);
  92. if (IS_ERR(soc_dev)) {
  93. kfree(soc_dev_attr->family);
  94. kfree(soc_dev_attr->revision);
  95. kfree(soc_dev_attr->soc_id);
  96. kfree(soc_dev_attr);
  97. goto out;
  98. }
  99. parent = soc_device_to_device(soc_dev);
  100. /*
  101. * Finished with the static registrations now; fill in the missing
  102. * devices
  103. */
  104. out:
  105. of_platform_default_populate(NULL, NULL, parent);
  106. }
  107. static void __init tegra_dt_init_late(void)
  108. {
  109. tegra_init_suspend();
  110. tegra_cpuidle_init();
  111. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
  112. of_machine_is_compatible("compal,paz00"))
  113. tegra_paz00_wifikill_init();
  114. }
  115. static const char * const tegra_dt_board_compat[] = {
  116. "nvidia,tegra124",
  117. "nvidia,tegra114",
  118. "nvidia,tegra30",
  119. "nvidia,tegra20",
  120. NULL
  121. };
  122. DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
  123. .l2c_aux_val = 0x3c400001,
  124. .l2c_aux_mask = 0xc20fc3fe,
  125. .smp = smp_ops(tegra_smp_ops),
  126. .map_io = tegra_map_common_io,
  127. .init_early = tegra_init_early,
  128. .init_irq = tegra_dt_init_irq,
  129. .init_machine = tegra_dt_init,
  130. .init_late = tegra_dt_init_late,
  131. .dt_compat = tegra_dt_board_compat,
  132. MACHINE_END