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/slab.h>
35 #include <linux/sys_soc.h>
36 #include <linux/usb/tegra_usb_phy.h>
37 #include <linux/clk/tegra.h>
39 #include <asm/mach-types.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/time.h>
42 #include <asm/setup.h>
49 static struct tegra_ehci_platform_data tegra_ehci1_pdata
= {
50 .operating_mode
= TEGRA_USB_OTG
,
51 .power_down_on_bus_suspend
= 1,
55 static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config
= {
60 static struct tegra_ehci_platform_data tegra_ehci2_pdata
= {
61 .phy_config
= &tegra_ehci2_ulpi_phy_config
,
62 .operating_mode
= TEGRA_USB_HOST
,
63 .power_down_on_bus_suspend
= 1,
67 static struct tegra_ehci_platform_data tegra_ehci3_pdata
= {
68 .operating_mode
= TEGRA_USB_HOST
,
69 .power_down_on_bus_suspend
= 1,
73 static struct of_dev_auxdata tegra20_auxdata_lookup
[] __initdata
= {
74 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5000000, "tegra-ehci.0",
76 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5004000, "tegra-ehci.1",
78 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5008000, "tegra-ehci.2",
83 static void __init
tegra_dt_init(void)
85 struct soc_device_attribute
*soc_dev_attr
;
86 struct soc_device
*soc_dev
;
87 struct device
*parent
= NULL
;
89 tegra_clocks_apply_init_table();
91 soc_dev_attr
= kzalloc(sizeof(*soc_dev_attr
), GFP_KERNEL
);
95 soc_dev_attr
->family
= kasprintf(GFP_KERNEL
, "Tegra");
96 soc_dev_attr
->revision
= kasprintf(GFP_KERNEL
, "%d", tegra_revision
);
97 soc_dev_attr
->soc_id
= kasprintf(GFP_KERNEL
, "%d", tegra_chip_id
);
99 soc_dev
= soc_device_register(soc_dev_attr
);
100 if (IS_ERR(soc_dev
)) {
101 kfree(soc_dev_attr
->family
);
102 kfree(soc_dev_attr
->revision
);
103 kfree(soc_dev_attr
->soc_id
);
108 parent
= soc_device_to_device(soc_dev
);
111 * Finished with the static registrations now; fill in the missing
115 of_platform_populate(NULL
, of_default_bus_match_table
,
116 tegra20_auxdata_lookup
, parent
);
119 static void __init
trimslice_init(void)
121 #ifdef CONFIG_TEGRA_PCI
124 ret
= tegra_pcie_init(true, true);
126 pr_err("tegra_pci_init() failed: %d\n", ret
);
130 static void __init
harmony_init(void)
132 #ifdef CONFIG_TEGRA_PCI
135 ret
= harmony_pcie_init();
137 pr_err("harmony_pcie_init() failed: %d\n", ret
);
141 static void __init
paz00_init(void)
143 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC
))
144 tegra_paz00_wifikill_init();
150 } board_init_funcs
[] = {
151 { "compulab,trimslice", trimslice_init
},
152 { "nvidia,harmony", harmony_init
},
153 { "compal,paz00", paz00_init
},
156 static void __init
tegra_dt_init_late(void)
162 for (i
= 0; i
< ARRAY_SIZE(board_init_funcs
); i
++) {
163 if (of_machine_is_compatible(board_init_funcs
[i
].machine
)) {
164 board_init_funcs
[i
].init();
170 static const char * const tegra_dt_board_compat
[] = {
177 DT_MACHINE_START(TEGRA_DT
, "NVIDIA Tegra SoC (Flattened Device Tree)")
178 .map_io
= tegra_map_common_io
,
179 .smp
= smp_ops(tegra_smp_ops
),
180 .init_early
= tegra_init_early
,
181 .init_irq
= tegra_dt_init_irq
,
182 .init_time
= clocksource_of_init
,
183 .init_machine
= tegra_dt_init
,
184 .init_late
= tegra_dt_init_late
,
185 .restart
= tegra_assert_system_reset
,
186 .dt_compat
= tegra_dt_board_compat
,