blob: 12eaa7a1e53da27b2efaf866668bf2a24d4a2263 [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
Simon Glass0af6e2d2019-08-01 09:46:52 -06006#include <env.h>
Thierry Redingf0112e42019-04-15 11:32:36 +02007#include <fdtdec.h>
Stephen Warren7f253c82016-07-29 13:15:05 -06008#include <i2c.h>
Simon Glass0f2af882020-05-10 11:40:05 -06009#include <log.h>
Simon Glass274e0b02020-05-10 11:39:56 -060010#include <net.h>
Thierry Reding4a024c22021-09-03 15:16:22 +020011#include <stdlib.h>
Thierry Reding92f9f8c2019-04-15 11:32:34 +020012#include <linux/libfdt.h>
Thierry Reding1398da62021-09-03 15:16:24 +020013#include <asm/arch-tegra/board.h>
Stephen Warren7f253c82016-07-29 13:15:05 -060014#include "../p2571/max77620_init.h"
15
Thierry Reding7cef2b22019-04-15 11:32:28 +020016void pin_mux_mmc(void)
Stephen Warren7f253c82016-07-29 13:15:05 -060017{
18 struct udevice *dev;
19 uchar val;
20 int ret;
21
22 /* Turn on MAX77620 LDO3 to 3.3V for SD card power */
23 debug("%s: Set LDO3 for VDDIO_SDMMC_AP power to 3.3V\n", __func__);
24 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
25 if (ret) {
26 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
Thierry Reding7cef2b22019-04-15 11:32:28 +020027 return;
Stephen Warren7f253c82016-07-29 13:15:05 -060028 }
29 /* 0xF2 for 3.3v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
30 val = 0xF2;
31 ret = dm_i2c_write(dev, MAX77620_CNFG1_L3_REG, &val, 1);
32 if (ret) {
33 printf("i2c_write 0 0x3c 0x27 failed: %d\n", ret);
Thierry Reding7cef2b22019-04-15 11:32:28 +020034 return;
Stephen Warren7f253c82016-07-29 13:15:05 -060035 }
Stephen Warren7f253c82016-07-29 13:15:05 -060036}
Stephen Warren2f546502016-07-29 13:15:06 -060037
Thierry Reding7cef2b22019-04-15 11:32:28 +020038#ifdef CONFIG_PCI_TEGRA
Stephen Warren2f546502016-07-29 13:15:06 -060039int tegra_pcie_board_init(void)
40{
41 struct udevice *dev;
42 uchar val;
43 int ret;
44
45 /* Turn on MAX77620 LDO7 to 1.05V for PEX power */
46 debug("%s: Set LDO7 for PEX power to 1.05V\n", __func__);
47 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
48 if (ret) {
49 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
50 return -1;
51 }
52 /* 0xC5 for 1.05v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
53 val = 0xC5;
54 ret = dm_i2c_write(dev, MAX77620_CNFG1_L7_REG, &val, 1);
55 if (ret)
56 printf("i2c_write 0 0x3c 0x31 failed: %d\n", ret);
57
58 return 0;
59}
Thierry Reding7cef2b22019-04-15 11:32:28 +020060#endif
Thierry Reding92f9f8c2019-04-15 11:32:34 +020061
Thierry Reding1398da62021-09-03 15:16:24 +020062static const char * const nodes[] = {
63 "/host1x@13e00000/display-hub@15200000/display@15200000",
64 "/host1x@13e00000/display-hub@15200000/display@15210000",
65 "/host1x@13e00000/display-hub@15200000/display@15220000",
66};
Thierry Redingf0112e42019-04-15 11:32:36 +020067
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090068int ft_board_setup(void *fdt, struct bd_info *bd)
Thierry Redingf0112e42019-04-15 11:32:36 +020069{
70 ft_mac_address_setup(fdt);
Thierry Reding1398da62021-09-03 15:16:24 +020071 ft_carveout_setup(fdt, nodes, ARRAY_SIZE(nodes));
Thierry Redingf0112e42019-04-15 11:32:36 +020072
Thierry Reding92f9f8c2019-04-15 11:32:34 +020073 return 0;
74}