whistler.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * (C) Copyright 2010-2012
  3. * NVIDIA Corporation <www.nvidia.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/io.h>
  25. #include <asm/arch/tegra.h>
  26. #include <asm/arch/clock.h>
  27. #include <asm/arch/funcmux.h>
  28. #include <asm/arch/pinmux.h>
  29. #include <asm/arch-tegra/mmc.h>
  30. #include <asm/gpio.h>
  31. #include <i2c.h>
  32. #ifdef CONFIG_TEGRA_MMC
  33. #include <mmc.h>
  34. #endif
  35. /*
  36. * Routine: gpio_config_uart
  37. * Description: Does nothing on Whistler - no UART-related GPIOs.
  38. */
  39. void gpio_config_uart(void)
  40. {
  41. }
  42. /*
  43. * Routine: pin_mux_mmc
  44. * Description: setup the pin muxes/tristate values for the SDMMC(s)
  45. */
  46. static void pin_mux_mmc(void)
  47. {
  48. funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT);
  49. funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT);
  50. }
  51. /* this is a weak define that we are overriding */
  52. int board_mmc_init(bd_t *bd)
  53. {
  54. uchar val;
  55. int ret;
  56. debug("board_mmc_init called\n");
  57. /* Turn on MAX8907B LDO12 to 2.8V for J40 power */
  58. ret = i2c_set_bus_num(0);
  59. if (ret)
  60. printf("i2c_set_bus_num failed: %d\n", ret);
  61. val = 0x29;
  62. ret = i2c_write(0x3c, 0x46, 1, &val, 1);
  63. if (ret)
  64. printf("i2c_write 0 0x3c 0x46 failed: %d\n", ret);
  65. val = 0x00;
  66. ret = i2c_write(0x3c, 0x45, 1, &val, 1);
  67. if (ret)
  68. printf("i2c_write 0 0x3c 0x45 failed: %d\n", ret);
  69. val = 0x1f;
  70. ret = i2c_write(0x3c, 0x44, 1, &val, 1);
  71. if (ret)
  72. printf("i2c_write 0 0x3c 0x44 failed: %d\n", ret);
  73. /* Enable muxes, etc. for SDMMC controllers */
  74. pin_mux_mmc();
  75. /* init dev 0 (SDMMC4), (J29 "HSMMC") with 8-bit bus */
  76. tegra_mmc_init(0, 8, -1, -1);
  77. /* init dev 1 (SDMMC3), (J40 "SDIO3") with 8-bit bus */
  78. tegra_mmc_init(1, 8, -1, -1);
  79. return 0;
  80. }
  81. /* this is a weak define that we are overriding */
  82. void pin_mux_usb(void)
  83. {
  84. uchar val;
  85. int ret;
  86. /*
  87. * This is a hack. This should be represented in DT using the
  88. * vbus-gpio property. However, U-Boot's DT support doesn't
  89. * support any GPIO controller other than the Tegra's yet.
  90. */
  91. /* Turn on TAC6416's GPIO 0+1 for USB1/3's VBUS */
  92. ret = i2c_set_bus_num(0);
  93. if (ret)
  94. printf("i2c_set_bus_num failed: %d\n", ret);
  95. val = 0x03;
  96. ret = i2c_write(0x20, 2, 1, &val, 1);
  97. if (ret)
  98. printf("i2c_write 0 0x20 2 failed: %d\n", ret);
  99. val = 0xfc;
  100. ret = i2c_write(0x20, 6, 1, &val, 1);
  101. if (ret)
  102. printf("i2c_write 0 0x20 6 failed: %d\n", ret);
  103. }