Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-tegra/board-harmony.c |
| 3 | * |
| 4 | * Copyright (C) 2010 Google, Inc. |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 5 | * Copyright (C) 2011 NVIDIA, Inc. |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 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> |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 26 | #include <linux/gpio.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 27 | |
| 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 Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 33 | #include <mach/harmony_audio.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 34 | #include <mach/iomap.h> |
| 35 | #include <mach/irqs.h> |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 36 | #include <mach/sdhci.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 37 | |
| 38 | #include "board.h" |
| 39 | #include "board-harmony.h" |
| 40 | #include "clock.h" |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 41 | #include "devices.h" |
| 42 | #include "gpio-names.h" |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 43 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 44 | static 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 | |
| 58 | static 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 Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 66 | static 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 | |
| 73 | static 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 Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 81 | static struct platform_device *harmony_devices[] __initdata = { |
| 82 | &debug_uart, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 83 | &tegra_sdhci_device1, |
| 84 | &tegra_sdhci_device2, |
| 85 | &tegra_sdhci_device4, |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 86 | &tegra_i2s_device1, |
| 87 | &tegra_das_device, |
| 88 | &tegra_pcm_device, |
| 89 | &harmony_audio_device, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | static 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 Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 97 | mi->bank[0].size = 448 * SZ_1M; |
| 98 | mi->bank[1].start = SZ_512M; |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 99 | mi->bank[1].size = SZ_512M; |
| 100 | } |
| 101 | |
| 102 | static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { |
| 103 | /* name parent rate enabled */ |
| 104 | { "uartd", "pll_p", 216000000, true }, |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame^] | 105 | { "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 Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 109 | { NULL, NULL, 0, 0}, |
| 110 | }; |
| 111 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 112 | |
| 113 | static struct tegra_sdhci_platform_data sdhci_pdata1 = { |
| 114 | .cd_gpio = -1, |
| 115 | .wp_gpio = -1, |
| 116 | .power_gpio = -1, |
| 117 | }; |
| 118 | |
| 119 | static struct tegra_sdhci_platform_data sdhci_pdata2 = { |
Stephen Warren | 986afbe | 2011-03-04 22:44:28 -0700 | [diff] [blame] | 120 | .cd_gpio = TEGRA_GPIO_SD2_CD, |
| 121 | .wp_gpio = TEGRA_GPIO_SD2_WP, |
| 122 | .power_gpio = TEGRA_GPIO_SD2_POWER, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 123 | }; |
| 124 | |
| 125 | static struct tegra_sdhci_platform_data sdhci_pdata4 = { |
Stephen Warren | 986afbe | 2011-03-04 22:44:28 -0700 | [diff] [blame] | 126 | .cd_gpio = TEGRA_GPIO_SD4_CD, |
| 127 | .wp_gpio = TEGRA_GPIO_SD4_WP, |
| 128 | .power_gpio = TEGRA_GPIO_SD4_POWER, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 129 | .is_8bit = 1, |
| 130 | }; |
| 131 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 132 | static void __init tegra_harmony_init(void) |
| 133 | { |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 134 | tegra_clk_init_from_table(harmony_clk_init_table); |
| 135 | |
| 136 | harmony_pinmux_init(); |
| 137 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 138 | 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 Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 142 | platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices)); |
| 143 | } |
| 144 | |
| 145 | MACHINE_START(HARMONY, "harmony") |
| 146 | .boot_params = 0x00000100, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 147 | .fixup = tegra_harmony_fixup, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 148 | .map_io = tegra_map_common_io, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 149 | .init_early = tegra_init_early, |
| 150 | .init_irq = tegra_init_irq, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 151 | .timer = &tegra_timer, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 152 | .init_machine = tegra_harmony_init, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 153 | MACHINE_END |