board-paz00.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. #include <linux/kernel.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/serial_8250.h>
  23. #include <linux/clk.h>
  24. #include <linux/dma-mapping.h>
  25. #include <linux/gpio_keys.h>
  26. #include <linux/pda_power.h>
  27. #include <linux/io.h>
  28. #include <linux/input.h>
  29. #include <linux/i2c.h>
  30. #include <linux/gpio.h>
  31. #include <linux/rfkill-gpio.h>
  32. #include <asm/hardware/gic.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/time.h>
  36. #include <asm/setup.h>
  37. #include <mach/iomap.h>
  38. #include <mach/irqs.h>
  39. #include <mach/sdhci.h>
  40. #include "board.h"
  41. #include "board-paz00.h"
  42. #include "clock.h"
  43. #include "devices.h"
  44. #include "gpio-names.h"
  45. static struct plat_serial8250_port debug_uart_platform_data[] = {
  46. {
  47. /* serial port on JP1 */
  48. .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
  49. .mapbase = TEGRA_UARTA_BASE,
  50. .irq = INT_UARTA,
  51. .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
  52. .type = PORT_TEGRA,
  53. .iotype = UPIO_MEM,
  54. .regshift = 2,
  55. .uartclk = 216000000,
  56. }, {
  57. /* serial port on mini-pcie */
  58. .membase = IO_ADDRESS(TEGRA_UARTC_BASE),
  59. .mapbase = TEGRA_UARTC_BASE,
  60. .irq = INT_UARTC,
  61. .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
  62. .type = PORT_TEGRA,
  63. .iotype = UPIO_MEM,
  64. .regshift = 2,
  65. .uartclk = 216000000,
  66. }, {
  67. .flags = 0
  68. }
  69. };
  70. static struct platform_device debug_uart = {
  71. .name = "serial8250",
  72. .id = PLAT8250_DEV_PLATFORM,
  73. .dev = {
  74. .platform_data = debug_uart_platform_data,
  75. },
  76. };
  77. static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
  78. .name = "wifi_rfkill",
  79. .reset_gpio = TEGRA_WIFI_RST,
  80. .shutdown_gpio = TEGRA_WIFI_PWRN,
  81. .type = RFKILL_TYPE_WLAN,
  82. };
  83. static struct platform_device wifi_rfkill_device = {
  84. .name = "rfkill_gpio",
  85. .id = -1,
  86. .dev = {
  87. .platform_data = &wifi_rfkill_platform_data,
  88. },
  89. };
  90. static struct gpio_led gpio_leds[] = {
  91. {
  92. .name = "wifi-led",
  93. .default_trigger = "rfkill0",
  94. .gpio = TEGRA_WIFI_LED,
  95. },
  96. };
  97. static struct gpio_led_platform_data gpio_led_info = {
  98. .leds = gpio_leds,
  99. .num_leds = ARRAY_SIZE(gpio_leds),
  100. };
  101. static struct platform_device leds_gpio = {
  102. .name = "leds-gpio",
  103. .id = -1,
  104. .dev = {
  105. .platform_data = &gpio_led_info,
  106. },
  107. };
  108. static struct gpio_keys_button paz00_gpio_keys_buttons[] = {
  109. {
  110. .code = KEY_POWER,
  111. .gpio = TEGRA_GPIO_POWERKEY,
  112. .active_low = 1,
  113. .desc = "Power",
  114. .type = EV_KEY,
  115. .wakeup = 1,
  116. },
  117. };
  118. static struct gpio_keys_platform_data paz00_gpio_keys = {
  119. .buttons = paz00_gpio_keys_buttons,
  120. .nbuttons = ARRAY_SIZE(paz00_gpio_keys_buttons),
  121. };
  122. static struct platform_device gpio_keys_device = {
  123. .name = "gpio-keys",
  124. .id = -1,
  125. .dev = {
  126. .platform_data = &paz00_gpio_keys,
  127. },
  128. };
  129. static struct platform_device *paz00_devices[] __initdata = {
  130. &debug_uart,
  131. &tegra_sdhci_device4,
  132. &tegra_sdhci_device1,
  133. &wifi_rfkill_device,
  134. &leds_gpio,
  135. &gpio_keys_device,
  136. };
  137. static void paz00_i2c_init(void)
  138. {
  139. platform_device_register(&tegra_i2c_device1);
  140. platform_device_register(&tegra_i2c_device2);
  141. platform_device_register(&tegra_i2c_device4);
  142. }
  143. static void paz00_usb_init(void)
  144. {
  145. platform_device_register(&tegra_ehci2_device);
  146. platform_device_register(&tegra_ehci3_device);
  147. }
  148. static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
  149. struct meminfo *mi)
  150. {
  151. mi->nr_banks = 1;
  152. mi->bank[0].start = PHYS_OFFSET;
  153. mi->bank[0].size = 448 * SZ_1M;
  154. }
  155. static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = {
  156. /* name parent rate enabled */
  157. { "uarta", "pll_p", 216000000, true },
  158. { "uartc", "pll_p", 216000000, true },
  159. { "pll_p_out4", "pll_p", 24000000, true },
  160. { "usbd", "clk_m", 12000000, false },
  161. { "usb2", "clk_m", 12000000, false },
  162. { "usb3", "clk_m", 12000000, false },
  163. { NULL, NULL, 0, 0},
  164. };
  165. static struct tegra_sdhci_platform_data sdhci_pdata1 = {
  166. .cd_gpio = TEGRA_GPIO_SD1_CD,
  167. .wp_gpio = TEGRA_GPIO_SD1_WP,
  168. .power_gpio = TEGRA_GPIO_SD1_POWER,
  169. };
  170. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  171. .cd_gpio = -1,
  172. .wp_gpio = -1,
  173. .power_gpio = -1,
  174. .is_8bit = 1,
  175. };
  176. static void __init tegra_paz00_init(void)
  177. {
  178. tegra_clk_init_from_table(paz00_clk_init_table);
  179. paz00_pinmux_init();
  180. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  181. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  182. platform_add_devices(paz00_devices, ARRAY_SIZE(paz00_devices));
  183. paz00_i2c_init();
  184. paz00_usb_init();
  185. }
  186. MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
  187. .atag_offset = 0x100,
  188. .fixup = tegra_paz00_fixup,
  189. .map_io = tegra_map_common_io,
  190. .init_early = tegra20_init_early,
  191. .init_irq = tegra_init_irq,
  192. .handle_irq = gic_handle_irq,
  193. .timer = &tegra_timer,
  194. .init_machine = tegra_paz00_init,
  195. .restart = tegra_assert_system_reset,
  196. MACHINE_END