board-harmony.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 <sound/wm8903.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. #include <asm/hardware/gic.h>
  32. #include <asm/setup.h>
  33. #include <mach/tegra_wm8903_pdata.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 | UPF_FIXED_TYPE,
  48. .type = PORT_TEGRA,
  49. .iotype = UPIO_MEM,
  50. .regshift = 2,
  51. .uartclk = 216000000,
  52. }, {
  53. .flags = 0
  54. }
  55. };
  56. static struct platform_device debug_uart = {
  57. .name = "serial8250",
  58. .id = PLAT8250_DEV_PLATFORM,
  59. .dev = {
  60. .platform_data = debug_uart_platform_data,
  61. },
  62. };
  63. static struct tegra_wm8903_platform_data harmony_audio_pdata = {
  64. .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
  65. .gpio_hp_det = TEGRA_GPIO_HP_DET,
  66. .gpio_hp_mute = -1,
  67. .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
  68. .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
  69. };
  70. static struct platform_device harmony_audio_device = {
  71. .name = "tegra-snd-wm8903",
  72. .id = 0,
  73. .dev = {
  74. .platform_data = &harmony_audio_pdata,
  75. },
  76. };
  77. static struct wm8903_platform_data harmony_wm8903_pdata = {
  78. .irq_active_low = 0,
  79. .micdet_cfg = 0,
  80. .micdet_delay = 100,
  81. .gpio_base = HARMONY_GPIO_WM8903(0),
  82. .gpio_cfg = {
  83. 0,
  84. 0,
  85. WM8903_GPIO_CONFIG_ZERO,
  86. 0,
  87. 0,
  88. },
  89. };
  90. static struct i2c_board_info __initdata wm8903_board_info = {
  91. I2C_BOARD_INFO("wm8903", 0x1a),
  92. .platform_data = &harmony_wm8903_pdata,
  93. };
  94. static void __init harmony_i2c_init(void)
  95. {
  96. platform_device_register(&tegra_i2c_device1);
  97. platform_device_register(&tegra_i2c_device2);
  98. platform_device_register(&tegra_i2c_device3);
  99. platform_device_register(&tegra_i2c_device4);
  100. wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ);
  101. i2c_register_board_info(0, &wm8903_board_info, 1);
  102. }
  103. static struct platform_device *harmony_devices[] __initdata = {
  104. &debug_uart,
  105. &tegra_sdhci_device1,
  106. &tegra_sdhci_device2,
  107. &tegra_sdhci_device4,
  108. &tegra_ehci3_device,
  109. &tegra_i2s_device1,
  110. &tegra_das_device,
  111. &tegra_pcm_device,
  112. &harmony_audio_device,
  113. };
  114. static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
  115. struct meminfo *mi)
  116. {
  117. mi->nr_banks = 2;
  118. mi->bank[0].start = PHYS_OFFSET;
  119. mi->bank[0].size = 448 * SZ_1M;
  120. mi->bank[1].start = SZ_512M;
  121. mi->bank[1].size = SZ_512M;
  122. }
  123. static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
  124. /* name parent rate enabled */
  125. { "uartd", "pll_p", 216000000, true },
  126. { "pll_a", "pll_p_out1", 56448000, true },
  127. { "pll_a_out0", "pll_a", 11289600, true },
  128. { "cdev1", NULL, 0, true },
  129. { "i2s1", "pll_a_out0", 11289600, false},
  130. { "usb3", "clk_m", 12000000, true },
  131. { NULL, NULL, 0, 0},
  132. };
  133. static struct tegra_sdhci_platform_data sdhci_pdata1 = {
  134. .cd_gpio = -1,
  135. .wp_gpio = -1,
  136. .power_gpio = -1,
  137. };
  138. static struct tegra_sdhci_platform_data sdhci_pdata2 = {
  139. .cd_gpio = TEGRA_GPIO_SD2_CD,
  140. .wp_gpio = TEGRA_GPIO_SD2_WP,
  141. .power_gpio = TEGRA_GPIO_SD2_POWER,
  142. };
  143. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  144. .cd_gpio = TEGRA_GPIO_SD4_CD,
  145. .wp_gpio = TEGRA_GPIO_SD4_WP,
  146. .power_gpio = TEGRA_GPIO_SD4_POWER,
  147. .is_8bit = 1,
  148. };
  149. static void __init tegra_harmony_init(void)
  150. {
  151. tegra_clk_init_from_table(harmony_clk_init_table);
  152. harmony_pinmux_init();
  153. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  154. tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
  155. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  156. platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
  157. harmony_i2c_init();
  158. harmony_regulator_init();
  159. }
  160. MACHINE_START(HARMONY, "harmony")
  161. .atag_offset = 0x100,
  162. .fixup = tegra_harmony_fixup,
  163. .map_io = tegra_map_common_io,
  164. .init_early = tegra20_init_early,
  165. .init_irq = tegra_init_irq,
  166. .handle_irq = gic_handle_irq,
  167. .timer = &tegra_timer,
  168. .init_machine = tegra_harmony_init,
  169. .restart = tegra_assert_system_reset,
  170. MACHINE_END