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