board-harmony.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * arch/arm/mach-tegra/board-harmony.c
  3. *
  4. * Copyright (C) 2010 Google, Inc.
  5. * Copyright (C) 2011 NVIDIA, Inc.
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/serial_8250.h>
  21. #include <linux/clk.h>
  22. #include <linux/dma-mapping.h>
  23. #include <linux/pda_power.h>
  24. #include <linux/io.h>
  25. #include <linux/gpio.h>
  26. #include <linux/i2c.h>
  27. #include <linux/i2c-tegra.h>
  28. #include <sound/wm8903.h>
  29. #include <asm/mach-types.h>
  30. #include <asm/mach/arch.h>
  31. #include <asm/mach/time.h>
  32. #include <asm/setup.h>
  33. #include <mach/harmony_audio.h>
  34. #include <mach/iomap.h>
  35. #include <mach/irqs.h>
  36. #include <mach/sdhci.h>
  37. #include "board.h"
  38. #include "board-harmony.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. .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
  45. .mapbase = TEGRA_UARTD_BASE,
  46. .irq = INT_UARTD,
  47. .flags = UPF_BOOT_AUTOCONF,
  48. .iotype = UPIO_MEM,
  49. .regshift = 2,
  50. .uartclk = 216000000,
  51. }, {
  52. .flags = 0
  53. }
  54. };
  55. static struct platform_device debug_uart = {
  56. .name = "serial8250",
  57. .id = PLAT8250_DEV_PLATFORM,
  58. .dev = {
  59. .platform_data = debug_uart_platform_data,
  60. },
  61. };
  62. static struct harmony_audio_platform_data harmony_audio_pdata = {
  63. .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
  64. .gpio_hp_det = TEGRA_GPIO_HP_DET,
  65. .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
  66. .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
  67. };
  68. static struct platform_device harmony_audio_device = {
  69. .name = "tegra-snd-harmony",
  70. .id = 0,
  71. .dev = {
  72. .platform_data = &harmony_audio_pdata,
  73. },
  74. };
  75. static struct tegra_i2c_platform_data harmony_i2c1_platform_data = {
  76. .bus_clk_rate = 400000,
  77. };
  78. static struct tegra_i2c_platform_data harmony_i2c2_platform_data = {
  79. .bus_clk_rate = 400000,
  80. };
  81. static struct tegra_i2c_platform_data harmony_i2c3_platform_data = {
  82. .bus_clk_rate = 400000,
  83. };
  84. static struct tegra_i2c_platform_data harmony_dvc_platform_data = {
  85. .bus_clk_rate = 400000,
  86. };
  87. static struct wm8903_platform_data harmony_wm8903_pdata = {
  88. .irq_active_low = 0,
  89. .micdet_cfg = 0,
  90. .micdet_delay = 100,
  91. .gpio_base = HARMONY_GPIO_WM8903(0),
  92. .gpio_cfg = {
  93. WM8903_GPIO_NO_CONFIG,
  94. WM8903_GPIO_NO_CONFIG,
  95. 0,
  96. WM8903_GPIO_NO_CONFIG,
  97. WM8903_GPIO_NO_CONFIG,
  98. },
  99. };
  100. static struct i2c_board_info __initdata wm8903_board_info = {
  101. I2C_BOARD_INFO("wm8903", 0x1a),
  102. .platform_data = &harmony_wm8903_pdata,
  103. .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
  104. };
  105. static void __init harmony_i2c_init(void)
  106. {
  107. tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data;
  108. tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data;
  109. tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data;
  110. tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data;
  111. platform_device_register(&tegra_i2c_device1);
  112. platform_device_register(&tegra_i2c_device2);
  113. platform_device_register(&tegra_i2c_device3);
  114. platform_device_register(&tegra_i2c_device4);
  115. i2c_register_board_info(0, &wm8903_board_info, 1);
  116. }
  117. static struct platform_device *harmony_devices[] __initdata = {
  118. &debug_uart,
  119. &tegra_sdhci_device1,
  120. &tegra_sdhci_device2,
  121. &tegra_sdhci_device4,
  122. &tegra_i2s_device1,
  123. &tegra_das_device,
  124. &tegra_pcm_device,
  125. &harmony_audio_device,
  126. };
  127. static void __init tegra_harmony_fixup(struct machine_desc *desc,
  128. struct tag *tags, char **cmdline, struct meminfo *mi)
  129. {
  130. mi->nr_banks = 2;
  131. mi->bank[0].start = PHYS_OFFSET;
  132. mi->bank[0].size = 448 * SZ_1M;
  133. mi->bank[1].start = SZ_512M;
  134. mi->bank[1].size = SZ_512M;
  135. }
  136. static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
  137. /* name parent rate enabled */
  138. { "uartd", "pll_p", 216000000, true },
  139. { "pll_a", "pll_p_out1", 56448000, true },
  140. { "pll_a_out0", "pll_a", 11289600, true },
  141. { "cdev1", NULL, 0, true },
  142. { "i2s1", "pll_a_out0", 11289600, false},
  143. { NULL, NULL, 0, 0},
  144. };
  145. static struct tegra_sdhci_platform_data sdhci_pdata1 = {
  146. .cd_gpio = -1,
  147. .wp_gpio = -1,
  148. .power_gpio = -1,
  149. };
  150. static struct tegra_sdhci_platform_data sdhci_pdata2 = {
  151. .cd_gpio = TEGRA_GPIO_SD2_CD,
  152. .wp_gpio = TEGRA_GPIO_SD2_WP,
  153. .power_gpio = TEGRA_GPIO_SD2_POWER,
  154. };
  155. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  156. .cd_gpio = TEGRA_GPIO_SD4_CD,
  157. .wp_gpio = TEGRA_GPIO_SD4_WP,
  158. .power_gpio = TEGRA_GPIO_SD4_POWER,
  159. .is_8bit = 1,
  160. };
  161. static void __init tegra_harmony_init(void)
  162. {
  163. tegra_clk_init_from_table(harmony_clk_init_table);
  164. harmony_pinmux_init();
  165. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  166. tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
  167. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  168. platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
  169. harmony_i2c_init();
  170. harmony_regulator_init();
  171. }
  172. MACHINE_START(HARMONY, "harmony")
  173. .boot_params = 0x00000100,
  174. .fixup = tegra_harmony_fixup,
  175. .map_io = tegra_map_common_io,
  176. .init_early = tegra_init_early,
  177. .init_irq = tegra_init_irq,
  178. .timer = &tegra_timer,
  179. .init_machine = tegra_harmony_init,
  180. MACHINE_END