dalmore.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) 2010-2013, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include <common.h>
  17. #include <asm/arch/pinmux.h>
  18. #include <asm/arch/gp_padctrl.h>
  19. #include "pinmux-config-dalmore.h"
  20. #include <i2c.h>
  21. #define BAT_I2C_ADDRESS 0x48 /* TPS65090 charger */
  22. #define PMU_I2C_ADDRESS 0x58 /* TPS65913 PMU */
  23. /*
  24. * Routine: pinmux_init
  25. * Description: Do individual peripheral pinmux configs
  26. */
  27. void pinmux_init(void)
  28. {
  29. pinmux_config_table(tegra114_pinmux_set_nontristate,
  30. ARRAY_SIZE(tegra114_pinmux_set_nontristate));
  31. pinmux_config_table(tegra114_pinmux_common,
  32. ARRAY_SIZE(tegra114_pinmux_common));
  33. pinmux_config_table(unused_pins_lowpower,
  34. ARRAY_SIZE(unused_pins_lowpower));
  35. /* Initialize any non-default pad configs (APB_MISC_GP regs) */
  36. padgrp_config_table(dalmore_padctrl, ARRAY_SIZE(dalmore_padctrl));
  37. }
  38. #if defined(CONFIG_TEGRA_MMC)
  39. /*
  40. * Do I2C/PMU writes to bring up SD card bus power
  41. *
  42. */
  43. void board_sdmmc_voltage_init(void)
  44. {
  45. uchar reg, data_buffer[1];
  46. int ret;
  47. ret = i2c_set_bus_num(0);/* PMU is on bus 0 */
  48. if (ret)
  49. printf("%s: i2c_set_bus_num returned %d\n", __func__, ret);
  50. /* TPS65913: LDO9_VOLTAGE = 3.3V */
  51. data_buffer[0] = 0x31;
  52. reg = 0x61;
  53. ret = i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1);
  54. if (ret)
  55. printf("%s: PMU i2c_write %02X<-%02X returned %d\n",
  56. __func__, reg, data_buffer[0], ret);
  57. /* TPS65913: LDO9_CTRL = Active */
  58. data_buffer[0] = 0x01;
  59. reg = 0x60;
  60. ret = i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1);
  61. if (ret)
  62. printf("%s: PMU i2c_write %02X<-%02X returned %d\n",
  63. __func__, reg, data_buffer[0], ret);
  64. /* TPS65090: FET6_CTRL = enable output auto discharge, enable FET6 */
  65. data_buffer[0] = 0x03;
  66. reg = 0x14;
  67. ret = i2c_write(BAT_I2C_ADDRESS, reg, 1, data_buffer, 1);
  68. if (ret)
  69. printf("%s: BAT i2c_write %02X<-%02X returned %d\n",
  70. __func__, reg, data_buffer[0], ret);
  71. }
  72. /*
  73. * Routine: pin_mux_mmc
  74. * Description: setup the MMC muxes, power rails, etc.
  75. */
  76. void pin_mux_mmc(void)
  77. {
  78. /*
  79. * NOTE: We don't do mmc-specific pin muxes here.
  80. * They were done globally in pinmux_init().
  81. */
  82. /* Bring up the SDIO3 power rail */
  83. board_sdmmc_voltage_init();
  84. }
  85. #endif /* MMC */