dalmore.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 <dm.h>
  18. #include <asm/arch/pinmux.h>
  19. #include <asm/arch/gp_padctrl.h>
  20. #include "pinmux-config-dalmore.h"
  21. #include <i2c.h>
  22. #define BAT_I2C_ADDRESS 0x48 /* TPS65090 charger */
  23. #define PMU_I2C_ADDRESS 0x58 /* TPS65913 PMU */
  24. /*
  25. * Routine: pinmux_init
  26. * Description: Do individual peripheral pinmux configs
  27. */
  28. void pinmux_init(void)
  29. {
  30. pinmux_config_pingrp_table(tegra114_pinmux_set_nontristate,
  31. ARRAY_SIZE(tegra114_pinmux_set_nontristate));
  32. pinmux_config_pingrp_table(tegra114_pinmux_common,
  33. ARRAY_SIZE(tegra114_pinmux_common));
  34. pinmux_config_pingrp_table(unused_pins_lowpower,
  35. ARRAY_SIZE(unused_pins_lowpower));
  36. /* Initialize any non-default pad configs (APB_MISC_GP regs) */
  37. pinmux_config_drvgrp_table(dalmore_padctrl,
  38. ARRAY_SIZE(dalmore_padctrl));
  39. }
  40. #if defined(CONFIG_TEGRA_MMC)
  41. /*
  42. * Do I2C/PMU writes to bring up SD card bus power
  43. *
  44. */
  45. void board_sdmmc_voltage_init(void)
  46. {
  47. struct udevice *dev;
  48. uchar reg, data_buffer[1];
  49. int ret;
  50. ret = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
  51. if (ret) {
  52. debug("%s: Cannot find PMIC I2C chip\n", __func__);
  53. return;
  54. }
  55. /* TPS65913: LDO9_VOLTAGE = 3.3V */
  56. data_buffer[0] = 0x31;
  57. reg = 0x61;
  58. ret = dm_i2c_write(dev, reg, data_buffer, 1);
  59. if (ret)
  60. printf("%s: PMU i2c_write %02X<-%02X returned %d\n",
  61. __func__, reg, data_buffer[0], ret);
  62. /* TPS65913: LDO9_CTRL = Active */
  63. data_buffer[0] = 0x01;
  64. reg = 0x60;
  65. ret = dm_i2c_write(dev, reg, data_buffer, 1);
  66. if (ret)
  67. printf("%s: PMU i2c_write %02X<-%02X returned %d\n",
  68. __func__, reg, data_buffer[0], ret);
  69. /* TPS65090: FET6_CTRL = enable output auto discharge, enable FET6 */
  70. data_buffer[0] = 0x03;
  71. reg = 0x14;
  72. ret = i2c_get_chip_for_busnum(0, BAT_I2C_ADDRESS, 1, &dev);
  73. if (ret) {
  74. debug("%s: Cannot find charger I2C chip\n", __func__);
  75. return;
  76. }
  77. ret = dm_i2c_write(dev, reg, data_buffer, 1);
  78. if (ret)
  79. printf("%s: BAT i2c_write %02X<-%02X returned %d\n",
  80. __func__, reg, data_buffer[0], ret);
  81. }
  82. /*
  83. * Routine: pin_mux_mmc
  84. * Description: setup the MMC muxes, power rails, etc.
  85. */
  86. void pin_mux_mmc(void)
  87. {
  88. /*
  89. * NOTE: We don't do mmc-specific pin muxes here.
  90. * They were done globally in pinmux_init().
  91. */
  92. /* Bring up the SDIO3 power rail */
  93. board_sdmmc_voltage_init();
  94. }
  95. #endif /* MMC */