p2771-0000.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2016, NVIDIA CORPORATION
  4. */
  5. #include <common.h>
  6. #include <env.h>
  7. #include <fdtdec.h>
  8. #include <i2c.h>
  9. #include <log.h>
  10. #include <net.h>
  11. #include <stdlib.h>
  12. #include <linux/libfdt.h>
  13. #include <asm/arch-tegra/board.h>
  14. #include "../p2571/max77620_init.h"
  15. void pin_mux_mmc(void)
  16. {
  17. struct udevice *dev;
  18. uchar val;
  19. int ret;
  20. /* Turn on MAX77620 LDO3 to 3.3V for SD card power */
  21. debug("%s: Set LDO3 for VDDIO_SDMMC_AP power to 3.3V\n", __func__);
  22. ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
  23. if (ret) {
  24. printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
  25. return;
  26. }
  27. /* 0xF2 for 3.3v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
  28. val = 0xF2;
  29. ret = dm_i2c_write(dev, MAX77620_CNFG1_L3_REG, &val, 1);
  30. if (ret) {
  31. printf("i2c_write 0 0x3c 0x27 failed: %d\n", ret);
  32. return;
  33. }
  34. }
  35. #ifdef CONFIG_PCI_TEGRA
  36. int tegra_pcie_board_init(void)
  37. {
  38. struct udevice *dev;
  39. uchar val;
  40. int ret;
  41. /* Turn on MAX77620 LDO7 to 1.05V for PEX power */
  42. debug("%s: Set LDO7 for PEX power to 1.05V\n", __func__);
  43. ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
  44. if (ret) {
  45. printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
  46. return -1;
  47. }
  48. /* 0xC5 for 1.05v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
  49. val = 0xC5;
  50. ret = dm_i2c_write(dev, MAX77620_CNFG1_L7_REG, &val, 1);
  51. if (ret)
  52. printf("i2c_write 0 0x3c 0x31 failed: %d\n", ret);
  53. return 0;
  54. }
  55. #endif
  56. static const char * const nodes[] = {
  57. "/host1x@13e00000/display-hub@15200000/display@15200000",
  58. "/host1x@13e00000/display-hub@15200000/display@15210000",
  59. "/host1x@13e00000/display-hub@15200000/display@15220000",
  60. };
  61. int ft_board_setup(void *fdt, struct bd_info *bd)
  62. {
  63. ft_mac_address_setup(fdt);
  64. ft_carveout_setup(fdt, nodes, ARRAY_SIZE(nodes));
  65. return 0;
  66. }