cardhu.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * (C) Copyright 2010-2013
  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/arch/pinmux.h>
  25. #include <asm/arch/gp_padctrl.h>
  26. #include "pinmux-config-cardhu.h"
  27. #include <i2c.h>
  28. #define PMU_I2C_ADDRESS 0x2D
  29. #define MAX_I2C_RETRY 3
  30. /*
  31. * Routine: pinmux_init
  32. * Description: Do individual peripheral pinmux configs
  33. */
  34. void pinmux_init(void)
  35. {
  36. pinmux_config_table(tegra3_pinmux_common,
  37. ARRAY_SIZE(tegra3_pinmux_common));
  38. pinmux_config_table(unused_pins_lowpower,
  39. ARRAY_SIZE(unused_pins_lowpower));
  40. /* Initialize any non-default pad configs (APB_MISC_GP regs) */
  41. padgrp_config_table(cardhu_padctrl, ARRAY_SIZE(cardhu_padctrl));
  42. }
  43. #if defined(CONFIG_TEGRA_MMC)
  44. /*
  45. * Do I2C/PMU writes to bring up SD card bus power
  46. *
  47. */
  48. void board_sdmmc_voltage_init(void)
  49. {
  50. uchar reg, data_buffer[1];
  51. int i;
  52. i2c_set_bus_num(0); /* PMU is on bus 0 */
  53. /* TPS659110: LDO5_REG = 3.3v, ACTIVE to SDMMC1 */
  54. data_buffer[0] = 0x65;
  55. reg = 0x32;
  56. for (i = 0; i < MAX_I2C_RETRY; ++i) {
  57. if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1))
  58. udelay(100);
  59. }
  60. /* TPS659110: GPIO7_REG = PDEN, output a 1 to EN_3V3_SYS */
  61. data_buffer[0] = 0x09;
  62. reg = 0x67;
  63. for (i = 0; i < MAX_I2C_RETRY; ++i) {
  64. if (i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1))
  65. udelay(100);
  66. }
  67. }
  68. /*
  69. * Routine: pin_mux_mmc
  70. * Description: setup the MMC muxes, power rails, etc.
  71. */
  72. void pin_mux_mmc(void)
  73. {
  74. /*
  75. * NOTE: We don't do mmc-specific pin muxes here.
  76. * They were done globally in pinmux_init().
  77. */
  78. /* Bring up the SDIO1 power rail */
  79. board_sdmmc_voltage_init();
  80. }
  81. #endif /* MMC */