blob: f6f5b6a11325e131fc8a73dfb81e69f6654c2b38 [file] [log] [blame]
Mike Rapoportcca414b2011-02-07 10:10:53 +02001/*
2 * arch/arm/mach-tegra/board-trimslice.c
3 *
4 * Copyright (C) 2011 CompuLab, Ltd.
5 * Author: Mike Rapoport <mike@compulab.co.il>
6 *
7 * Based on board-harmony.c
8 * Copyright (C) 2010 Google, Inc.
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/platform_device.h>
24#include <linux/serial_8250.h>
25#include <linux/io.h>
Mike Rapoportbea2d6b2011-04-13 13:52:25 +030026#include <linux/i2c.h>
Mike Rapoport4c755992011-04-17 11:59:32 +030027#include <linux/gpio.h>
Stephen Warren4bee6412012-03-16 16:08:29 -060028#include <linux/platform_data/tegra_usb.h>
Mike Rapoportcca414b2011-02-07 10:10:53 +020029
Marc Zyngierafed2a22011-09-06 10:23:45 +010030#include <asm/hardware/gic.h>
Mike Rapoportcca414b2011-02-07 10:10:53 +020031#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/setup.h>
34
35#include <mach/iomap.h>
Mike Rapoportf02726a2011-03-07 16:29:24 +020036#include <mach/sdhci.h>
Mike Rapoportcca414b2011-02-07 10:10:53 +020037
38#include "board.h"
39#include "clock.h"
Mike Rapoportf02726a2011-03-07 16:29:24 +020040#include "devices.h"
41#include "gpio-names.h"
Mike Rapoportcca414b2011-02-07 10:10:53 +020042
43#include "board-trimslice.h"
44
45static struct plat_serial8250_port debug_uart_platform_data[] = {
46 {
47 .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
48 .mapbase = TEGRA_UARTA_BASE,
49 .irq = INT_UARTA,
Stephen Warren11b3adb2011-08-08 15:01:05 -060050 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
51 .type = PORT_TEGRA,
Mike Rapoportcca414b2011-02-07 10:10:53 +020052 .iotype = UPIO_MEM,
53 .regshift = 2,
54 .uartclk = 216000000,
55 }, {
56 .flags = 0
57 }
58};
59
60static struct platform_device debug_uart = {
61 .name = "serial8250",
62 .id = PLAT8250_DEV_PLATFORM,
63 .dev = {
64 .platform_data = debug_uart_platform_data,
65 },
66};
Mike Rapoportf02726a2011-03-07 16:29:24 +020067static struct tegra_sdhci_platform_data sdhci_pdata1 = {
68 .cd_gpio = -1,
69 .wp_gpio = -1,
70 .power_gpio = -1,
71};
72
73static struct tegra_sdhci_platform_data sdhci_pdata4 = {
74 .cd_gpio = TRIMSLICE_GPIO_SD4_CD,
75 .wp_gpio = TRIMSLICE_GPIO_SD4_WP,
76 .power_gpio = -1,
77};
Mike Rapoportcca414b2011-02-07 10:10:53 +020078
Mike Rapoport95049402011-04-17 11:10:35 +030079static struct platform_device trimslice_audio_device = {
80 .name = "tegra-snd-trimslice",
81 .id = 0,
82};
83
Mike Rapoportcca414b2011-02-07 10:10:53 +020084static struct platform_device *trimslice_devices[] __initdata = {
85 &debug_uart,
Mike Rapoportf02726a2011-03-07 16:29:24 +020086 &tegra_sdhci_device1,
87 &tegra_sdhci_device4,
Mike Rapoport95049402011-04-17 11:10:35 +030088 &tegra_i2s_device1,
89 &tegra_das_device,
90 &tegra_pcm_device,
91 &trimslice_audio_device,
Mike Rapoportcca414b2011-02-07 10:10:53 +020092};
93
Mike Rapoportbea2d6b2011-04-13 13:52:25 +030094static struct i2c_board_info trimslice_i2c3_board_info[] = {
95 {
96 I2C_BOARD_INFO("tlv320aic23", 0x1a),
97 },
98 {
99 I2C_BOARD_INFO("em3027", 0x56),
100 },
101};
102
103static void trimslice_i2c_init(void)
104{
Mike Rapoportbea2d6b2011-04-13 13:52:25 +0300105 platform_device_register(&tegra_i2c_device1);
106 platform_device_register(&tegra_i2c_device2);
107 platform_device_register(&tegra_i2c_device3);
108
109 i2c_register_board_info(2, trimslice_i2c3_board_info,
110 ARRAY_SIZE(trimslice_i2c3_board_info));
111}
112
Mike Rapoport4c755992011-04-17 11:59:32 +0300113static void trimslice_usb_init(void)
114{
Stephen Warren4bee6412012-03-16 16:08:29 -0600115 struct tegra_ehci_platform_data *pdata;
116
117 pdata = tegra_ehci1_device.dev.platform_data;
118 pdata->vbus_gpio = TRIMSLICE_GPIO_USB1_MODE;
Mike Rapoport4c755992011-04-17 11:59:32 +0300119
Mike Rapoport4c755992011-04-17 11:59:32 +0300120 platform_device_register(&tegra_ehci3_device);
Mike Rapoport4c755992011-04-17 11:59:32 +0300121 platform_device_register(&tegra_ehci2_device);
Mike Rapoport4c755992011-04-17 11:59:32 +0300122 platform_device_register(&tegra_ehci1_device);
123}
124
Russell King0744a3e2010-12-20 10:37:50 +0000125static void __init tegra_trimslice_fixup(struct tag *tags, char **cmdline,
126 struct meminfo *mi)
Mike Rapoportcca414b2011-02-07 10:10:53 +0200127{
128 mi->nr_banks = 2;
129 mi->bank[0].start = PHYS_OFFSET;
130 mi->bank[0].size = 448 * SZ_1M;
131 mi->bank[1].start = SZ_512M;
132 mi->bank[1].size = SZ_512M;
133}
134
135static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = {
136 /* name parent rate enabled */
137 { "uarta", "pll_p", 216000000, true },
Mike Rapoport95049402011-04-17 11:10:35 +0300138 { "pll_a", "pll_p_out1", 56448000, true },
139 { "pll_a_out0", "pll_a", 11289600, true },
140 { "cdev1", NULL, 0, true },
141 { "i2s1", "pll_a_out0", 11289600, false},
Mike Rapoportcca414b2011-02-07 10:10:53 +0200142 { NULL, NULL, 0, 0},
143};
144
145static int __init tegra_trimslice_pci_init(void)
146{
Mike Rapoportd5fdafd2011-03-02 14:34:06 +0200147 if (!machine_is_trimslice())
148 return 0;
149
Mike Rapoportcca414b2011-02-07 10:10:53 +0200150 return tegra_pcie_init(true, true);
151}
152subsys_initcall(tegra_trimslice_pci_init);
153
154static void __init tegra_trimslice_init(void)
155{
Mike Rapoportcca414b2011-02-07 10:10:53 +0200156 tegra_clk_init_from_table(trimslice_clk_init_table);
157
158 trimslice_pinmux_init();
159
Mike Rapoportf02726a2011-03-07 16:29:24 +0200160 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
161 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
162
Mike Rapoportcca414b2011-02-07 10:10:53 +0200163 platform_add_devices(trimslice_devices, ARRAY_SIZE(trimslice_devices));
Mike Rapoportbea2d6b2011-04-13 13:52:25 +0300164
165 trimslice_i2c_init();
Mike Rapoport4c755992011-04-17 11:59:32 +0300166 trimslice_usb_init();
Mike Rapoportcca414b2011-02-07 10:10:53 +0200167}
168
169MACHINE_START(TRIMSLICE, "trimslice")
Nicolas Pitreb61cafe2011-07-05 22:38:18 -0400170 .atag_offset = 0x100,
Mike Rapoportcca414b2011-02-07 10:10:53 +0200171 .fixup = tegra_trimslice_fixup,
Mike Rapoportcca414b2011-02-07 10:10:53 +0200172 .map_io = tegra_map_common_io,
Peter De Schrijverc37c07d2011-12-14 17:03:17 +0200173 .init_early = tegra20_init_early,
Colin Cross0cf62302011-02-21 17:10:14 -0800174 .init_irq = tegra_init_irq,
Marc Zyngierafed2a22011-09-06 10:23:45 +0100175 .handle_irq = gic_handle_irq,
Mike Rapoportcca414b2011-02-07 10:10:53 +0200176 .timer = &tegra_timer,
Colin Cross0cf62302011-02-21 17:10:14 -0800177 .init_machine = tegra_trimslice_init,
Russell Kingabea3f22011-11-05 08:48:33 +0000178 .restart = tegra_assert_system_reset,
Mike Rapoportcca414b2011-02-07 10:10:53 +0200179MACHINE_END