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