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>
38 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/time.h>
41 #include <asm/setup.h>
48 static struct tegra_ehci_platform_data tegra_ehci1_pdata
= {
49 .operating_mode
= TEGRA_USB_OTG
,
50 .power_down_on_bus_suspend
= 1,
54 static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config
= {
59 static struct tegra_ehci_platform_data tegra_ehci2_pdata
= {
60 .phy_config
= &tegra_ehci2_ulpi_phy_config
,
61 .operating_mode
= TEGRA_USB_HOST
,
62 .power_down_on_bus_suspend
= 1,
66 static struct tegra_ehci_platform_data tegra_ehci3_pdata
= {
67 .operating_mode
= TEGRA_USB_HOST
,
68 .power_down_on_bus_suspend
= 1,
72 static struct of_dev_auxdata tegra20_auxdata_lookup
[] __initdata
= {
73 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5000000, "tegra-ehci.0",
75 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5004000, "tegra-ehci.1",
77 OF_DEV_AUXDATA("nvidia,tegra20-ehci", 0xC5008000, "tegra-ehci.2",
82 static void __init
tegra_dt_init(void)
84 struct soc_device_attribute
*soc_dev_attr
;
85 struct soc_device
*soc_dev
;
86 struct device
*parent
= NULL
;
88 soc_dev_attr
= kzalloc(sizeof(*soc_dev_attr
), GFP_KERNEL
);
92 soc_dev_attr
->family
= kasprintf(GFP_KERNEL
, "Tegra");
93 soc_dev_attr
->revision
= kasprintf(GFP_KERNEL
, "%d", tegra_revision
);
94 soc_dev_attr
->soc_id
= kasprintf(GFP_KERNEL
, "%d", tegra_chip_id
);
96 soc_dev
= soc_device_register(soc_dev_attr
);
97 if (IS_ERR(soc_dev
)) {
98 kfree(soc_dev_attr
->family
);
99 kfree(soc_dev_attr
->revision
);
100 kfree(soc_dev_attr
->soc_id
);
105 parent
= soc_device_to_device(soc_dev
);
108 * Finished with the static registrations now; fill in the missing
112 of_platform_populate(NULL
, of_default_bus_match_table
,
113 tegra20_auxdata_lookup
, parent
);
116 static void __init
trimslice_init(void)
118 #ifdef CONFIG_TEGRA_PCI
121 ret
= tegra_pcie_init(true, true);
123 pr_err("tegra_pci_init() failed: %d\n", ret
);
127 static void __init
harmony_init(void)
129 #ifdef CONFIG_TEGRA_PCI
132 ret
= harmony_pcie_init();
134 pr_err("harmony_pcie_init() failed: %d\n", ret
);
138 static void __init
paz00_init(void)
140 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC
))
141 tegra_paz00_wifikill_init();
147 } board_init_funcs
[] = {
148 { "compulab,trimslice", trimslice_init
},
149 { "nvidia,harmony", harmony_init
},
150 { "compal,paz00", paz00_init
},
153 static void __init
tegra_dt_init_late(void)
159 for (i
= 0; i
< ARRAY_SIZE(board_init_funcs
); i
++) {
160 if (of_machine_is_compatible(board_init_funcs
[i
].machine
)) {
161 board_init_funcs
[i
].init();
167 static const char * const tegra_dt_board_compat
[] = {
174 DT_MACHINE_START(TEGRA_DT
, "NVIDIA Tegra SoC (Flattened Device Tree)")
175 .map_io
= tegra_map_common_io
,
176 .smp
= smp_ops(tegra_smp_ops
),
177 .init_early
= tegra_init_early
,
178 .init_irq
= tegra_dt_init_irq
,
179 .init_time
= clocksource_of_init
,
180 .init_machine
= tegra_dt_init
,
181 .init_late
= tegra_dt_init_late
,
182 .restart
= tegra_assert_system_reset
,
183 .dt_compat
= tegra_dt_board_compat
,