Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 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> |
Marc Dietrich | c1c374d | 2011-11-01 10:37:03 +0000 | [diff] [blame^] | 26 | #include <linux/gpio_keys.h> |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 27 | #include <linux/pda_power.h> |
| 28 | #include <linux/io.h> |
Marc Dietrich | c1c374d | 2011-11-01 10:37:03 +0000 | [diff] [blame^] | 29 | #include <linux/input.h> |
Marc Dietrich | dda9cd2 | 2011-05-19 14:08:26 +0200 | [diff] [blame] | 30 | #include <linux/i2c.h> |
Arnd Bergmann | 3353327 | 2011-10-21 16:46:26 +0200 | [diff] [blame] | 31 | #include <linux/gpio.h> |
Marc Dietrich | 9aaa15a | 2011-08-07 21:00:52 +0200 | [diff] [blame] | 32 | #include <linux/rfkill-gpio.h> |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 33 | |
| 34 | #include <asm/mach-types.h> |
| 35 | #include <asm/mach/arch.h> |
| 36 | #include <asm/mach/time.h> |
| 37 | #include <asm/setup.h> |
| 38 | |
| 39 | #include <mach/iomap.h> |
| 40 | #include <mach/irqs.h> |
| 41 | #include <mach/sdhci.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 | { |
Marc Dietrich | de7164d | 2011-08-07 21:00:51 +0200 | [diff] [blame] | 51 | /* serial port on JP1 */ |
| 52 | .membase = IO_ADDRESS(TEGRA_UARTA_BASE), |
| 53 | .mapbase = TEGRA_UARTA_BASE, |
| 54 | .irq = INT_UARTA, |
Stephen Warren | 11b3adb | 2011-08-08 15:01:05 -0600 | [diff] [blame] | 55 | .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, |
| 56 | .type = PORT_TEGRA, |
Marc Dietrich | de7164d | 2011-08-07 21:00:51 +0200 | [diff] [blame] | 57 | .iotype = UPIO_MEM, |
| 58 | .regshift = 2, |
| 59 | .uartclk = 216000000, |
| 60 | }, { |
| 61 | /* serial port on mini-pcie */ |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 62 | .membase = IO_ADDRESS(TEGRA_UARTD_BASE), |
| 63 | .mapbase = TEGRA_UARTD_BASE, |
| 64 | .irq = INT_UARTD, |
Stephen Warren | 11b3adb | 2011-08-08 15:01:05 -0600 | [diff] [blame] | 65 | .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, |
| 66 | .type = PORT_TEGRA, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 67 | .iotype = UPIO_MEM, |
| 68 | .regshift = 2, |
| 69 | .uartclk = 216000000, |
| 70 | }, { |
| 71 | .flags = 0 |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | static struct platform_device debug_uart = { |
| 76 | .name = "serial8250", |
| 77 | .id = PLAT8250_DEV_PLATFORM, |
| 78 | .dev = { |
| 79 | .platform_data = debug_uart_platform_data, |
| 80 | }, |
| 81 | }; |
| 82 | |
Marc Dietrich | 9aaa15a | 2011-08-07 21:00:52 +0200 | [diff] [blame] | 83 | static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = { |
| 84 | .name = "wifi_rfkill", |
| 85 | .reset_gpio = TEGRA_WIFI_RST, |
| 86 | .shutdown_gpio = TEGRA_WIFI_PWRN, |
| 87 | .type = RFKILL_TYPE_WLAN, |
| 88 | }; |
| 89 | |
| 90 | static struct platform_device wifi_rfkill_device = { |
| 91 | .name = "rfkill_gpio", |
| 92 | .id = -1, |
| 93 | .dev = { |
| 94 | .platform_data = &wifi_rfkill_platform_data, |
| 95 | }, |
| 96 | }; |
| 97 | |
Marc Dietrich | 8e219eb | 2011-08-07 21:00:53 +0200 | [diff] [blame] | 98 | static struct gpio_led gpio_leds[] = { |
| 99 | { |
| 100 | .name = "wifi-led", |
| 101 | .default_trigger = "rfkill0", |
| 102 | .gpio = TEGRA_WIFI_LED, |
| 103 | }, |
| 104 | }; |
| 105 | |
| 106 | static struct gpio_led_platform_data gpio_led_info = { |
| 107 | .leds = gpio_leds, |
| 108 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 109 | }; |
| 110 | |
| 111 | static struct platform_device leds_gpio = { |
| 112 | .name = "leds-gpio", |
| 113 | .id = -1, |
| 114 | .dev = { |
| 115 | .platform_data = &gpio_led_info, |
| 116 | }, |
| 117 | }; |
| 118 | |
Marc Dietrich | c1c374d | 2011-11-01 10:37:03 +0000 | [diff] [blame^] | 119 | static struct gpio_keys_button paz00_gpio_keys_buttons[] = { |
| 120 | { |
| 121 | .code = KEY_POWER, |
| 122 | .gpio = TEGRA_GPIO_POWERKEY, |
| 123 | .active_low = 1, |
| 124 | .desc = "Power", |
| 125 | .type = EV_KEY, |
| 126 | .wakeup = 1, |
| 127 | }, |
| 128 | }; |
| 129 | |
| 130 | static struct gpio_keys_platform_data paz00_gpio_keys = { |
| 131 | .buttons = paz00_gpio_keys_buttons, |
| 132 | .nbuttons = ARRAY_SIZE(paz00_gpio_keys_buttons), |
| 133 | }; |
| 134 | |
| 135 | static struct platform_device gpio_keys_device = { |
| 136 | .name = "gpio-keys", |
| 137 | .id = -1, |
| 138 | .dev = { |
| 139 | .platform_data = &paz00_gpio_keys, |
| 140 | }, |
| 141 | }; |
| 142 | |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 143 | static struct platform_device *paz00_devices[] __initdata = { |
| 144 | &debug_uart, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 145 | &tegra_sdhci_device4, |
Marc Dietrich | 24810cb | 2011-08-07 21:00:55 +0200 | [diff] [blame] | 146 | &tegra_sdhci_device1, |
Marc Dietrich | 9aaa15a | 2011-08-07 21:00:52 +0200 | [diff] [blame] | 147 | &wifi_rfkill_device, |
Marc Dietrich | 8e219eb | 2011-08-07 21:00:53 +0200 | [diff] [blame] | 148 | &leds_gpio, |
Marc Dietrich | c1c374d | 2011-11-01 10:37:03 +0000 | [diff] [blame^] | 149 | &gpio_keys_device, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 150 | }; |
| 151 | |
Marc Dietrich | dda9cd2 | 2011-05-19 14:08:26 +0200 | [diff] [blame] | 152 | static void paz00_i2c_init(void) |
| 153 | { |
Marc Dietrich | dda9cd2 | 2011-05-19 14:08:26 +0200 | [diff] [blame] | 154 | platform_device_register(&tegra_i2c_device1); |
| 155 | platform_device_register(&tegra_i2c_device2); |
| 156 | platform_device_register(&tegra_i2c_device4); |
| 157 | } |
| 158 | |
Marc Dietrich | 13db7a7 | 2011-05-19 14:08:27 +0200 | [diff] [blame] | 159 | static void paz00_usb_init(void) |
| 160 | { |
Marc Dietrich | 13db7a7 | 2011-05-19 14:08:27 +0200 | [diff] [blame] | 161 | platform_device_register(&tegra_ehci2_device); |
| 162 | platform_device_register(&tegra_ehci3_device); |
| 163 | } |
| 164 | |
Russell King | 0744a3e | 2010-12-20 10:37:50 +0000 | [diff] [blame] | 165 | static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline, |
| 166 | struct meminfo *mi) |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 167 | { |
| 168 | mi->nr_banks = 1; |
| 169 | mi->bank[0].start = PHYS_OFFSET; |
| 170 | mi->bank[0].size = 448 * SZ_1M; |
| 171 | } |
| 172 | |
| 173 | static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = { |
| 174 | /* name parent rate enabled */ |
Marc Dietrich | de7164d | 2011-08-07 21:00:51 +0200 | [diff] [blame] | 175 | { "uarta", "pll_p", 216000000, true }, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 176 | { "uartd", "pll_p", 216000000, true }, |
Marc Dietrich | ad9f667 | 2011-08-10 19:21:56 +0200 | [diff] [blame] | 177 | |
| 178 | { "pll_p_out4", "pll_p", 24000000, true }, |
| 179 | { "usbd", "clk_m", 12000000, false }, |
| 180 | { "usb2", "clk_m", 12000000, false }, |
| 181 | { "usb3", "clk_m", 12000000, false }, |
| 182 | |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 183 | { NULL, NULL, 0, 0}, |
| 184 | }; |
| 185 | |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 186 | static struct tegra_sdhci_platform_data sdhci_pdata1 = { |
| 187 | .cd_gpio = TEGRA_GPIO_SD1_CD, |
| 188 | .wp_gpio = TEGRA_GPIO_SD1_WP, |
| 189 | .power_gpio = TEGRA_GPIO_SD1_POWER, |
| 190 | }; |
| 191 | |
Marc Dietrich | 41cdc62 | 2011-05-19 14:08:28 +0200 | [diff] [blame] | 192 | static struct tegra_sdhci_platform_data sdhci_pdata4 = { |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 193 | .cd_gpio = -1, |
| 194 | .wp_gpio = -1, |
| 195 | .power_gpio = -1, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 196 | .is_8bit = 1, |
| 197 | }; |
| 198 | |
| 199 | static void __init tegra_paz00_init(void) |
| 200 | { |
| 201 | tegra_clk_init_from_table(paz00_clk_init_table); |
| 202 | |
| 203 | paz00_pinmux_init(); |
| 204 | |
| 205 | tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1; |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 206 | tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4; |
| 207 | |
| 208 | platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices)); |
Marc Dietrich | dda9cd2 | 2011-05-19 14:08:26 +0200 | [diff] [blame] | 209 | |
| 210 | paz00_i2c_init(); |
Marc Dietrich | 13db7a7 | 2011-05-19 14:08:27 +0200 | [diff] [blame] | 211 | paz00_usb_init(); |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 212 | } |
| 213 | |
Marc Dietrich | d1890d4d | 2011-05-19 14:08:29 +0200 | [diff] [blame] | 214 | MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ") |
Nicolas Pitre | b61cafe | 2011-07-05 22:38:18 -0400 | [diff] [blame] | 215 | .atag_offset = 0x100, |
Marc Dietrich | 65b935a | 2011-03-07 21:01:31 +0100 | [diff] [blame] | 216 | .fixup = tegra_paz00_fixup, |
| 217 | .map_io = tegra_map_common_io, |
| 218 | .init_early = tegra_init_early, |
| 219 | .init_irq = tegra_init_irq, |
| 220 | .timer = &tegra_timer, |
| 221 | .init_machine = tegra_paz00_init, |
| 222 | MACHINE_END |