blob: 496e8a02111e9a91c17f7c7026cdd8a6b6c4b5e2 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0
Stephen Warren1ce3d542016-05-12 13:32:56 -06002/*
3 * Copyright (c) 2016, NVIDIA CORPORATION
Stephen Warren1ce3d542016-05-12 13:32:56 -06004 */
5
6#include <common.h>
Stephen Warren7f253c82016-07-29 13:15:05 -06007#include <i2c.h>
8#include "../p2571/max77620_init.h"
9
10int tegra_board_init(void)
11{
12 struct udevice *dev;
13 uchar val;
14 int ret;
15
16 /* Turn on MAX77620 LDO3 to 3.3V for SD card power */
17 debug("%s: Set LDO3 for VDDIO_SDMMC_AP power to 3.3V\n", __func__);
18 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
19 if (ret) {
20 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
21 return ret;
22 }
23 /* 0xF2 for 3.3v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
24 val = 0xF2;
25 ret = dm_i2c_write(dev, MAX77620_CNFG1_L3_REG, &val, 1);
26 if (ret) {
27 printf("i2c_write 0 0x3c 0x27 failed: %d\n", ret);
28 return ret;
29 }
30
31 return 0;
32}
Stephen Warren2f546502016-07-29 13:15:06 -060033
34int tegra_pcie_board_init(void)
35{
36 struct udevice *dev;
37 uchar val;
38 int ret;
39
40 /* Turn on MAX77620 LDO7 to 1.05V for PEX power */
41 debug("%s: Set LDO7 for PEX power to 1.05V\n", __func__);
42 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
43 if (ret) {
44 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
45 return -1;
46 }
47 /* 0xC5 for 1.05v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
48 val = 0xC5;
49 ret = dm_i2c_write(dev, MAX77620_CNFG1_L7_REG, &val, 1);
50 if (ret)
51 printf("i2c_write 0 0x3c 0x31 failed: %d\n", ret);
52
53 return 0;
54}