2 * NVIDIA Tegra SoC device tree board support
4 * Copyright (C) 2011, 2013, NVIDIA Corporation
5 * Copyright (C) 2010 Secret Lab Technologies, Ltd.
6 * Copyright (C) 2010 Google, Inc.
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.
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.
19 #include <linux/clocksource.h>
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/serial_8250.h>
24 #include <linux/clk.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/irqdomain.h>
28 #include <linux/of_address.h>
29 #include <linux/of_fdt.h>
30 #include <linux/of_platform.h>
31 #include <linux/pda_power.h>
32 #include <linux/platform_data/tegra_usb.h>
34 #include <linux/i2c.h>
35 #include <linux/i2c-tegra.h>
36 #include <linux/slab.h>
37 #include <linux/sys_soc.h>
38 #include <linux/usb/tegra_usb_phy.h>
40 #include <asm/mach-types.h>
41 #include <asm/mach/arch.h>
42 #include <asm/mach/time.h>
43 #include <asm/setup.h>
50 static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
51 .operating_mode = TEGRA_USB_OTG,
52 .power_down_on_bus_suspend = 1,
56 static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
61 static struct tegra_ehci_platform_data tegra_ehci2_pdata = {
62 .phy_config = &tegra_ehci2_ulpi_phy_config,
63 .operating_mode = TEGRA_USB_HOST,
64 .power_down_on_bus_suspend = 1,
68 static struct tegra_ehci_platform_data tegra_ehci3_pdata = {
69 .operating_mode = TEGRA_USB_HOST,
70 .power_down_on_bus_suspend = 1,
74 static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
75 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5000000, "tegra-ehci.0",
77 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5004000, "tegra-ehci.1",
79 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5008000, "tegra-ehci.2",
84 static void __init tegra_dt_init(void)
86 struct soc_device_attribute *soc_dev_attr;
87 struct soc_device *soc_dev;
88 struct device *parent = NULL;
90 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
94 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
95 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_revision);
96 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%d", tegra_chip_id);
98 soc_dev = soc_device_register(soc_dev_attr);
99 if (IS_ERR(soc_dev)) {
100 kfree(soc_dev_attr->family);
101 kfree(soc_dev_attr->revision);
102 kfree(soc_dev_attr->soc_id);
107 parent = soc_device_to_device(soc_dev);
110 * Finished with the static registrations now; fill in the missing
114 of_platform_populate(NULL, of_default_bus_match_table,
115 tegra20_auxdata_lookup, parent);
118 static void __init trimslice_init(void)
120 #ifdef CONFIG_TEGRA_PCI
123 ret = tegra_pcie_init(true, true);
125 pr_err("tegra_pci_init() failed: %d\n", ret);
129 static void __init harmony_init(void)
131 #ifdef CONFIG_TEGRA_PCI
134 ret = harmony_pcie_init();
136 pr_err("harmony_pcie_init() failed: %d\n", ret);
140 static void __init paz00_init(void)
142 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
143 tegra_paz00_wifikill_init();
149 } board_init_funcs[] = {
150 { "compulab,trimslice", trimslice_init },
151 { "nvidia,harmony", harmony_init },
152 { "compal,paz00", paz00_init },
155 static void __init tegra_dt_init_late(void)
161 for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
162 if (of_machine_is_compatible(board_init_funcs[i].machine)) {
163 board_init_funcs[i].init();
169 static const char * const tegra_dt_board_compat[] = {
176 DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
177 .map_io = tegra_map_common_io,
178 .smp = smp_ops(tegra_smp_ops),
179 .init_early = tegra_init_early,
180 .init_irq = tegra_dt_init_irq,
181 .init_time = clocksource_of_init,
182 .init_machine = tegra_dt_init,
183 .init_late = tegra_dt_init_late,
184 .restart = tegra_assert_system_reset,
185 .dt_compat = tegra_dt_board_compat,