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. |
| 5 | * |
| 6 | * This software is licensed under the terms of the GNU General Public |
| 7 | * License version 2, as published by the Free Software Foundation, and |
| 8 | * may be copied, distributed, and modified under those terms. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/serial_8250.h> |
| 21 | #include <linux/clk.h> |
| 22 | #include <linux/dma-mapping.h> |
| 23 | #include <linux/pda_power.h> |
| 24 | #include <linux/io.h> |
| 25 | |
| 26 | #include <asm/mach-types.h> |
| 27 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/time.h> |
| 29 | #include <asm/setup.h> |
| 30 | |
| 31 | #include <mach/iomap.h> |
| 32 | #include <mach/irqs.h> |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame^] | 33 | #include <mach/sdhci.h> |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 34 | |
| 35 | #include "board.h" |
| 36 | #include "board-harmony.h" |
| 37 | #include "clock.h" |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame^] | 38 | #include "devices.h" |
| 39 | #include "gpio-names.h" |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 40 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 41 | static struct plat_serial8250_port debug_uart_platform_data[] = { |
| 42 | { |
| 43 | .membase = IO_ADDRESS(TEGRA_UARTD_BASE), |
| 44 | .mapbase = TEGRA_UARTD_BASE, |
| 45 | .irq = INT_UARTD, |
| 46 | .flags = UPF_BOOT_AUTOCONF, |
| 47 | .iotype = UPIO_MEM, |
| 48 | .regshift = 2, |
| 49 | .uartclk = 216000000, |
| 50 | }, { |
| 51 | .flags = 0 |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | static struct platform_device debug_uart = { |
| 56 | .name = "serial8250", |
| 57 | .id = PLAT8250_DEV_PLATFORM, |
| 58 | .dev = { |
| 59 | .platform_data = debug_uart_platform_data, |
| 60 | }, |
| 61 | }; |
| 62 | |
| 63 | static struct platform_device *harmony_devices[] __initdata = { |
| 64 | &debug_uart, |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame^] | 65 | &tegra_sdhci_device1, |
| 66 | &tegra_sdhci_device2, |
| 67 | &tegra_sdhci_device4, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | static void __init tegra_harmony_fixup(struct machine_desc *desc, |
| 71 | struct tag *tags, char **cmdline, struct meminfo *mi) |
| 72 | { |
| 73 | mi->nr_banks = 2; |
| 74 | mi->bank[0].start = PHYS_OFFSET; |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 75 | mi->bank[0].size = 448 * SZ_1M; |
| 76 | mi->bank[1].start = SZ_512M; |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 77 | mi->bank[1].size = SZ_512M; |
| 78 | } |
| 79 | |
| 80 | static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = { |
| 81 | /* name parent rate enabled */ |
| 82 | { "uartd", "pll_p", 216000000, true }, |
| 83 | { NULL, NULL, 0, 0}, |
| 84 | }; |
| 85 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame^] | 86 | |
| 87 | static struct tegra_sdhci_platform_data sdhci_pdata1 = { |
| 88 | .cd_gpio = -1, |
| 89 | .wp_gpio = -1, |
| 90 | .power_gpio = -1, |
| 91 | }; |
| 92 | |
| 93 | static struct tegra_sdhci_platform_data sdhci_pdata2 = { |
| 94 | .cd_gpio = TEGRA_GPIO_PI5, |
| 95 | .wp_gpio = TEGRA_GPIO_PH1, |
| 96 | .power_gpio = TEGRA_GPIO_PT3, |
| 97 | }; |
| 98 | |
| 99 | static struct tegra_sdhci_platform_data sdhci_pdata4 = { |
| 100 | .cd_gpio = TEGRA_GPIO_PH2, |
| 101 | .wp_gpio = TEGRA_GPIO_PH3, |
| 102 | .power_gpio = TEGRA_GPIO_PI6, |
| 103 | .is_8bit = 1, |
| 104 | }; |
| 105 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 106 | static void __init tegra_harmony_init(void) |
| 107 | { |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 108 | tegra_clk_init_from_table(harmony_clk_init_table); |
| 109 | |
| 110 | harmony_pinmux_init(); |
| 111 | |
Olof Johansson | 875d4af | 2011-02-19 16:39:37 -0800 | [diff] [blame^] | 112 | tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; |
| 113 | tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2; |
| 114 | tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; |
| 115 | |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 116 | platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices)); |
| 117 | } |
| 118 | |
| 119 | MACHINE_START(HARMONY, "harmony") |
| 120 | .boot_params = 0x00000100, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 121 | .fixup = tegra_harmony_fixup, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 122 | .map_io = tegra_map_common_io, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 123 | .init_early = tegra_init_early, |
| 124 | .init_irq = tegra_init_irq, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 125 | .timer = &tegra_timer, |
Colin Cross | 0cf6230 | 2011-02-21 17:10:14 -0800 | [diff] [blame] | 126 | .init_machine = tegra_harmony_init, |
Colin Cross | 42a7bf4 | 2010-02-10 17:13:07 -0800 | [diff] [blame] | 127 | MACHINE_END |