board-dt-tegra20.c 3.7 KB

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