tegra.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 "iomap.h"
  48. #include "irq.h"
  49. #include "pm.h"
  50. #include "reset.h"
  51. #include "sleep.h"
  52. /*
  53. * Storage for debug-macro.S's state.
  54. *
  55. * This must be in .data not .bss so that it gets initialized each time the
  56. * kernel is loaded. The data is declared here rather than debug-macro.S so
  57. * that multiple inclusions of debug-macro.S point at the same data.
  58. */
  59. u32 tegra_uart_config[3] = {
  60. /* Debug UART initialization required */
  61. 1,
  62. /* Debug UART physical address */
  63. 0,
  64. /* Debug UART virtual address */
  65. 0,
  66. };
  67. static void __init tegra_init_early(void)
  68. {
  69. of_register_trusted_foundations();
  70. tegra_cpu_reset_handler_init();
  71. }
  72. static void __init tegra_dt_init_irq(void)
  73. {
  74. tegra_init_irq();
  75. irqchip_init();
  76. }
  77. static void __init tegra_dt_init(void)
  78. {
  79. struct soc_device_attribute *soc_dev_attr;
  80. struct soc_device *soc_dev;
  81. struct device *parent = NULL;
  82. soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
  83. if (!soc_dev_attr)
  84. goto out;
  85. soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
  86. soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
  87. tegra_sku_info.revision);
  88. soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
  89. soc_dev = soc_device_register(soc_dev_attr);
  90. if (IS_ERR(soc_dev)) {
  91. kfree(soc_dev_attr->family);
  92. kfree(soc_dev_attr->revision);
  93. kfree(soc_dev_attr->soc_id);
  94. kfree(soc_dev_attr);
  95. goto out;
  96. }
  97. parent = soc_device_to_device(soc_dev);
  98. /*
  99. * Finished with the static registrations now; fill in the missing
  100. * devices
  101. */
  102. out:
  103. of_platform_default_populate(NULL, NULL, parent);
  104. }
  105. static void __init tegra_dt_init_late(void)
  106. {
  107. tegra_init_suspend();
  108. tegra_cpuidle_init();
  109. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
  110. of_machine_is_compatible("compal,paz00"))
  111. tegra_paz00_wifikill_init();
  112. }
  113. static const char * const tegra_dt_board_compat[] = {
  114. "nvidia,tegra124",
  115. "nvidia,tegra114",
  116. "nvidia,tegra30",
  117. "nvidia,tegra20",
  118. NULL
  119. };
  120. DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
  121. .l2c_aux_val = 0x3c400001,
  122. .l2c_aux_mask = 0xc20fc3fe,
  123. .smp = smp_ops(tegra_smp_ops),
  124. .map_io = tegra_map_common_io,
  125. .init_early = tegra_init_early,
  126. .init_irq = tegra_dt_init_irq,
  127. .init_machine = tegra_dt_init,
  128. .init_late = tegra_dt_init_late,
  129. .dt_compat = tegra_dt_board_compat,
  130. MACHINE_END