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