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