board-seaboard.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright (c) 2010, 2011 NVIDIA Corporation.
  3. * Copyright (C) 2010, 2011 Google, Inc.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/serial_8250.h>
  20. #include <linux/delay.h>
  21. #include <linux/input.h>
  22. #include <linux/io.h>
  23. #include <linux/gpio_keys.h>
  24. #include <mach/iomap.h>
  25. #include <mach/irqs.h>
  26. #include <mach/sdhci.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include "board.h"
  30. #include "board-seaboard.h"
  31. #include "clock.h"
  32. #include "devices.h"
  33. #include "gpio-names.h"
  34. static struct plat_serial8250_port debug_uart_platform_data[] = {
  35. {
  36. /* Memory and IRQ filled in before registration */
  37. .flags = UPF_BOOT_AUTOCONF,
  38. .iotype = UPIO_MEM,
  39. .regshift = 2,
  40. .uartclk = 216000000,
  41. }, {
  42. .flags = 0,
  43. }
  44. };
  45. static struct platform_device debug_uart = {
  46. .name = "serial8250",
  47. .id = PLAT8250_DEV_PLATFORM,
  48. .dev = {
  49. .platform_data = debug_uart_platform_data,
  50. },
  51. };
  52. static __initdata struct tegra_clk_init_table seaboard_clk_init_table[] = {
  53. /* name parent rate enabled */
  54. { "uartb", "pll_p", 216000000, true},
  55. { "uartd", "pll_p", 216000000, true},
  56. { NULL, NULL, 0, 0},
  57. };
  58. static struct gpio_keys_button seaboard_gpio_keys_buttons[] = {
  59. {
  60. .code = SW_LID,
  61. .gpio = TEGRA_GPIO_LIDSWITCH,
  62. .active_low = 0,
  63. .desc = "Lid",
  64. .type = EV_SW,
  65. .wakeup = 1,
  66. .debounce_interval = 1,
  67. },
  68. {
  69. .code = KEY_POWER,
  70. .gpio = TEGRA_GPIO_POWERKEY,
  71. .active_low = 1,
  72. .desc = "Power",
  73. .type = EV_KEY,
  74. .wakeup = 1,
  75. },
  76. };
  77. static struct gpio_keys_platform_data seaboard_gpio_keys = {
  78. .buttons = seaboard_gpio_keys_buttons,
  79. .nbuttons = ARRAY_SIZE(seaboard_gpio_keys_buttons),
  80. };
  81. static struct platform_device seaboard_gpio_keys_device = {
  82. .name = "gpio-keys",
  83. .id = -1,
  84. .dev = {
  85. .platform_data = &seaboard_gpio_keys,
  86. }
  87. };
  88. static struct tegra_sdhci_platform_data sdhci_pdata1 = {
  89. .cd_gpio = -1,
  90. .wp_gpio = -1,
  91. .power_gpio = -1,
  92. };
  93. static struct tegra_sdhci_platform_data sdhci_pdata3 = {
  94. .cd_gpio = TEGRA_GPIO_PI5,
  95. .wp_gpio = TEGRA_GPIO_PH1,
  96. .power_gpio = TEGRA_GPIO_PI6,
  97. };
  98. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  99. .cd_gpio = -1,
  100. .wp_gpio = -1,
  101. .power_gpio = -1,
  102. .is_8bit = 1,
  103. };
  104. static struct platform_device *seaboard_devices[] __initdata = {
  105. &debug_uart,
  106. &tegra_pmu_device,
  107. &tegra_sdhci_device1,
  108. &tegra_sdhci_device3,
  109. &tegra_sdhci_device4,
  110. &seaboard_gpio_keys_device,
  111. };
  112. static void __init __tegra_seaboard_init(void)
  113. {
  114. seaboard_pinmux_init();
  115. tegra_clk_init_from_table(seaboard_clk_init_table);
  116. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  117. tegra_sdhci_device3.dev.platform_data = &sdhci_pdata3;
  118. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  119. platform_add_devices(seaboard_devices, ARRAY_SIZE(seaboard_devices));
  120. }
  121. static void __init tegra_seaboard_init(void)
  122. {
  123. /* Seaboard uses UARTD for the debug port. */
  124. debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTD_BASE);
  125. debug_uart_platform_data[0].mapbase = TEGRA_UARTD_BASE;
  126. debug_uart_platform_data[0].irq = INT_UARTD;
  127. __tegra_seaboard_init();
  128. }
  129. static void __init tegra_kaen_init(void)
  130. {
  131. /* Kaen uses UARTB for the debug port. */
  132. debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
  133. debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
  134. debug_uart_platform_data[0].irq = INT_UARTB;
  135. __tegra_seaboard_init();
  136. }
  137. static void __init tegra_wario_init(void)
  138. {
  139. /* Wario uses UARTB for the debug port. */
  140. debug_uart_platform_data[0].membase = IO_ADDRESS(TEGRA_UARTB_BASE);
  141. debug_uart_platform_data[0].mapbase = TEGRA_UARTB_BASE;
  142. debug_uart_platform_data[0].irq = INT_UARTB;
  143. __tegra_seaboard_init();
  144. }
  145. MACHINE_START(SEABOARD, "seaboard")
  146. .boot_params = 0x00000100,
  147. .map_io = tegra_map_common_io,
  148. .init_early = tegra_init_early,
  149. .init_irq = tegra_init_irq,
  150. .timer = &tegra_timer,
  151. .init_machine = tegra_seaboard_init,
  152. MACHINE_END
  153. MACHINE_START(KAEN, "kaen")
  154. .boot_params = 0x00000100,
  155. .map_io = tegra_map_common_io,
  156. .init_early = tegra_init_early,
  157. .init_irq = tegra_init_irq,
  158. .timer = &tegra_timer,
  159. .init_machine = tegra_kaen_init,
  160. MACHINE_END
  161. MACHINE_START(WARIO, "wario")
  162. .boot_params = 0x00000100,
  163. .map_io = tegra_map_common_io,
  164. .init_early = tegra_init_early,
  165. .init_irq = tegra_init_irq,
  166. .timer = &tegra_timer,
  167. .init_machine = tegra_wario_init,
  168. MACHINE_END