board-trimslice.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * arch/arm/mach-tegra/board-trimslice.c
  3. *
  4. * Copyright (C) 2011 CompuLab, Ltd.
  5. * Author: Mike Rapoport <mike@compulab.co.il>
  6. *
  7. * Based on board-harmony.c
  8. * Copyright (C) 2010 Google, Inc.
  9. *
  10. * This software is licensed under the terms of the GNU General Public
  11. * License version 2, as published by the Free Software Foundation, and
  12. * may be copied, distributed, and modified under those terms.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/serial_8250.h>
  24. #include <linux/of_serial.h>
  25. #include <linux/io.h>
  26. #include <linux/i2c.h>
  27. #include <linux/gpio.h>
  28. #include <linux/platform_data/tegra_usb.h>
  29. #include <asm/hardware/gic.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/setup.h>
  33. #include <mach/iomap.h>
  34. #include <mach/sdhci.h>
  35. #include "board.h"
  36. #include "clock.h"
  37. #include "devices.h"
  38. #include "gpio-names.h"
  39. #include "board-trimslice.h"
  40. static struct plat_serial8250_port debug_uart_platform_data[] = {
  41. {
  42. .membase = IO_ADDRESS(TEGRA_UARTA_BASE),
  43. .mapbase = TEGRA_UARTA_BASE,
  44. .irq = INT_UARTA,
  45. .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
  46. .type = PORT_TEGRA,
  47. .handle_break = tegra_serial_handle_break,
  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 tegra_sdhci_platform_data sdhci_pdata1 = {
  63. .cd_gpio = -1,
  64. .wp_gpio = -1,
  65. .power_gpio = -1,
  66. };
  67. static struct tegra_sdhci_platform_data sdhci_pdata4 = {
  68. .cd_gpio = TRIMSLICE_GPIO_SD4_CD,
  69. .wp_gpio = TRIMSLICE_GPIO_SD4_WP,
  70. .power_gpio = -1,
  71. };
  72. static struct platform_device trimslice_audio_device = {
  73. .name = "tegra-snd-trimslice",
  74. .id = 0,
  75. };
  76. static struct platform_device *trimslice_devices[] __initdata = {
  77. &debug_uart,
  78. &tegra_sdhci_device1,
  79. &tegra_sdhci_device4,
  80. &tegra_i2s_device1,
  81. &tegra_das_device,
  82. &trimslice_audio_device,
  83. };
  84. static struct i2c_board_info trimslice_i2c3_board_info[] = {
  85. {
  86. I2C_BOARD_INFO("tlv320aic23", 0x1a),
  87. },
  88. {
  89. I2C_BOARD_INFO("em3027", 0x56),
  90. },
  91. };
  92. static void trimslice_i2c_init(void)
  93. {
  94. platform_device_register(&tegra_i2c_device1);
  95. platform_device_register(&tegra_i2c_device2);
  96. platform_device_register(&tegra_i2c_device3);
  97. i2c_register_board_info(2, trimslice_i2c3_board_info,
  98. ARRAY_SIZE(trimslice_i2c3_board_info));
  99. }
  100. static void trimslice_usb_init(void)
  101. {
  102. struct tegra_ehci_platform_data *pdata;
  103. pdata = tegra_ehci1_device.dev.platform_data;
  104. pdata->vbus_gpio = TRIMSLICE_GPIO_USB1_MODE;
  105. tegra_ehci2_ulpi_phy_config.reset_gpio = TEGRA_GPIO_PV0;
  106. platform_device_register(&tegra_ehci3_device);
  107. platform_device_register(&tegra_ehci2_device);
  108. platform_device_register(&tegra_ehci1_device);
  109. }
  110. static void __init tegra_trimslice_fixup(struct tag *tags, char **cmdline,
  111. struct meminfo *mi)
  112. {
  113. mi->nr_banks = 2;
  114. mi->bank[0].start = PHYS_OFFSET;
  115. mi->bank[0].size = 448 * SZ_1M;
  116. mi->bank[1].start = SZ_512M;
  117. mi->bank[1].size = SZ_512M;
  118. }
  119. static __initdata struct tegra_clk_init_table trimslice_clk_init_table[] = {
  120. /* name parent rate enabled */
  121. { "uarta", "pll_p", 216000000, true },
  122. { "pll_a", "pll_p_out1", 56448000, true },
  123. { "pll_a_out0", "pll_a", 11289600, true },
  124. { "cdev1", NULL, 0, true },
  125. { "i2s1", "pll_a_out0", 11289600, false},
  126. { NULL, NULL, 0, 0},
  127. };
  128. static int __init tegra_trimslice_pci_init(void)
  129. {
  130. if (!machine_is_trimslice())
  131. return 0;
  132. return tegra_pcie_init(true, true);
  133. }
  134. subsys_initcall(tegra_trimslice_pci_init);
  135. static void __init tegra_trimslice_init(void)
  136. {
  137. tegra_clk_init_from_table(trimslice_clk_init_table);
  138. trimslice_pinmux_init();
  139. tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
  140. tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
  141. platform_add_devices(trimslice_devices, ARRAY_SIZE(trimslice_devices));
  142. trimslice_i2c_init();
  143. trimslice_usb_init();
  144. }
  145. MACHINE_START(TRIMSLICE, "trimslice")
  146. .atag_offset = 0x100,
  147. .fixup = tegra_trimslice_fixup,
  148. .map_io = tegra_map_common_io,
  149. .init_early = tegra20_init_early,
  150. .init_irq = tegra_init_irq,
  151. .handle_irq = gic_handle_irq,
  152. .timer = &tegra_timer,
  153. .init_machine = tegra_trimslice_init,
  154. .init_late = tegra_init_late,
  155. .restart = tegra_assert_system_reset,
  156. MACHINE_END