tegra.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * NVIDIA Tegra SoC device tree board support
  4. *
  5. * Copyright (C) 2011, 2013, NVIDIA Corporation
  6. * Copyright (C) 2010 Secret Lab Technologies, Ltd.
  7. * Copyright (C) 2010 Google, Inc.
  8. */
  9. #include <linux/clk.h>
  10. #include <linux/clk/tegra.h>
  11. #include <linux/dma-mapping.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <linux/irqchip.h>
  15. #include <linux/irqdomain.h>
  16. #include <linux/kernel.h>
  17. #include <linux/of_address.h>
  18. #include <linux/of_fdt.h>
  19. #include <linux/of.h>
  20. #include <linux/of_platform.h>
  21. #include <linux/pda_power.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/serial_8250.h>
  24. #include <linux/slab.h>
  25. #include <linux/sys_soc.h>
  26. #include <linux/usb/tegra_usb_phy.h>
  27. #include <linux/firmware/trusted_foundations.h>
  28. #include <soc/tegra/fuse.h>
  29. #include <soc/tegra/pmc.h>
  30. #include <asm/firmware.h>
  31. #include <asm/hardware/cache-l2x0.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/time.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/psci.h>
  36. #include <asm/setup.h>
  37. #include "board.h"
  38. #include "common.h"
  39. #include "iomap.h"
  40. #include "pm.h"
  41. #include "reset.h"
  42. #include "sleep.h"
  43. /*
  44. * Storage for debug-macro.S's state.
  45. *
  46. * This must be in .data not .bss so that it gets initialized each time the
  47. * kernel is loaded. The data is declared here rather than debug-macro.S so
  48. * that multiple inclusions of debug-macro.S point at the same data.
  49. */
  50. u32 tegra_uart_config[3] = {
  51. /* Debug UART initialization required */
  52. 1,
  53. /* Debug UART physical address */
  54. 0,
  55. /* Debug UART virtual address */
  56. 0,
  57. };
  58. static void __init tegra_init_early(void)
  59. {
  60. of_register_trusted_foundations();
  61. tegra_cpu_reset_handler_init();
  62. call_firmware_op(l2x0_init);
  63. }
  64. static void __init tegra_dt_init_irq(void)
  65. {
  66. tegra_init_irq();
  67. irqchip_init();
  68. }
  69. static void __init tegra_dt_init(void)
  70. {
  71. struct device *parent = tegra_soc_device_register();
  72. of_platform_default_populate(NULL, NULL, parent);
  73. }
  74. static void __init tegra_dt_init_late(void)
  75. {
  76. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
  77. of_machine_is_compatible("compal,paz00"))
  78. tegra_paz00_wifikill_init();
  79. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
  80. of_machine_is_compatible("nvidia,tegra20"))
  81. platform_device_register_simple("tegra20-cpufreq", -1, NULL, 0);
  82. if (IS_ENABLED(CONFIG_ARM_TEGRA_CPUIDLE) && !psci_smp_available())
  83. platform_device_register_simple("tegra-cpuidle", -1, NULL, 0);
  84. if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) &&
  85. of_machine_is_compatible("nvidia,tegra30"))
  86. platform_device_register_simple("tegra20-cpufreq", -1, NULL, 0);
  87. }
  88. static const char * const tegra_dt_board_compat[] = {
  89. "nvidia,tegra124",
  90. "nvidia,tegra114",
  91. "nvidia,tegra30",
  92. "nvidia,tegra20",
  93. NULL
  94. };
  95. DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
  96. .l2c_aux_val = 0x3c400000,
  97. .l2c_aux_mask = 0xc20fc3ff,
  98. .smp = smp_ops(tegra_smp_ops),
  99. .map_io = tegra_map_common_io,
  100. .init_early = tegra_init_early,
  101. .init_irq = tegra_dt_init_irq,
  102. .init_machine = tegra_dt_init,
  103. .init_late = tegra_dt_init_late,
  104. .dt_compat = tegra_dt_board_compat,
  105. MACHINE_END