blob: 38c2ab864503de295f081a471dcc56aee448f8af [file] [log] [blame]
Colin Cross42a7bf42010-02-10 17:13:07 -08001/*
2 * arch/arm/mach-tegra/board-harmony.c
3 *
4 * Copyright (C) 2010 Google, Inc.
Stephen Warrenef2b1a02011-03-04 22:44:29 -07005 * Copyright (C) 2011 NVIDIA, Inc.
Colin Cross42a7bf42010-02-10 17:13:07 -08006 *
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>
Stephen Warrenef2b1a02011-03-04 22:44:29 -070026#include <linux/gpio.h>
Colin Cross42a7bf42010-02-10 17:13:07 -080027
28#include <asm/mach-types.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/time.h>
31#include <asm/setup.h>
32
Stephen Warrenef2b1a02011-03-04 22:44:29 -070033#include <mach/harmony_audio.h>
Colin Cross42a7bf42010-02-10 17:13:07 -080034#include <mach/iomap.h>
35#include <mach/irqs.h>
Olof Johansson875d4af2011-02-19 16:39:37 -080036#include <mach/sdhci.h>
Colin Cross42a7bf42010-02-10 17:13:07 -080037
38#include "board.h"
39#include "board-harmony.h"
40#include "clock.h"
Olof Johansson875d4af2011-02-19 16:39:37 -080041#include "devices.h"
42#include "gpio-names.h"
Colin Cross42a7bf42010-02-10 17:13:07 -080043
Colin Cross42a7bf42010-02-10 17:13:07 -080044static struct plat_serial8250_port debug_uart_platform_data[] = {
45 {
46 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
47 .mapbase = TEGRA_UARTD_BASE,
48 .irq = INT_UARTD,
49 .flags = UPF_BOOT_AUTOCONF,
50 .iotype = UPIO_MEM,
51 .regshift = 2,
52 .uartclk = 216000000,
53 }, {
54 .flags = 0
55 }
56};
57
58static struct platform_device debug_uart = {
59 .name = "serial8250",
60 .id = PLAT8250_DEV_PLATFORM,
61 .dev = {
62 .platform_data = debug_uart_platform_data,
63 },
64};
65
Stephen Warrenef2b1a02011-03-04 22:44:29 -070066static struct harmony_audio_platform_data harmony_audio_pdata = {
67 .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
68 .gpio_hp_det = TEGRA_GPIO_HP_DET,
69 .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
70 .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
71};
72
73static struct platform_device harmony_audio_device = {
74 .name = "tegra-snd-harmony",
75 .id = 0,
76 .dev = {
77 .platform_data = &harmony_audio_pdata,
78 },
79};
80
Colin Cross42a7bf42010-02-10 17:13:07 -080081static struct platform_device *harmony_devices[] __initdata = {
82 &debug_uart,
Olof Johansson875d4af2011-02-19 16:39:37 -080083 &tegra_sdhci_device1,
84 &tegra_sdhci_device2,
85 &tegra_sdhci_device4,
Stephen Warrenef2b1a02011-03-04 22:44:29 -070086 &tegra_i2s_device1,
87 &tegra_das_device,
88 &tegra_pcm_device,
89 &harmony_audio_device,
Colin Cross42a7bf42010-02-10 17:13:07 -080090};
91
92static void __init tegra_harmony_fixup(struct machine_desc *desc,
93 struct tag *tags, char **cmdline, struct meminfo *mi)
94{
95 mi->nr_banks = 2;
96 mi->bank[0].start = PHYS_OFFSET;
Colin Cross42a7bf42010-02-10 17:13:07 -080097 mi->bank[0].size = 448 * SZ_1M;
98 mi->bank[1].start = SZ_512M;
Colin Cross42a7bf42010-02-10 17:13:07 -080099 mi->bank[1].size = SZ_512M;
100}
101
102static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
103 /* name parent rate enabled */
104 { "uartd", "pll_p", 216000000, true },
Stephen Warrenef2b1a02011-03-04 22:44:29 -0700105 { "pll_a", "pll_p_out1", 56448000, true },
106 { "pll_a_out0", "pll_a", 11289600, true },
107 { "cdev1", NULL, 0, true },
108 { "i2s1", "pll_a_out0", 11289600, false},
Colin Cross42a7bf42010-02-10 17:13:07 -0800109 { NULL, NULL, 0, 0},
110};
111
Olof Johansson875d4af2011-02-19 16:39:37 -0800112
113static struct tegra_sdhci_platform_data sdhci_pdata1 = {
114 .cd_gpio = -1,
115 .wp_gpio = -1,
116 .power_gpio = -1,
117};
118
119static struct tegra_sdhci_platform_data sdhci_pdata2 = {
Stephen Warren986afbe2011-03-04 22:44:28 -0700120 .cd_gpio = TEGRA_GPIO_SD2_CD,
121 .wp_gpio = TEGRA_GPIO_SD2_WP,
122 .power_gpio = TEGRA_GPIO_SD2_POWER,
Olof Johansson875d4af2011-02-19 16:39:37 -0800123};
124
125static struct tegra_sdhci_platform_data sdhci_pdata4 = {
Stephen Warren986afbe2011-03-04 22:44:28 -0700126 .cd_gpio = TEGRA_GPIO_SD4_CD,
127 .wp_gpio = TEGRA_GPIO_SD4_WP,
128 .power_gpio = TEGRA_GPIO_SD4_POWER,
Olof Johansson875d4af2011-02-19 16:39:37 -0800129 .is_8bit = 1,
130};
131
Colin Cross42a7bf42010-02-10 17:13:07 -0800132static void __init tegra_harmony_init(void)
133{
Colin Cross42a7bf42010-02-10 17:13:07 -0800134 tegra_clk_init_from_table(harmony_clk_init_table);
135
136 harmony_pinmux_init();
137
Olof Johansson875d4af2011-02-19 16:39:37 -0800138 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
139 tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
140 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
141
Colin Cross42a7bf42010-02-10 17:13:07 -0800142 platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
143}
144
145MACHINE_START(HARMONY, "harmony")
146 .boot_params = 0x00000100,
Colin Cross42a7bf42010-02-10 17:13:07 -0800147 .fixup = tegra_harmony_fixup,
Colin Cross42a7bf42010-02-10 17:13:07 -0800148 .map_io = tegra_map_common_io,
Colin Cross0cf62302011-02-21 17:10:14 -0800149 .init_early = tegra_init_early,
150 .init_irq = tegra_init_irq,
Colin Cross42a7bf42010-02-10 17:13:07 -0800151 .timer = &tegra_timer,
Colin Cross0cf62302011-02-21 17:10:14 -0800152 .init_machine = tegra_harmony_init,
Colin Cross42a7bf42010-02-10 17:13:07 -0800153MACHINE_END