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