xref: /linux/arch/arm/mach-tegra/board-paz00.c (revision f2ee442115c9b6219083c019939a9cc0c9abb2f8)
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/gpio.h>
30 #include <linux/rfkill-gpio.h>
31 
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/time.h>
35 #include <asm/setup.h>
36 
37 #include <mach/iomap.h>
38 #include <mach/irqs.h>
39 #include <mach/sdhci.h>
40 
41 #include "board.h"
42 #include "board-paz00.h"
43 #include "clock.h"
44 #include "devices.h"
45 #include "gpio-names.h"
46 
47 static struct plat_serial8250_port debug_uart_platform_data[] = {
48 	{
49 		/* 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 | UPF_FIXED_TYPE,
54 		.type		= PORT_TEGRA,
55 		.iotype		= UPIO_MEM,
56 		.regshift	= 2,
57 		.uartclk	= 216000000,
58 	}, {
59 		/* serial port on mini-pcie */
60 		.membase	= IO_ADDRESS(TEGRA_UARTD_BASE),
61 		.mapbase	= TEGRA_UARTD_BASE,
62 		.irq		= INT_UARTD,
63 		.flags		= UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
64 		.type		= PORT_TEGRA,
65 		.iotype		= UPIO_MEM,
66 		.regshift	= 2,
67 		.uartclk	= 216000000,
68 	}, {
69 		.flags		= 0
70 	}
71 };
72 
73 static struct platform_device debug_uart = {
74 	.name = "serial8250",
75 	.id = PLAT8250_DEV_PLATFORM,
76 	.dev = {
77 		.platform_data = debug_uart_platform_data,
78 	},
79 };
80 
81 static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
82 	.name		= "wifi_rfkill",
83 	.reset_gpio	= TEGRA_WIFI_RST,
84 	.shutdown_gpio	= TEGRA_WIFI_PWRN,
85 	.type	= RFKILL_TYPE_WLAN,
86 };
87 
88 static struct platform_device wifi_rfkill_device = {
89 	.name	= "rfkill_gpio",
90 	.id	= -1,
91 	.dev	= {
92 		.platform_data = &wifi_rfkill_platform_data,
93 	},
94 };
95 
96 static struct gpio_led gpio_leds[] = {
97 	{
98 		.name			= "wifi-led",
99 		.default_trigger	= "rfkill0",
100 		.gpio			= TEGRA_WIFI_LED,
101 	},
102 };
103 
104 static struct gpio_led_platform_data gpio_led_info = {
105 	.leds		= gpio_leds,
106 	.num_leds	= ARRAY_SIZE(gpio_leds),
107 };
108 
109 static struct platform_device leds_gpio = {
110 	.name	= "leds-gpio",
111 	.id	= -1,
112 	.dev	= {
113 		.platform_data = &gpio_led_info,
114         },
115 };
116 
117 static struct platform_device *paz00_devices[] __initdata = {
118 	&debug_uart,
119 	&tegra_sdhci_device4,
120 	&tegra_sdhci_device1,
121 	&wifi_rfkill_device,
122 	&leds_gpio,
123 };
124 
125 static void paz00_i2c_init(void)
126 {
127 	platform_device_register(&tegra_i2c_device1);
128 	platform_device_register(&tegra_i2c_device2);
129 	platform_device_register(&tegra_i2c_device4);
130 }
131 
132 static void paz00_usb_init(void)
133 {
134 	platform_device_register(&tegra_ehci2_device);
135 	platform_device_register(&tegra_ehci3_device);
136 }
137 
138 static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
139 	struct meminfo *mi)
140 {
141 	mi->nr_banks = 1;
142 	mi->bank[0].start = PHYS_OFFSET;
143 	mi->bank[0].size = 448 * SZ_1M;
144 }
145 
146 static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
147 	/* name		parent		rate		enabled */
148 	{ "uarta",	"pll_p",	216000000,	true },
149 	{ "uartd",	"pll_p",	216000000,	true },
150 
151 	{ "pll_p_out4",	"pll_p",	24000000,	true },
152 	{ "usbd",	"clk_m",	12000000,	false },
153 	{ "usb2",	"clk_m",	12000000,	false },
154 	{ "usb3",	"clk_m",	12000000,	false },
155 
156 	{ NULL,		NULL,		0,		0},
157 };
158 
159 static struct tegra_sdhci_platform_data sdhci_pdata1 = {
160 	.cd_gpio	= TEGRA_GPIO_SD1_CD,
161 	.wp_gpio	= TEGRA_GPIO_SD1_WP,
162 	.power_gpio	= TEGRA_GPIO_SD1_POWER,
163 };
164 
165 static struct tegra_sdhci_platform_data sdhci_pdata4 = {
166 	.cd_gpio	= -1,
167 	.wp_gpio	= -1,
168 	.power_gpio	= -1,
169 	.is_8bit	= 1,
170 };
171 
172 static void __init tegra_paz00_init(void)
173 {
174 	tegra_clk_init_from_table(paz00_clk_init_table);
175 
176 	paz00_pinmux_init();
177 
178 	tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
179 	tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
180 
181 	platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
182 
183 	paz00_i2c_init();
184 	paz00_usb_init();
185 }
186 
187 MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
188 	.atag_offset	= 0x100,
189 	.fixup		= tegra_paz00_fixup,
190 	.map_io         = tegra_map_common_io,
191 	.init_early	= tegra_init_early,
192 	.init_irq       = tegra_init_irq,
193 	.timer          = &tegra_timer,
194 	.init_machine   = tegra_paz00_init,
195 MACHINE_END
196