Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / arm / mach-tegra / board-harmony.c
blob789bdc9e8f913ddb26e46e1a4b827a2b0b6f51fa
1 /*
2 * arch/arm/mach-tegra/board-harmony.c
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2011 NVIDIA, Inc.
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.
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.
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/pda_power.h>
25 #include <linux/io.h>
26 #include <linux/gpio.h>
27 #include <linux/i2c.h>
29 #include <sound/wm8903.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/time.h>
34 #include <asm/hardware/gic.h>
35 #include <asm/setup.h>
37 #include <mach/tegra_wm8903_pdata.h>
38 #include <mach/iomap.h>
39 #include <mach/irqs.h>
40 #include <mach/sdhci.h>
42 #include "board.h"
43 #include "board-harmony.h"
44 #include "clock.h"
45 #include "devices.h"
46 #include "gpio-names.h"
48 static struct plat_serial8250_port debug_uart_platform_data[] = {
50 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
51 .mapbase = TEGRA_UARTD_BASE,
52 .irq = INT_UARTD,
53 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
54 .type = PORT_TEGRA,
55 .iotype = UPIO_MEM,
56 .regshift = 2,
57 .uartclk = 216000000,
58 }, {
59 .flags = 0
63 static struct platform_device debug_uart = {
64 .name = "serial8250",
65 .id = PLAT8250_DEV_PLATFORM,
66 .dev = {
67 .platform_data = debug_uart_platform_data,
71 static struct tegra_wm8903_platform_data harmony_audio_pdata = {
72 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
73 .gpio_hp_det = TEGRA_GPIO_HP_DET,
74 .gpio_hp_mute = -1,
75 .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
76 .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
79 static struct platform_device harmony_audio_device = {
80 .name = "tegra-snd-wm8903",
81 .id = 0,
82 .dev = {
83 .platform_data = &harmony_audio_pdata,
87 static struct wm8903_platform_data harmony_wm8903_pdata = {
88 .irq_active_low = 0,
89 .micdet_cfg = 0,
90 .micdet_delay = 100,
91 .gpio_base = HARMONY_GPIO_WM8903(0),
92 .gpio_cfg = {
95 WM8903_GPIO_CONFIG_ZERO,
101 static struct i2c_board_info __initdata wm8903_board_info = {
102 I2C_BOARD_INFO("wm8903", 0x1a),
103 .platform_data = &harmony_wm8903_pdata,
104 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
107 static void __init harmony_i2c_init(void)
109 platform_device_register(&tegra_i2c_device1);
110 platform_device_register(&tegra_i2c_device2);
111 platform_device_register(&tegra_i2c_device3);
112 platform_device_register(&tegra_i2c_device4);
114 i2c_register_board_info(0, &wm8903_board_info, 1);
117 static struct platform_device *harmony_devices[] __initdata = {
118 &debug_uart,
119 &tegra_sdhci_device1,
120 &tegra_sdhci_device2,
121 &tegra_sdhci_device4,
122 &tegra_ehci3_device,
123 &tegra_i2s_device1,
124 &tegra_das_device,
125 &tegra_pcm_device,
126 &harmony_audio_device,
129 static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
130 struct meminfo *mi)
132 mi->nr_banks = 2;
133 mi->bank[0].start = PHYS_OFFSET;
134 mi->bank[0].size = 448 * SZ_1M;
135 mi->bank[1].start = SZ_512M;
136 mi->bank[1].size = SZ_512M;
139 static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
140 /* name parent rate enabled */
141 { "uartd", "pll_p", 216000000, true },
142 { "pll_a", "pll_p_out1", 56448000, true },
143 { "pll_a_out0", "pll_a", 11289600, true },
144 { "cdev1", NULL, 0, true },
145 { "i2s1", "pll_a_out0", 11289600, false},
146 { "usb3", "clk_m", 12000000, true },
147 { NULL, NULL, 0, 0},
151 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
152 .cd_gpio = -1,
153 .wp_gpio = -1,
154 .power_gpio = -1,
157 static struct tegra_sdhci_platform_data sdhci_pdata2 = {
158 .cd_gpio = TEGRA_GPIO_SD2_CD,
159 .wp_gpio = TEGRA_GPIO_SD2_WP,
160 .power_gpio = TEGRA_GPIO_SD2_POWER,
163 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
164 .cd_gpio = TEGRA_GPIO_SD4_CD,
165 .wp_gpio = TEGRA_GPIO_SD4_WP,
166 .power_gpio = TEGRA_GPIO_SD4_POWER,
167 .is_8bit = 1,
170 static void __init tegra_harmony_init(void)
172 tegra_clk_init_from_table(harmony_clk_init_table);
174 harmony_pinmux_init();
176 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
177 tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
178 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
180 platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
181 harmony_i2c_init();
182 harmony_regulator_init();
185 MACHINE_START(HARMONY, "harmony")
186 .atag_offset = 0x100,
187 .fixup = tegra_harmony_fixup,
188 .map_io = tegra_map_common_io,
189 .init_early = tegra20_init_early,
190 .init_irq = tegra_init_irq,
191 .handle_irq = gic_handle_irq,
192 .timer = &tegra_timer,
193 .init_machine = tegra_harmony_init,
194 .restart = tegra_assert_system_reset,
195 MACHINE_END