blob: 51d847f7fca9a18928a0ef1aec7e57c9488d85ed [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>
24#include <linux/clk.h>
25#include <linux/dma-mapping.h>
26#include <linux/pda_power.h>
27#include <linux/io.h>
Marc Dietrichdda9cd22011-05-19 14:08:26 +020028#include <linux/i2c.h>
Marc Dietrich9aaa15a2011-08-07 21:00:52 +020029#include <linux/rfkill-gpio.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010030
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/time.h>
34#include <asm/setup.h>
35
36#include <mach/iomap.h>
37#include <mach/irqs.h>
38#include <mach/sdhci.h>
Marc Dietrich13db7a72011-05-19 14:08:27 +020039#include <mach/gpio.h>
Marc Dietrich65b935a2011-03-07 21:01:31 +010040
41#include "board.h"
42#include "board-paz00.h"
43#include "clock.h"
44#include "devices.h"
45#include "gpio-names.h"
46
47static struct plat_serial8250_port debug_uart_platform_data[] = {
48 {
Marc Dietrichde7164d2011-08-07 21:00:51 +020049 /* serial port on JP1 */
50 .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
51 .mapbase = TEGRA_UARTA_BASE,
52 .irq = INT_UARTA,
53 .flags = UPF_BOOT_AUTOCONF,
54 .iotype = UPIO_MEM,
55 .regshift = 2,
56 .uartclk = 216000000,
57 }, {
58 /* serial port on mini-pcie */
Marc Dietrich65b935a2011-03-07 21:01:31 +010059 .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
60 .mapbase = TEGRA_UARTD_BASE,
61 .irq = INT_UARTD,
62 .flags = UPF_BOOT_AUTOCONF,
63 .iotype = UPIO_MEM,
64 .regshift = 2,
65 .uartclk = 216000000,
66 }, {
67 .flags = 0
68 }
69};
70
71static struct platform_device debug_uart = {
72 .name = "serial8250",
73 .id = PLAT8250_DEV_PLATFORM,
74 .dev = {
75 .platform_data = debug_uart_platform_data,
76 },
77};
78
Marc Dietrich9aaa15a2011-08-07 21:00:52 +020079static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
80 .name = "wifi_rfkill",
81 .reset_gpio = TEGRA_WIFI_RST,
82 .shutdown_gpio = TEGRA_WIFI_PWRN,
83 .type = RFKILL_TYPE_WLAN,
84};
85
86static struct platform_device wifi_rfkill_device = {
87 .name = "rfkill_gpio",
88 .id = -1,
89 .dev = {
90 .platform_data = &wifi_rfkill_platform_data,
91 },
92};
93
Marc Dietrich8e219eb2011-08-07 21:00:53 +020094static struct gpio_led gpio_leds[] = {
95 {
96 .name = "wifi-led",
97 .default_trigger = "rfkill0",
98 .gpio = TEGRA_WIFI_LED,
99 },
100};
101
102static struct gpio_led_platform_data gpio_led_info = {
103 .leds = gpio_leds,
104 .num_leds = ARRAY_SIZE(gpio_leds),
105};
106
107static struct platform_device leds_gpio = {
108 .name = "leds-gpio",
109 .id = -1,
110 .dev = {
111 .platform_data = &gpio_led_info,
112 },
113};
114
Marc Dietrich65b935a2011-03-07 21:01:31 +0100115static struct platform_device *paz00_devices[] __initdata = {
116 &debug_uart,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100117 &tegra_sdhci_device4,
Marc Dietrich24810cb2011-08-07 21:00:55 +0200118 &tegra_sdhci_device1,
Marc Dietrich9aaa15a2011-08-07 21:00:52 +0200119 &wifi_rfkill_device,
Marc Dietrich8e219eb2011-08-07 21:00:53 +0200120 &leds_gpio,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100121};
122
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200123static void paz00_i2c_init(void)
124{
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200125 platform_device_register(&tegra_i2c_device1);
126 platform_device_register(&tegra_i2c_device2);
127 platform_device_register(&tegra_i2c_device4);
128}
129
Marc Dietrich13db7a72011-05-19 14:08:27 +0200130static void paz00_usb_init(void)
131{
Marc Dietrich13db7a72011-05-19 14:08:27 +0200132 platform_device_register(&tegra_ehci2_device);
133 platform_device_register(&tegra_ehci3_device);
134}
135
Marc Dietrich65b935a2011-03-07 21:01:31 +0100136static void __init tegra_paz00_fixup(struct machine_desc *desc,
137 struct tag *tags, char **cmdline, struct meminfo *mi)
138{
139 mi->nr_banks = 1;
140 mi->bank[0].start = PHYS_OFFSET;
141 mi->bank[0].size = 448 * SZ_1M;
142}
143
144static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
145 /* name parent rate enabled */
Marc Dietrichde7164d2011-08-07 21:00:51 +0200146 { "uarta", "pll_p", 216000000, true },
Marc Dietrich65b935a2011-03-07 21:01:31 +0100147 { "uartd", "pll_p", 216000000, true },
148 { NULL, NULL, 0, 0},
149};
150
Marc Dietrich65b935a2011-03-07 21:01:31 +0100151static struct tegra_sdhci_platform_data sdhci_pdata1 = {
152 .cd_gpio = TEGRA_GPIO_SD1_CD,
153 .wp_gpio = TEGRA_GPIO_SD1_WP,
154 .power_gpio = TEGRA_GPIO_SD1_POWER,
155};
156
Marc Dietrich41cdc622011-05-19 14:08:28 +0200157static struct tegra_sdhci_platform_data sdhci_pdata4 = {
Marc Dietrich65b935a2011-03-07 21:01:31 +0100158 .cd_gpio = -1,
159 .wp_gpio = -1,
160 .power_gpio = -1,
Marc Dietrich65b935a2011-03-07 21:01:31 +0100161 .is_8bit = 1,
162};
163
164static void __init tegra_paz00_init(void)
165{
166 tegra_clk_init_from_table(paz00_clk_init_table);
167
168 paz00_pinmux_init();
169
170 tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
Marc Dietrich65b935a2011-03-07 21:01:31 +0100171 tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
172
173 platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
Marc Dietrichdda9cd22011-05-19 14:08:26 +0200174
175 paz00_i2c_init();
Marc Dietrich13db7a72011-05-19 14:08:27 +0200176 paz00_usb_init();
Marc Dietrich65b935a2011-03-07 21:01:31 +0100177}
178
Marc Dietrichd1890d4d2011-05-19 14:08:29 +0200179MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
Marc Dietrich65b935a2011-03-07 21:01:31 +0100180 .boot_params = 0x00000100,
181 .fixup = tegra_paz00_fixup,
182 .map_io = tegra_map_common_io,
183 .init_early = tegra_init_early,
184 .init_irq = tegra_init_irq,
185 .timer = &tegra_timer,
186 .init_machine = tegra_paz00_init,
187MACHINE_END