board-paz00.c 5.5 KB

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