blob: 4b64af5cab27bdbbb4251053c1ae9e702b1fbcb3 [file] [log] [blame]
Marc Dietrich65b935a2011-03-07 21:01:31 +01001/*
2 * arch/arm/mach-tegra/board-paz00.c
3 *
4 * Copyright (C) 2011 Marc Dietrich <marvin24@gmx.de>
5 *
6 * Based on board-harmony.c
7 * Copyright (C) 2010 Google, Inc.
8 *
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.
12 *
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.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23#include <linux/serial_8250.h>
Dan Williamsbf03f652012-04-10 14:10:53 -070024#include <linux/of_serial.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010025#include <linux/clk.h>
26#include <linux/dma-mapping.h>
Marc Dietrichc1c374d2011-11-01 10:37:03 +000027#include <linux/gpio_keys.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010028#include <linux/pda_power.h>
29#include <linux/io.h>
Marc Dietrichc1c374d2011-11-01 10:37:03 +000030#include <linux/input.h>
Marc Dietrichdda9cd22011-05-19 14:08:26 +020031#include <linux/i2c.h>
Arnd Bergmann33533272011-10-21 16:46:26 +020032#include <linux/gpio.h>
Marc Dietrich9aaa15a2011-08-07 21:00:52 +020033#include <linux/rfkill-gpio.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010034
Marc Zyngierafed2a22011-09-06 10:23:45 +010035#include <asm/hardware/gic.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010036#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/time.h>
39#include <asm/setup.h>
40
41#include <mach/iomap.h>
42#include <mach/irqs.h>
43#include <mach/sdhci.h>
44
45#include "board.h"
46#include "board-paz00.h"
47#include "clock.h"
48#include "devices.h"
49#include "gpio-names.h"
50
51static struct plat_serial8250_port debug_uart_platform_data[] = {
52 {
Marc Dietrichde7164d2011-08-07 21:00:51 +020053 /* serial port on JP1 */
54 .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
55 .mapbase = TEGRA_UARTA_BASE,
56 .irq = INT_UARTA,
Stephen Warren11b3adb2011-08-08 15:01:05 -060057 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
58 .type = PORT_TEGRA,
Dan Williamsbf03f652012-04-10 14:10:53 -070059 .handle_break = tegra_serial_handle_break,
Marc Dietrichde7164d2011-08-07 21:00:51 +020060 .iotype = UPIO_MEM,
61 .regshift = 2,
62 .uartclk = 216000000,
63 }, {
64 /* serial port on mini-pcie */
Marc Dietrich0783a9b2012-01-28 20:03:05 +010065 .membase = IO_ADDRESS(TEGRA_UARTC_BASE),
66 .mapbase = TEGRA_UARTC_BASE,
67 .irq = INT_UARTC,
Stephen Warren11b3adb2011-08-08 15:01:05 -060068 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
69 .type = PORT_TEGRA,
Dan Williamsbf03f652012-04-10 14:10:53 -070070 .handle_break = tegra_serial_handle_break,
Marc Dietrich65b935a2011-03-07 21:01:31 +010071 .iotype = UPIO_MEM,
72 .regshift = 2,
73 .uartclk = 216000000,
74 }, {
75 .flags = 0
76 }
77};
78
79static struct platform_device debug_uart = {
80 .name = "serial8250",
81 .id = PLAT8250_DEV_PLATFORM,
82 .dev = {
83 .platform_data = debug_uart_platform_data,
84 },
85};
86
Marc Dietrich9aaa15a2011-08-07 21:00:52 +020087static 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,
92};
93
94static struct platform_device wifi_rfkill_device = {
95 .name = "rfkill_gpio",
96 .id = -1,
97 .dev = {
98 .platform_data = &wifi_rfkill_platform_data,
99 },
100};
101
Marc Dietrich8e219eb2011-08-07 21:00:53 +0200102static struct gpio_led gpio_leds[] = {
103 {
104 .name = "wifi-led",
105 .default_trigger = "rfkill0",
106 .gpio = TEGRA_WIFI_LED,
107 },
108};
109
110static struct gpio_led_platform_data gpio_led_info = {
111 .leds = gpio_leds,
112 .num_leds = ARRAY_SIZE(gpio_leds),
113};
114
115static struct platform_device leds_gpio = {
116 .name = "leds-gpio",
117 .id = -1,
118 .dev = {
119 .platform_data = &gpio_led_info,
120 },
121};
122
Marc Dietrichc1c374d2011-11-01 10:37:03 +0000123static struct gpio_keys_button paz00_gpio_keys_buttons[] = {
124 {
125 .code = KEY_POWER,
126 .gpio = TEGRA_GPIO_POWERKEY,
127 .active_low = 1,
128 .desc = "Power",
129 .type = EV_KEY,
130 .wakeup = 1,
131 },
132};
133
134static struct gpio_keys_platform_data paz00_gpio_keys = {
135 .buttons = paz00_gpio_keys_buttons,
136 .nbuttons = ARRAY_SIZE(paz00_gpio_keys_buttons),
137};
138
139static struct platform_device gpio_keys_device = {
140 .name = "gpio-keys",
141 .id = -1,
142 .dev = {
143 .platform_data = &paz00_gpio_keys,
144 },
145};
146
Marc Dietrich65b935a2011-03-07 21:01:31 +0100147static struct platform_device *paz00_devices[] __initdata = {
148 &debug_uart,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100149 &tegra_sdhci_device4,
Marc Dietrich24810cb2011-08-07 21:00:55 +0200150 &tegra_sdhci_device1,
Marc Dietrich8e219eb2011-08-07 21:00:53 +0200151 &leds_gpio,
Marc Dietrichc1c374d2011-11-01 10:37:03 +0000152 &gpio_keys_device,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100153};
154
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200155static void paz00_i2c_init(void)
156{
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200157 platform_device_register(&tegra_i2c_device1);
158 platform_device_register(&tegra_i2c_device2);
159 platform_device_register(&tegra_i2c_device4);
160}
161
Marc Dietrich13db7a72011-05-19 14:08:27 +0200162static void paz00_usb_init(void)
163{
Stephen Warren60d148b2012-04-12 15:03:52 -0600164 tegra_ehci2_ulpi_phy_config.reset_gpio = TEGRA_ULPI_RST;
165
Marc Dietrich13db7a72011-05-19 14:08:27 +0200166 platform_device_register(&tegra_ehci2_device);
167 platform_device_register(&tegra_ehci3_device);
168}
169
Russell King0744a3e2010-12-20 10:37:50 +0000170static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
171 struct meminfo *mi)
Marc Dietrich65b935a2011-03-07 21:01:31 +0100172{
173 mi->nr_banks = 1;
174 mi->bank[0].start = PHYS_OFFSET;
175 mi->bank[0].size = 448 * SZ_1M;
176}
177
178static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
179 /* name parent rate enabled */
Marc Dietrichde7164d2011-08-07 21:00:51 +0200180 { "uarta", "pll_p", 216000000, true },
Marc Dietrich0783a9b2012-01-28 20:03:05 +0100181 { "uartc", "pll_p", 216000000, true },
Marc Dietrichad9f6672011-08-10 19:21:56 +0200182
Marc Dietrichad9f6672011-08-10 19:21:56 +0200183 { "usbd", "clk_m", 12000000, false },
184 { "usb2", "clk_m", 12000000, false },
185 { "usb3", "clk_m", 12000000, false },
186
Marc Dietrich65b935a2011-03-07 21:01:31 +0100187 { NULL, NULL, 0, 0},
188};
189
Marc Dietrich65b935a2011-03-07 21:01:31 +0100190static struct tegra_sdhci_platform_data sdhci_pdata1 = {
191 .cd_gpio = TEGRA_GPIO_SD1_CD,
192 .wp_gpio = TEGRA_GPIO_SD1_WP,
193 .power_gpio = TEGRA_GPIO_SD1_POWER,
194};
195
Marc Dietrich41cdc622011-05-19 14:08:28 +0200196static struct tegra_sdhci_platform_data sdhci_pdata4 = {
Marc Dietrich65b935a2011-03-07 21:01:31 +0100197 .cd_gpio = -1,
198 .wp_gpio = -1,
199 .power_gpio = -1,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100200 .is_8bit = 1,
201};
202
Stephen Warrenb64a02c2012-05-02 16:05:44 -0600203void __init tegra_paz00_wifikill_init(void)
204{
205 platform_device_register(&wifi_rfkill_device);
206}
207
Marc Dietrich65b935a2011-03-07 21:01:31 +0100208static void __init tegra_paz00_init(void)
209{
210 tegra_clk_init_from_table(paz00_clk_init_table);
211
212 paz00_pinmux_init();
213
214 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
Marc Dietrich65b935a2011-03-07 21:01:31 +0100215 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
216
217 platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
Stephen Warrenb64a02c2012-05-02 16:05:44 -0600218 tegra_paz00_wifikill_init();
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200219
220 paz00_i2c_init();
Marc Dietrich13db7a72011-05-19 14:08:27 +0200221 paz00_usb_init();
Marc Dietrich65b935a2011-03-07 21:01:31 +0100222}
223
Marc Dietrichd1890d4d2011-05-19 14:08:29 +0200224MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
Nicolas Pitreb61cafe2011-07-05 22:38:18 -0400225 .atag_offset = 0x100,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100226 .fixup = tegra_paz00_fixup,
227 .map_io = tegra_map_common_io,
Peter De Schrijverc37c07d2011-12-14 17:03:17 +0200228 .init_early = tegra20_init_early,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100229 .init_irq = tegra_init_irq,
Marc Zyngierafed2a22011-09-06 10:23:45 +0100230 .handle_irq = gic_handle_irq,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100231 .timer = &tegra_timer,
232 .init_machine = tegra_paz00_init,
Shawn Guo390e0cf2012-05-02 17:08:06 +0800233 .init_late = tegra_init_late,
Russell Kingabea3f22011-11-05 08:48:33 +0000234 .restart = tegra_assert_system_reset,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100235MACHINE_END