]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/arm/mach-tegra/board-harmony.c
Merge tag 'v3.2-rc2' into staging/for_v3.3
[mirror_ubuntu-artful-kernel.git] / arch / arm / mach-tegra / board-harmony.c
CommitLineData
42a7bf4d
CC
1/*
2 * arch/arm/mach-tegra/board-harmony.c
3 *
4 * Copyright (C) 2010 Google, Inc.
ef2b1a0f 5 * Copyright (C) 2011 NVIDIA, Inc.
42a7bf4d
CC
6 *
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.
10 *
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.
15 *
16 */
17
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>
ef2b1a0f 26#include <linux/gpio.h>
de4855d9 27#include <linux/i2c.h>
42a7bf4d 28
fba3b2fc
SW
29#include <sound/wm8903.h>
30
42a7bf4d
CC
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/time.h>
34#include <asm/setup.h>
35
4651d556 36#include <mach/tegra_wm8903_pdata.h>
42a7bf4d
CC
37#include <mach/iomap.h>
38#include <mach/irqs.h>
875d4af6 39#include <mach/sdhci.h>
42a7bf4d
CC
40
41#include "board.h"
42#include "board-harmony.h"
43#include "clock.h"
875d4af6
OJ
44#include "devices.h"
45#include "gpio-names.h"
42a7bf4d 46
42a7bf4d
CC
47static struct plat_serial8250_port debug_uart_platform_data[] = {
48 {
49 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
50 .mapbase = TEGRA_UARTD_BASE,
51 .irq = INT_UARTD,
11b3adb4
SW
52 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
53 .type = PORT_TEGRA,
42a7bf4d
CC
54 .iotype = UPIO_MEM,
55 .regshift = 2,
56 .uartclk = 216000000,
57 }, {
58 .flags = 0
59 }
60};
61
62static struct platform_device debug_uart = {
63 .name = "serial8250",
64 .id = PLAT8250_DEV_PLATFORM,
65 .dev = {
66 .platform_data = debug_uart_platform_data,
67 },
68};
69
4651d556 70static struct tegra_wm8903_platform_data harmony_audio_pdata = {
ef2b1a0f
SW
71 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
72 .gpio_hp_det = TEGRA_GPIO_HP_DET,
61a6d076 73 .gpio_hp_mute = -1,
ef2b1a0f
SW
74 .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
75 .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
76};
77
78static struct platform_device harmony_audio_device = {
7b33af25 79 .name = "tegra-snd-wm8903",
ef2b1a0f
SW
80 .id = 0,
81 .dev = {
82 .platform_data = &harmony_audio_pdata,
83 },
84};
85
fba3b2fc
SW
86static struct wm8903_platform_data harmony_wm8903_pdata = {
87 .irq_active_low = 0,
88 .micdet_cfg = 0,
89 .micdet_delay = 100,
06fc9a30 90 .gpio_base = HARMONY_GPIO_WM8903(0),
fba3b2fc
SW
91 .gpio_cfg = {
92 WM8903_GPIO_NO_CONFIG,
93 WM8903_GPIO_NO_CONFIG,
94 0,
95 WM8903_GPIO_NO_CONFIG,
96 WM8903_GPIO_NO_CONFIG,
97 },
98};
99
100static struct i2c_board_info __initdata wm8903_board_info = {
101 I2C_BOARD_INFO("wm8903", 0x1a),
102 .platform_data = &harmony_wm8903_pdata,
103 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
104};
105
de4855d9
OJ
106static void __init harmony_i2c_init(void)
107{
de4855d9
OJ
108 platform_device_register(&tegra_i2c_device1);
109 platform_device_register(&tegra_i2c_device2);
110 platform_device_register(&tegra_i2c_device3);
111 platform_device_register(&tegra_i2c_device4);
fba3b2fc
SW
112
113 i2c_register_board_info(0, &wm8903_board_info, 1);
de4855d9
OJ
114}
115
42a7bf4d
CC
116static struct platform_device *harmony_devices[] __initdata = {
117 &debug_uart,
875d4af6
OJ
118 &tegra_sdhci_device1,
119 &tegra_sdhci_device2,
120 &tegra_sdhci_device4,
dd58bdbc 121 &tegra_ehci3_device,
ef2b1a0f
SW
122 &tegra_i2s_device1,
123 &tegra_das_device,
124 &tegra_pcm_device,
125 &harmony_audio_device,
42a7bf4d
CC
126};
127
0744a3ee
RK
128static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
129 struct meminfo *mi)
42a7bf4d
CC
130{
131 mi->nr_banks = 2;
132 mi->bank[0].start = PHYS_OFFSET;
42a7bf4d
CC
133 mi->bank[0].size = 448 * SZ_1M;
134 mi->bank[1].start = SZ_512M;
42a7bf4d
CC
135 mi->bank[1].size = SZ_512M;
136}
137
138static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
139 /* name parent rate enabled */
140 { "uartd", "pll_p", 216000000, true },
ef2b1a0f
SW
141 { "pll_a", "pll_p_out1", 56448000, true },
142 { "pll_a_out0", "pll_a", 11289600, true },
143 { "cdev1", NULL, 0, true },
144 { "i2s1", "pll_a_out0", 11289600, false},
dd58bdbc 145 { "usb3", "clk_m", 12000000, true },
42a7bf4d
CC
146 { NULL, NULL, 0, 0},
147};
148
875d4af6
OJ
149
150static struct tegra_sdhci_platform_data sdhci_pdata1 = {
151 .cd_gpio = -1,
152 .wp_gpio = -1,
153 .power_gpio = -1,
154};
155
156static struct tegra_sdhci_platform_data sdhci_pdata2 = {
986afbe4
SW
157 .cd_gpio = TEGRA_GPIO_SD2_CD,
158 .wp_gpio = TEGRA_GPIO_SD2_WP,
159 .power_gpio = TEGRA_GPIO_SD2_POWER,
875d4af6
OJ
160};
161
162static struct tegra_sdhci_platform_data sdhci_pdata4 = {
986afbe4
SW
163 .cd_gpio = TEGRA_GPIO_SD4_CD,
164 .wp_gpio = TEGRA_GPIO_SD4_WP,
165 .power_gpio = TEGRA_GPIO_SD4_POWER,
875d4af6
OJ
166 .is_8bit = 1,
167};
168
42a7bf4d
CC
169static void __init tegra_harmony_init(void)
170{
42a7bf4d
CC
171 tegra_clk_init_from_table(harmony_clk_init_table);
172
173 harmony_pinmux_init();
174
875d4af6
OJ
175 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
176 tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
177 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
178
42a7bf4d 179 platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
de4855d9 180 harmony_i2c_init();
6f168f2f 181 harmony_regulator_init();
42a7bf4d
CC
182}
183
184MACHINE_START(HARMONY, "harmony")
b61cafee 185 .atag_offset = 0x100,
42a7bf4d 186 .fixup = tegra_harmony_fixup,
42a7bf4d 187 .map_io = tegra_map_common_io,
0cf6230a
CC
188 .init_early = tegra_init_early,
189 .init_irq = tegra_init_irq,
42a7bf4d 190 .timer = &tegra_timer,
0cf6230a 191 .init_machine = tegra_harmony_init,
42a7bf4d 192MACHINE_END