board-harmony.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. #include <asm/setup.h>
  32. #include <mach/harmony_audio.h>
  33. #include <mach/iomap.h>
  34. #include <mach/irqs.h>
  35. #include <mach/sdhci.h>
  36. #include "board.h"
  37. #include "board-harmony.h"
  38. #include "clock.h"
  39. #include "devices.h"
  40. #include "gpio-names.h"
  41. static struct plat_serial8250_port debug_uart_platform_data[] = {
  42. {
  43. .membase = IO_ADDRESS(TEGRA_UARTD_BASE),
  44. .mapbase = TEGRA_UARTD_BASE,
  45. .irq = INT_UARTD,
  46. .flags = UPF_BOOT_AUTOCONF,
  47. .iotype = UPIO_MEM,
  48. .regshift = 2,
  49. .uartclk = 216000000,
  50. }, {
  51. .flags = 0
  52. }
  53. };
  54. static struct platform_device debug_uart = {
  55. .name = "serial8250",
  56. .id = PLAT8250_DEV_PLATFORM,
  57. .dev = {
  58. .platform_data = debug_uart_platform_data,
  59. },
  60. };
  61. static struct harmony_audio_platform_data harmony_audio_pdata = {
  62. .gpio_spkr_en = TEGRA_GPIO_SPKR_EN,
  63. .gpio_hp_det = TEGRA_GPIO_HP_DET,
  64. .gpio_int_mic_en = TEGRA_GPIO_INT_MIC_EN,
  65. .gpio_ext_mic_en = TEGRA_GPIO_EXT_MIC_EN,
  66. };
  67. static struct platform_device harmony_audio_device = {
  68. .name = "tegra-snd-harmony",
  69. .id = 0,
  70. .dev = {
  71. .platform_data = &harmony_audio_pdata,
  72. },
  73. };
  74. static struct tegra_i2c_platform_data harmony_i2c1_platform_data = {
  75. .bus_clk_rate = 400000,
  76. };
  77. static struct tegra_i2c_platform_data harmony_i2c2_platform_data = {
  78. .bus_clk_rate = 400000,
  79. };
  80. static struct tegra_i2c_platform_data harmony_i2c3_platform_data = {
  81. .bus_clk_rate = 400000,
  82. };
  83. static struct tegra_i2c_platform_data harmony_dvc_platform_data = {
  84. .bus_clk_rate = 400000,
  85. };
  86. static void __init harmony_i2c_init(void)
  87. {
  88. tegra_i2c_device1.dev.platform_data = &harmony_i2c1_platform_data;
  89. tegra_i2c_device2.dev.platform_data = &harmony_i2c2_platform_data;
  90. tegra_i2c_device3.dev.platform_data = &harmony_i2c3_platform_data;
  91. tegra_i2c_device4.dev.platform_data = &harmony_dvc_platform_data;
  92. platform_device_register(&tegra_i2c_device1);
  93. platform_device_register(&tegra_i2c_device2);
  94. platform_device_register(&tegra_i2c_device3);
  95. platform_device_register(&tegra_i2c_device4);
  96. }
  97. static struct platform_device *harmony_devices[] __initdata = {
  98. &debug_uart,
  99. &tegra_sdhci_device1,
  100. &tegra_sdhci_device2,
  101. &tegra_sdhci_device4,
  102. &tegra_i2s_device1,
  103. &tegra_das_device,
  104. &tegra_pcm_device,
  105. &harmony_audio_device,
  106. };
  107. static void __init tegra_harmony_fixup(struct machine_desc *desc,
  108. struct tag *tags, char **cmdline, struct meminfo *mi)
  109. {
  110. mi->nr_banks = 2;
  111. mi->bank[0].start = PHYS_OFFSET;
  112. mi->bank[0].size = 448 * SZ_1M;
  113. mi->bank[1].start = SZ_512M;
  114. mi->bank[1].size = SZ_512M;
  115. }
  116. static __initdata struct tegra_clk_init_table harmony_clk_init_table[] = {
  117. /* name parent rate enabled */
  118. { "uartd", "pll_p", 216000000, true },
  119. { "pll_a", "pll_p_out1", 56448000, true },
  120. { "pll_a_out0", "pll_a", 11289600, true },
  121. { "cdev1", NULL, 0, true },
  122. { "i2s1", "pll_a_out0", 11289600, false},
  123. { NULL, NULL, 0, 0},
  124. };
  125. static struct tegra_sdhci_platform_data sdhci_pdata1 = {
  126. .cd_gpio = -1,
  127. .wp_gpio = -1,
  128. .power_gpio = -1,
  129. };
  130. static struct tegra_sdhci_platform_data sdhci_pdata2 = {
  131. .cd_gpio = TEGRA_GPIO_SD2_CD,
  132. .wp_gpio = TEGRA_GPIO_SD2_WP,
  133. .power_gpio = TEGRA_GPIO_SD2_POWER,
  134. };
  135. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  136. .cd_gpio = TEGRA_GPIO_SD4_CD,
  137. .wp_gpio = TEGRA_GPIO_SD4_WP,
  138. .power_gpio = TEGRA_GPIO_SD4_POWER,
  139. .is_8bit = 1,
  140. };
  141. static void __init tegra_harmony_init(void)
  142. {
  143. tegra_clk_init_from_table(harmony_clk_init_table);
  144. harmony_pinmux_init();
  145. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  146. tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
  147. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  148. platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
  149. harmony_i2c_init();
  150. }
  151. MACHINE_START(HARMONY, "harmony")
  152. .boot_params = 0x00000100,
  153. .fixup = tegra_harmony_fixup,
  154. .map_io = tegra_map_common_io,
  155. .init_early = tegra_init_early,
  156. .init_irq = tegra_init_irq,
  157. .timer = &tegra_timer,
  158. .init_machine = tegra_harmony_init,
  159. MACHINE_END