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/of_serial.h>
23 #include <linux/clk.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/pda_power.h>
27 #include <linux/gpio.h>
28 #include <linux/i2c.h>
30 #include <sound/wm8903.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/time.h>
35 #include <asm/hardware/gic.h>
36 #include <asm/setup.h>
38 #include <mach/tegra_wm8903_pdata.h>
39 #include <mach/iomap.h>
40 #include <mach/irqs.h>
41 #include <mach/sdhci.h>
44 #include "board-harmony.h"
47 #include "gpio-names.h"
49 static struct plat_serial8250_port debug_uart_platform_data
[] = {
51 .membase
= IO_ADDRESS(TEGRA_UARTD_BASE
),
52 .mapbase
= TEGRA_UARTD_BASE
,
54 .flags
= UPF_BOOT_AUTOCONF
| UPF_FIXED_TYPE
,
56 .handle_break
= tegra_serial_handle_break
,
65 static struct platform_device debug_uart
= {
67 .id
= PLAT8250_DEV_PLATFORM
,
69 .platform_data
= debug_uart_platform_data
,
73 static struct tegra_wm8903_platform_data harmony_audio_pdata
= {
74 .gpio_spkr_en
= TEGRA_GPIO_SPKR_EN
,
75 .gpio_hp_det
= TEGRA_GPIO_HP_DET
,
77 .gpio_int_mic_en
= TEGRA_GPIO_INT_MIC_EN
,
78 .gpio_ext_mic_en
= TEGRA_GPIO_EXT_MIC_EN
,
81 static struct platform_device harmony_audio_device
= {
82 .name
= "tegra-snd-wm8903",
85 .platform_data
= &harmony_audio_pdata
,
89 static struct wm8903_platform_data harmony_wm8903_pdata
= {
93 .gpio_base
= HARMONY_GPIO_WM8903(0),
97 WM8903_GPIO_CONFIG_ZERO
,
103 static struct i2c_board_info __initdata wm8903_board_info
= {
104 I2C_BOARD_INFO("wm8903", 0x1a),
105 .platform_data
= &harmony_wm8903_pdata
,
108 static void __init
harmony_i2c_init(void)
110 platform_device_register(&tegra_i2c_device1
);
111 platform_device_register(&tegra_i2c_device2
);
112 platform_device_register(&tegra_i2c_device3
);
113 platform_device_register(&tegra_i2c_device4
);
115 wm8903_board_info
.irq
= gpio_to_irq(TEGRA_GPIO_CDC_IRQ
);
116 i2c_register_board_info(0, &wm8903_board_info
, 1);
119 static struct platform_device
*harmony_devices
[] __initdata
= {
121 &tegra_sdhci_device1
,
122 &tegra_sdhci_device2
,
123 &tegra_sdhci_device4
,
127 &harmony_audio_device
,
130 static void __init
tegra_harmony_fixup(struct tag
*tags
, char **cmdline
,
134 mi
->bank
[0].start
= PHYS_OFFSET
;
135 mi
->bank
[0].size
= 448 * SZ_1M
;
136 mi
->bank
[1].start
= SZ_512M
;
137 mi
->bank
[1].size
= SZ_512M
;
140 static __initdata
struct tegra_clk_init_table harmony_clk_init_table
[] = {
141 /* name parent rate enabled */
142 { "uartd", "pll_p", 216000000, true },
143 { "pll_a", "pll_p_out1", 56448000, true },
144 { "pll_a_out0", "pll_a", 11289600, true },
145 { "cdev1", NULL
, 0, true },
146 { "i2s1", "pll_a_out0", 11289600, false},
147 { "usb3", "clk_m", 12000000, true },
152 static struct tegra_sdhci_platform_data sdhci_pdata1
= {
158 static struct tegra_sdhci_platform_data sdhci_pdata2
= {
159 .cd_gpio
= TEGRA_GPIO_SD2_CD
,
160 .wp_gpio
= TEGRA_GPIO_SD2_WP
,
161 .power_gpio
= TEGRA_GPIO_SD2_POWER
,
164 static struct tegra_sdhci_platform_data sdhci_pdata4
= {
165 .cd_gpio
= TEGRA_GPIO_SD4_CD
,
166 .wp_gpio
= TEGRA_GPIO_SD4_WP
,
167 .power_gpio
= TEGRA_GPIO_SD4_POWER
,
171 static void __init
tegra_harmony_init(void)
173 tegra_clk_init_from_table(harmony_clk_init_table
);
175 harmony_pinmux_init();
177 tegra_sdhci_device1
.dev
.platform_data
= &sdhci_pdata1
;
178 tegra_sdhci_device2
.dev
.platform_data
= &sdhci_pdata2
;
179 tegra_sdhci_device4
.dev
.platform_data
= &sdhci_pdata4
;
181 platform_add_devices(harmony_devices
, ARRAY_SIZE(harmony_devices
));
183 harmony_regulator_init();
186 MACHINE_START(HARMONY
, "harmony")
187 .atag_offset
= 0x100,
188 .fixup
= tegra_harmony_fixup
,
189 .map_io
= tegra_map_common_io
,
190 .init_early
= tegra20_init_early
,
191 .init_irq
= tegra_init_irq
,
192 .handle_irq
= gic_handle_irq
,
193 .timer
= &tegra_timer
,
194 .init_machine
= tegra_harmony_init
,
195 .init_late
= tegra_init_late
,
196 .restart
= tegra_assert_system_reset
,