465768eebacdac168c4f5fe3d444da4254bd2165
[pandora-kernel.git] / arch / arm / mach-tegra / board-paz00.c
1 /*
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>
28 #include <linux/i2c.h>
29 #include <linux/platform_data/tegra_usb.h>
30
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>
39 #include <mach/usb_phy.h>
40 #include <mach/gpio.h>
41
42 #include "board.h"
43 #include "board-paz00.h"
44 #include "clock.h"
45 #include "devices.h"
46 #include "gpio-names.h"
47
48 static struct plat_serial8250_port debug_uart_platform_data[] = {
49         {
50                 .membase        = IO_ADDRESS(TEGRA_UARTD_BASE),
51                 .mapbase        = TEGRA_UARTD_BASE,
52                 .irq            = INT_UARTD,
53                 .flags          = UPF_BOOT_AUTOCONF,
54                 .iotype         = UPIO_MEM,
55                 .regshift       = 2,
56                 .uartclk        = 216000000,
57         }, {
58                 .flags          = 0
59         }
60 };
61
62 static struct platform_device debug_uart = {
63         .name = "serial8250",
64         .id = PLAT8250_DEV_PLATFORM,
65         .dev = {
66                 .platform_data = debug_uart_platform_data,
67         },
68 };
69
70 static struct platform_device *paz00_devices[] __initdata = {
71         &debug_uart,
72         &tegra_sdhci_device1,
73         &tegra_sdhci_device4,
74 };
75
76 static void paz00_i2c_init(void)
77 {
78         platform_device_register(&tegra_i2c_device1);
79         platform_device_register(&tegra_i2c_device2);
80         platform_device_register(&tegra_i2c_device4);
81 }
82
83 static struct tegra_ulpi_config ulpi_phy_config = {
84                 .reset_gpio = TEGRA_ULPI_RST,
85                 .clk = "cdev2",
86 };
87
88 static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
89                 [0] = {
90                         .operating_mode = TEGRA_USB_OTG,
91                         .power_down_on_bus_suspend = 1,
92                 },
93                 [1] = {
94                         .phy_config = &ulpi_phy_config,
95                         .operating_mode = TEGRA_USB_HOST,
96                         .power_down_on_bus_suspend = 1,
97                 },
98                 [2] = {
99                         .operating_mode = TEGRA_USB_HOST,
100                         .power_down_on_bus_suspend = 1,
101                 },
102 };
103
104 static void paz00_usb_init(void)
105 {
106         tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
107         tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
108
109         platform_device_register(&tegra_ehci2_device);
110         platform_device_register(&tegra_ehci3_device);
111 }
112
113 static void __init tegra_paz00_fixup(struct machine_desc *desc,
114         struct tag *tags, char **cmdline, struct meminfo *mi)
115 {
116         mi->nr_banks = 1;
117         mi->bank[0].start = PHYS_OFFSET;
118         mi->bank[0].size = 448 * SZ_1M;
119 }
120
121 static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
122         /* name         parent          rate            enabled */
123         { "uartd",      "pll_p",        216000000,      true },
124         { NULL,         NULL,           0,              0},
125 };
126
127 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
128         .cd_gpio        = TEGRA_GPIO_SD1_CD,
129         .wp_gpio        = TEGRA_GPIO_SD1_WP,
130         .power_gpio     = TEGRA_GPIO_SD1_POWER,
131 };
132
133 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
134         .cd_gpio        = -1,
135         .wp_gpio        = -1,
136         .power_gpio     = -1,
137         .is_8bit        = 1,
138 };
139
140 static void __init tegra_paz00_init(void)
141 {
142         tegra_clk_init_from_table(paz00_clk_init_table);
143
144         paz00_pinmux_init();
145
146         tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
147         tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
148
149         platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
150
151         paz00_i2c_init();
152         paz00_usb_init();
153 }
154
155 MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
156         .boot_params    = 0x00000100,
157         .fixup          = tegra_paz00_fixup,
158         .map_io         = tegra_map_common_io,
159         .init_early     = tegra_init_early,
160         .init_irq       = tegra_init_irq,
161         .timer          = &tegra_timer,
162         .init_machine   = tegra_paz00_init,
163 MACHINE_END