Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Stephen Warren | 1ce3d54 | 2016-05-12 13:32:56 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016, NVIDIA CORPORATION |
Stephen Warren | 1ce3d54 | 2016-05-12 13:32:56 -0600 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | 0af6e2d | 2019-08-01 09:46:52 -0600 | [diff] [blame] | 7 | #include <env.h> |
Thierry Reding | f0112e4 | 2019-04-15 11:32:36 +0200 | [diff] [blame] | 8 | #include <fdtdec.h> |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 9 | #include <i2c.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 10 | #include <log.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 11 | #include <net.h> |
Thierry Reding | 4a024c2 | 2021-09-03 15:16:22 +0200 | [diff] [blame] | 12 | #include <stdlib.h> |
Thierry Reding | 92f9f8c | 2019-04-15 11:32:34 +0200 | [diff] [blame] | 13 | #include <linux/libfdt.h> |
Thierry Reding | 1398da6 | 2021-09-03 15:16:24 +0200 | [diff] [blame] | 14 | #include <asm/arch-tegra/board.h> |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 15 | #include "../p2571/max77620_init.h" |
| 16 | |
Thierry Reding | 7cef2b2 | 2019-04-15 11:32:28 +0200 | [diff] [blame] | 17 | void pin_mux_mmc(void) |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 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__); |
Thierry Reding | 7cef2b2 | 2019-04-15 11:32:28 +0200 | [diff] [blame] | 28 | return; |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 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); |
Thierry Reding | 7cef2b2 | 2019-04-15 11:32:28 +0200 | [diff] [blame] | 35 | return; |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 36 | } |
Stephen Warren | 7f253c8 | 2016-07-29 13:15:05 -0600 | [diff] [blame] | 37 | } |
Stephen Warren | 2f54650 | 2016-07-29 13:15:06 -0600 | [diff] [blame] | 38 | |
Thierry Reding | 7cef2b2 | 2019-04-15 11:32:28 +0200 | [diff] [blame] | 39 | #ifdef CONFIG_PCI_TEGRA |
Stephen Warren | 2f54650 | 2016-07-29 13:15:06 -0600 | [diff] [blame] | 40 | int 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 | } |
Thierry Reding | 7cef2b2 | 2019-04-15 11:32:28 +0200 | [diff] [blame] | 61 | #endif |
Thierry Reding | 92f9f8c | 2019-04-15 11:32:34 +0200 | [diff] [blame] | 62 | |
Thierry Reding | 1398da6 | 2021-09-03 15:16:24 +0200 | [diff] [blame] | 63 | static 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 | }; |
Thierry Reding | f0112e4 | 2019-04-15 11:32:36 +0200 | [diff] [blame] | 68 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 69 | int ft_board_setup(void *fdt, struct bd_info *bd) |
Thierry Reding | f0112e4 | 2019-04-15 11:32:36 +0200 | [diff] [blame] | 70 | { |
| 71 | ft_mac_address_setup(fdt); |
Thierry Reding | 1398da6 | 2021-09-03 15:16:24 +0200 | [diff] [blame] | 72 | ft_carveout_setup(fdt, nodes, ARRAY_SIZE(nodes)); |
Thierry Reding | f0112e4 | 2019-04-15 11:32:36 +0200 | [diff] [blame] | 73 | |
Thierry Reding | 92f9f8c | 2019-04-15 11:32:34 +0200 | [diff] [blame] | 74 | return 0; |
| 75 | } |