board-paz00.c 4.6 KB

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