Merge tag 'cleanup-initcall' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[linux-2.6/btrfs-unstable.git] / arch / arm / mach-tegra / board-paz00.c
blobbbc1907e98a69875144b32e367629a9f8b2739f9
1 /*
2 * arch/arm/mach-tegra/board-paz00.c
4 * Copyright (C) 2011 Marc Dietrich <marvin24@gmx.de>
6 * Based on board-harmony.c
7 * Copyright (C) 2010 Google, Inc.
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/serial_8250.h>
24 #include <linux/of_serial.h>
25 #include <linux/clk.h>
26 #include <linux/dma-mapping.h>
27 #include <linux/gpio_keys.h>
28 #include <linux/pda_power.h>
29 #include <linux/io.h>
30 #include <linux/input.h>
31 #include <linux/i2c.h>
32 #include <linux/gpio.h>
33 #include <linux/rfkill-gpio.h>
35 #include <asm/hardware/gic.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/time.h>
39 #include <asm/setup.h>
41 #include <mach/iomap.h>
42 #include <mach/irqs.h>
43 #include <mach/sdhci.h>
45 #include "board.h"
46 #include "board-paz00.h"
47 #include "clock.h"
48 #include "devices.h"
49 #include "gpio-names.h"
51 static struct plat_serial8250_port debug_uart_platform_data[] = {
53 /* serial port on JP1 */
54 .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
55 .mapbase = TEGRA_UARTA_BASE,
56 .irq = INT_UARTA,
57 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
58 .type = PORT_TEGRA,
59 .handle_break = tegra_serial_handle_break,
60 .iotype = UPIO_MEM,
61 .regshift = 2,
62 .uartclk = 216000000,
63 }, {
64 /* serial port on mini-pcie */
65 .membase = IO_ADDRESS(TEGRA_UARTC_BASE),
66 .mapbase = TEGRA_UARTC_BASE,
67 .irq = INT_UARTC,
68 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
69 .type = PORT_TEGRA,
70 .handle_break = tegra_serial_handle_break,
71 .iotype = UPIO_MEM,
72 .regshift = 2,
73 .uartclk = 216000000,
74 }, {
75 .flags = 0
79 static struct platform_device debug_uart = {
80 .name = "serial8250",
81 .id = PLAT8250_DEV_PLATFORM,
82 .dev = {
83 .platform_data = debug_uart_platform_data,
87 static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
88 .name = "wifi_rfkill",
89 .reset_gpio = TEGRA_WIFI_RST,
90 .shutdown_gpio = TEGRA_WIFI_PWRN,
91 .type = RFKILL_TYPE_WLAN,
94 static struct platform_device wifi_rfkill_device = {
95 .name = "rfkill_gpio",
96 .id = -1,
97 .dev = {
98 .platform_data = &wifi_rfkill_platform_data,
102 static struct gpio_led gpio_leds[] = {
104 .name = "wifi-led",
105 .default_trigger = "rfkill0",
106 .gpio = TEGRA_WIFI_LED,
110 static struct gpio_led_platform_data gpio_led_info = {
111 .leds = gpio_leds,
112 .num_leds = ARRAY_SIZE(gpio_leds),
115 static struct platform_device leds_gpio = {
116 .name = "leds-gpio",
117 .id = -1,
118 .dev = {
119 .platform_data = &gpio_led_info,
123 static struct gpio_keys_button paz00_gpio_keys_buttons[] = {
125 .code = KEY_POWER,
126 .gpio = TEGRA_GPIO_POWERKEY,
127 .active_low = 1,
128 .desc = "Power",
129 .type = EV_KEY,
130 .wakeup = 1,
134 static struct gpio_keys_platform_data paz00_gpio_keys = {
135 .buttons = paz00_gpio_keys_buttons,
136 .nbuttons = ARRAY_SIZE(paz00_gpio_keys_buttons),
139 static struct platform_device gpio_keys_device = {
140 .name = "gpio-keys",
141 .id = -1,
142 .dev = {
143 .platform_data = &paz00_gpio_keys,
147 static struct platform_device *paz00_devices[] __initdata = {
148 &debug_uart,
149 &tegra_sdhci_device4,
150 &tegra_sdhci_device1,
151 &wifi_rfkill_device,
152 &leds_gpio,
153 &gpio_keys_device,
156 static void paz00_i2c_init(void)
158 platform_device_register(&tegra_i2c_device1);
159 platform_device_register(&tegra_i2c_device2);
160 platform_device_register(&tegra_i2c_device4);
163 static void paz00_usb_init(void)
165 tegra_ehci2_ulpi_phy_config.reset_gpio = TEGRA_ULPI_RST;
167 platform_device_register(&tegra_ehci2_device);
168 platform_device_register(&tegra_ehci3_device);
171 static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
172 struct meminfo *mi)
174 mi->nr_banks = 1;
175 mi->bank[0].start = PHYS_OFFSET;
176 mi->bank[0].size = 448 * SZ_1M;
179 static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
180 /* name parent rate enabled */
181 { "uarta", "pll_p", 216000000, true },
182 { "uartc", "pll_p", 216000000, true },
184 { "usbd", "clk_m", 12000000, false },
185 { "usb2", "clk_m", 12000000, false },
186 { "usb3", "clk_m", 12000000, false },
188 { NULL, NULL, 0, 0},
191 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
192 .cd_gpio = TEGRA_GPIO_SD1_CD,
193 .wp_gpio = TEGRA_GPIO_SD1_WP,
194 .power_gpio = TEGRA_GPIO_SD1_POWER,
197 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
198 .cd_gpio = -1,
199 .wp_gpio = -1,
200 .power_gpio = -1,
201 .is_8bit = 1,
204 static void __init tegra_paz00_init(void)
206 tegra_clk_init_from_table(paz00_clk_init_table);
208 paz00_pinmux_init();
210 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
211 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
213 platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
215 paz00_i2c_init();
216 paz00_usb_init();
219 MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
220 .atag_offset = 0x100,
221 .fixup = tegra_paz00_fixup,
222 .map_io = tegra_map_common_io,
223 .init_early = tegra20_init_early,
224 .init_irq = tegra_init_irq,
225 .handle_irq = gic_handle_irq,
226 .timer = &tegra_timer,
227 .init_machine = tegra_paz00_init,
228 .init_late = tegra_init_late,
229 .restart = tegra_assert_system_reset,
230 MACHINE_END