tegra.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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/clocksource.h>
  19. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/serial_8250.h>
  23. #include <linux/clk.h>
  24. #include <linux/dma-mapping.h>
  25. #include <linux/irqdomain.h>
  26. #include <linux/of.h>
  27. #include <linux/of_address.h>
  28. #include <linux/of_fdt.h>
  29. #include <linux/of_platform.h>
  30. #include <linux/pda_power.h>
  31. #include <linux/platform_data/tegra_usb.h>
  32. #include <linux/io.h>
  33. #include <linux/i2c.h>
  34. #include <linux/i2c-tegra.h>
  35. #include <linux/usb/tegra_usb_phy.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/time.h>
  39. #include <asm/setup.h>
  40. #include "board.h"
  41. #include "common.h"
  42. #include "iomap.h"
  43. static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
  44. .operating_mode = TEGRA_USB_OTG,
  45. .power_down_on_bus_suspend = 1,
  46. .vbus_gpio = -1,
  47. };
  48. static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
  49. .reset_gpio = -1,
  50. .clk = "cdev2",
  51. };
  52. static struct tegra_ehci_platform_data tegra_ehci2_pdata = {
  53. .phy_config = &tegra_ehci2_ulpi_phy_config,
  54. .operating_mode = TEGRA_USB_HOST,
  55. .power_down_on_bus_suspend = 1,
  56. .vbus_gpio = -1,
  57. };
  58. static struct tegra_ehci_platform_data tegra_ehci3_pdata = {
  59. .operating_mode = TEGRA_USB_HOST,
  60. .power_down_on_bus_suspend = 1,
  61. .vbus_gpio = -1,
  62. };
  63. static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
  64. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5000000, "tegra-ehci.0",
  65. &tegra_ehci1_pdata),
  66. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5004000, "tegra-ehci.1",
  67. &tegra_ehci2_pdata),
  68. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5008000, "tegra-ehci.2",
  69. &tegra_ehci3_pdata),
  70. {}
  71. };
  72. static void __init tegra_dt_init(void)
  73. {
  74. /*
  75. * Finished with the static registrations now; fill in the missing
  76. * devices
  77. */
  78. of_platform_populate(NULL, of_default_bus_match_table,
  79. tegra20_auxdata_lookup, NULL);
  80. }
  81. static void __init trimslice_init(void)
  82. {
  83. #ifdef CONFIG_TEGRA_PCI
  84. int ret;
  85. ret = tegra_pcie_init(true, true);
  86. if (ret)
  87. pr_err("tegra_pci_init() failed: %d\n", ret);
  88. #endif
  89. }
  90. static void __init harmony_init(void)
  91. {
  92. #ifdef CONFIG_TEGRA_PCI
  93. int ret;
  94. ret = harmony_pcie_init();
  95. if (ret)
  96. pr_err("harmony_pcie_init() failed: %d\n", ret);
  97. #endif
  98. }
  99. static void __init paz00_init(void)
  100. {
  101. if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
  102. tegra_paz00_wifikill_init();
  103. }
  104. static struct {
  105. char *machine;
  106. void (*init)(void);
  107. } board_init_funcs[] = {
  108. { "compulab,trimslice", trimslice_init },
  109. { "nvidia,harmony", harmony_init },
  110. { "compal,paz00", paz00_init },
  111. };
  112. static void __init tegra_dt_init_late(void)
  113. {
  114. int i;
  115. tegra_init_late();
  116. for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
  117. if (of_machine_is_compatible(board_init_funcs[i].machine)) {
  118. board_init_funcs[i].init();
  119. break;
  120. }
  121. }
  122. }
  123. static const char * const tegra_dt_board_compat[] = {
  124. "nvidia,tegra114",
  125. "nvidia,tegra30",
  126. "nvidia,tegra20",
  127. NULL
  128. };
  129. DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
  130. .map_io = tegra_map_common_io,
  131. .smp = smp_ops(tegra_smp_ops),
  132. .init_early = tegra_init_early,
  133. .init_irq = tegra_dt_init_irq,
  134. .init_time = clocksource_of_init,
  135. .init_machine = tegra_dt_init,
  136. .init_late = tegra_dt_init_late,
  137. .restart = tegra_assert_system_reset,
  138. .dt_compat = tegra_dt_board_compat,
  139. MACHINE_END