board-dt-tegra20.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * nVidia Tegra device tree board support
  3. *
  4. * Copyright (C) 2010 Secret Lab Technologies, Ltd.
  5. * Copyright (C) 2010 Google, Inc.
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #include <linux/clocksource.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/serial_8250.h>
  22. #include <linux/clk.h>
  23. #include <linux/dma-mapping.h>
  24. #include <linux/irqdomain.h>
  25. #include <linux/of.h>
  26. #include <linux/of_address.h>
  27. #include <linux/of_fdt.h>
  28. #include <linux/of_platform.h>
  29. #include <linux/pda_power.h>
  30. #include <linux/platform_data/tegra_usb.h>
  31. #include <linux/io.h>
  32. #include <linux/usb/tegra_usb_phy.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/time.h>
  36. #include <asm/setup.h>
  37. #include "board.h"
  38. #include "common.h"
  39. #include "iomap.h"
  40. static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
  41. .operating_mode = TEGRA_USB_OTG,
  42. .power_down_on_bus_suspend = 1,
  43. .vbus_gpio = -1,
  44. };
  45. static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
  46. .reset_gpio = -1,
  47. .clk = "cdev2",
  48. };
  49. static struct tegra_ehci_platform_data tegra_ehci2_pdata = {
  50. .phy_config = &tegra_ehci2_ulpi_phy_config,
  51. .operating_mode = TEGRA_USB_HOST,
  52. .power_down_on_bus_suspend = 1,
  53. .vbus_gpio = -1,
  54. };
  55. static struct tegra_ehci_platform_data tegra_ehci3_pdata = {
  56. .operating_mode = TEGRA_USB_HOST,
  57. .power_down_on_bus_suspend = 1,
  58. .vbus_gpio = -1,
  59. };
  60. static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
  61. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5000000, "tegra-ehci.0",
  62. &tegra_ehci1_pdata),
  63. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5004000, "tegra-ehci.1",
  64. &tegra_ehci2_pdata),
  65. OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5008000, "tegra-ehci.2",
  66. &tegra_ehci3_pdata),
  67. {}
  68. };
  69. static void __init tegra_dt_init(void)
  70. {
  71. /*
  72. * Finished with the static registrations now; fill in the missing
  73. * devices
  74. */
  75. of_platform_populate(NULL, of_default_bus_match_table,
  76. tegra20_auxdata_lookup, NULL);
  77. }
  78. static void __init trimslice_init(void)
  79. {
  80. #ifdef CONFIG_TEGRA_PCI
  81. int ret;
  82. ret = tegra_pcie_init(true, true);
  83. if (ret)
  84. pr_err("tegra_pci_init() failed: %d\n", ret);
  85. #endif
  86. }
  87. static void __init harmony_init(void)
  88. {
  89. #ifdef CONFIG_TEGRA_PCI
  90. int ret;
  91. ret = harmony_pcie_init();
  92. if (ret)
  93. pr_err("harmony_pcie_init() failed: %d\n", ret);
  94. #endif
  95. }
  96. static void __init paz00_init(void)
  97. {
  98. tegra_paz00_wifikill_init();
  99. }
  100. static struct {
  101. char *machine;
  102. void (*init)(void);
  103. } board_init_funcs[] = {
  104. { "compulab,trimslice", trimslice_init },
  105. { "nvidia,harmony", harmony_init },
  106. { "compal,paz00", paz00_init },
  107. };
  108. static void __init tegra_dt_init_late(void)
  109. {
  110. int i;
  111. tegra_init_late();
  112. for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
  113. if (of_machine_is_compatible(board_init_funcs[i].machine)) {
  114. board_init_funcs[i].init();
  115. break;
  116. }
  117. }
  118. }
  119. static const char *tegra20_dt_board_compat[] = {
  120. "nvidia,tegra20",
  121. NULL
  122. };
  123. DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
  124. .map_io = tegra_map_common_io,
  125. .smp = smp_ops(tegra_smp_ops),
  126. .init_early = tegra20_init_early,
  127. .init_irq = tegra_dt_init_irq,
  128. .init_time = clocksource_of_init,
  129. .init_machine = tegra_dt_init,
  130. .init_late = tegra_dt_init_late,
  131. .restart = tegra_assert_system_reset,
  132. .dt_compat = tegra20_dt_board_compat,
  133. MACHINE_END