1
2
3
4
5
6
7
8#include <common.h>
9#include <fdtdec.h>
10#include <i2c.h>
11#include <linux/bitops.h>
12#include <linux/libfdt.h>
13#include <pca953x.h>
14#include <asm/arch/gpio.h>
15#include <asm/arch/pinmux.h>
16#include <asm/arch-tegra/board.h>
17#include "../p2571/max77620_init.h"
18
19void pin_mux_mmc(void)
20{
21 struct udevice *dev;
22 uchar val;
23 int ret;
24
25
26 debug("%s: Set LDO2 for VDDIO_SDMMC_AP power to 3.3V\n", __func__);
27 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
28 if (ret) {
29 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
30 return;
31 }
32
33 val = 0xF2;
34 ret = dm_i2c_write(dev, MAX77620_CNFG1_L2_REG, &val, 1);
35 if (ret)
36 printf("i2c_write 0 0x3c 0x27 failed: %d\n", ret);
37
38
39 ret = dm_i2c_read(dev, MAX77620_CNFG2_L4_REG, &val, 1);
40 if (ret) {
41 printf("i2c_read 0 0x3c 0x2c failed: %d\n", ret);
42 } else {
43 val &= ~BIT(1);
44 ret = dm_i2c_write(dev, MAX77620_CNFG2_L4_REG, &val, 1);
45 if (ret)
46 printf("i2c_write 0 0x3c 0x2c failed: %d\n", ret);
47 }
48
49
50 ret = dm_i2c_read(dev, MAX77620_CNFGGLBL1_REG, &val, 1);
51 if (ret) {
52 printf("i2c_write 0 0x3c 0x00 failed: %d\n", ret);
53 } else {
54 val |= BIT(6);
55 ret = dm_i2c_write(dev, MAX77620_CNFGGLBL1_REG, &val, 1);
56 if (ret)
57 printf("i2c_write 0 0x3c 0x00 failed: %d\n", ret);
58 }
59}
60
61#ifdef CONFIG_PCI_TEGRA
62int tegra_pcie_board_init(void)
63{
64 struct udevice *dev;
65 uchar val;
66 int ret;
67
68
69 debug("%s: Set LDO1 for PEX power to 1.05V\n", __func__);
70 ret = i2c_get_chip_for_busnum(0, MAX77620_I2C_ADDR_7BIT, 1, &dev);
71 if (ret) {
72 printf("%s: Cannot find MAX77620 I2C chip\n", __func__);
73 return -1;
74 }
75
76 val = 0xCA;
77 ret = dm_i2c_write(dev, MAX77620_CNFG1_L1_REG, &val, 1);
78 if (ret)
79 printf("i2c_write 0 0x3c 0x25 failed: %d\n", ret);
80
81 return 0;
82}
83#endif
84
85static const char * const nodes[] = {
86 "/host1x@50000000/dc@54200000",
87 "/host1x@50000000/dc@54240000",
88 "/external-memory-controller@7001b000",
89};
90
91int ft_board_setup(void *fdt, struct bd_info *bd)
92{
93 ft_mac_address_setup(fdt);
94 ft_carveout_setup(fdt, nodes, ARRAY_SIZE(nodes));
95
96 return 0;
97}
98