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> |
Olof Johansson | de4855d | 2011-03-04 15:26:46 -0800 | [diff] [blame^] | 27 | #include <linux/i2c.h> |
| 28 | #include <linux/i2c-tegra.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 29 | |
| 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach/time.h> |
| 33 | #include <asm/setup.h> |
| 34 | |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame] | 35 | #include <mach/harmony_audio.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 36 | #include <mach/iomap.h> |
| 37 | #include <mach/irqs.h> |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 38 | #include <mach/sdhci.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 39 | |
| 40 | #include "board.h" |
| 41 | #include "board-harmony.h" |
| 42 | #include "clock.h" |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 43 | #include "devices.h" |
| 44 | #include "gpio-names.h" |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 45 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 46 | static struct plat_serial8250_port debug_uart_platform_data[] = { |
| 47 | { |
| 48 | .membase = IO_ADDRESS(TEGRA_UARTD_BASE), |
| 49 | .mapbase = TEGRA_UARTD_BASE, |
| 50 | .irq = INT_UARTD, |
| 51 | .flags = UPF_BOOT_AUTOCONF, |
| 52 | .iotype = UPIO_MEM, |
| 53 | .regshift = 2, |
| 54 | .uartclk = 216000000, |
| 55 | }, { |
| 56 | .flags = 0 |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | static struct platform_device debug_uart = { |
| 61 | .name = "serial8250", |
| 62 | .id = PLAT8250_DEV_PLATFORM, |
| 63 | .dev = { |
| 64 | .platform_data = debug_uart_platform_data, |
| 65 | }, |
| 66 | }; |
| 67 | |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame] | 68 | static struct harmony_audio_platform_data harmony_audio_pdata = { |
| 69 | .gpio_spkr_en = TEGRA_GPIO_SPKR_EN, |
| 70 | .gpio_hp_det = TEGRA_GPIO_HP_DET, |
| 71 | .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN, |
| 72 | .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN, |
| 73 | }; |
| 74 | |
| 75 | static struct platform_device harmony_audio_device = { |
| 76 | .name = "tegra-snd-harmony", |
| 77 | .id = 0, |
| 78 | .dev = { |
| 79 | .platform_data = &harmony_audio_pdata, |
| 80 | }, |
| 81 | }; |
| 82 | |
Olof Johansson | de4855d | 2011-03-04 15:26:46 -0800 | [diff] [blame^] | 83 | static struct tegra_i2c_platform_data harmony_i2c1_platform_data = { |
| 84 | .bus_clk_rate = 400000, |
| 85 | }; |
| 86 | |
| 87 | static struct tegra_i2c_platform_data harmony_i2c2_platform_data = { |
| 88 | .bus_clk_rate = 400000, |
| 89 | }; |
| 90 | |
| 91 | static struct tegra_i2c_platform_data harmony_i2c3_platform_data = { |
| 92 | .bus_clk_rate = 400000, |
| 93 | }; |
| 94 | |
| 95 | static struct tegra_i2c_platform_data harmony_dvc_platform_data = { |
| 96 | .bus_clk_rate = 400000, |
| 97 | }; |
| 98 | |
| 99 | static void __init harmony_i2c_init(void) |
| 100 | { |
| 101 | tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data; |
| 102 | tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data; |
| 103 | tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data; |
| 104 | tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data; |
| 105 | |
| 106 | platform_device_register(&tegra_i2c_device1); |
| 107 | platform_device_register(&tegra_i2c_device2); |
| 108 | platform_device_register(&tegra_i2c_device3); |
| 109 | platform_device_register(&tegra_i2c_device4); |
| 110 | } |
| 111 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 112 | static struct platform_device *harmony_devices[] __initdata = { |
| 113 | &debug_uart, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 114 | &tegra_sdhci_device1, |
| 115 | &tegra_sdhci_device2, |
| 116 | &tegra_sdhci_device4, |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame] | 117 | &tegra_i2s_device1, |
| 118 | &tegra_das_device, |
| 119 | &tegra_pcm_device, |
| 120 | &harmony_audio_device, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | static void __init tegra_harmony_fixup(struct machine_desc *desc, |
| 124 | struct tag *tags, char **cmdline, struct meminfo *mi) |
| 125 | { |
| 126 | mi->nr_banks = 2; |
| 127 | mi->bank[0].start = PHYS_OFFSET; |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 128 | mi->bank[0].size = 448 * SZ_1M; |
| 129 | mi->bank[1].start = SZ_512M; |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 130 | mi->bank[1].size = SZ_512M; |
| 131 | } |
| 132 | |
| 133 | static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { |
| 134 | /* name parent rate enabled */ |
| 135 | { "uartd", "pll_p", 216000000, true }, |
Stephen Warren | ef2b1a0 | 2011-03-04 22:44:29 -0700 | [diff] [blame] | 136 | { "pll_a", "pll_p_out1", 56448000, true }, |
| 137 | { "pll_a_out0", "pll_a", 11289600, true }, |
| 138 | { "cdev1", NULL, 0, true }, |
| 139 | { "i2s1", "pll_a_out0", 11289600, false}, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 140 | { NULL, NULL, 0, 0}, |
| 141 | }; |
| 142 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 143 | |
| 144 | static struct tegra_sdhci_platform_data sdhci_pdata1 = { |
| 145 | .cd_gpio = -1, |
| 146 | .wp_gpio = -1, |
| 147 | .power_gpio = -1, |
| 148 | }; |
| 149 | |
| 150 | static struct tegra_sdhci_platform_data sdhci_pdata2 = { |
Stephen Warren | 986afbe | 2011-03-04 22:44:28 -0700 | [diff] [blame] | 151 | .cd_gpio = TEGRA_GPIO_SD2_CD, |
| 152 | .wp_gpio = TEGRA_GPIO_SD2_WP, |
| 153 | .power_gpio = TEGRA_GPIO_SD2_POWER, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 154 | }; |
| 155 | |
| 156 | static struct tegra_sdhci_platform_data sdhci_pdata4 = { |
Stephen Warren | 986afbe | 2011-03-04 22:44:28 -0700 | [diff] [blame] | 157 | .cd_gpio = TEGRA_GPIO_SD4_CD, |
| 158 | .wp_gpio = TEGRA_GPIO_SD4_WP, |
| 159 | .power_gpio = TEGRA_GPIO_SD4_POWER, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 160 | .is_8bit = 1, |
| 161 | }; |
| 162 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 163 | static void __init tegra_harmony_init(void) |
| 164 | { |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 165 | tegra_clk_init_from_table(harmony_clk_init_table); |
| 166 | |
| 167 | harmony_pinmux_init(); |
| 168 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame] | 169 | tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; |
| 170 | tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; |
| 171 | tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; |
| 172 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 173 | platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices)); |
Olof Johansson | de4855d | 2011-03-04 15:26:46 -0800 | [diff] [blame^] | 174 | harmony_i2c_init(); |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | MACHINE_START(HARMONY, "harmony") |
| 178 | .boot_params = 0x00000100, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 179 | .fixup = tegra_harmony_fixup, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 180 | .map_io = tegra_map_common_io, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 181 | .init_early = tegra_init_early, |
| 182 | .init_irq = tegra_init_irq, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 183 | .timer = &tegra_timer, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 184 | .init_machine = tegra_harmony_init, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 185 | MACHINE_END |