Stephen Warren | a844b01 | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2014 |
| 3 | * NVIDIA Corporation <www.nvidia.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Thierry Reding | 0f4c83b | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 9 | #include <netdev.h> |
| 10 | #include <power/as3722.h> |
| 11 | |
Stephen Warren | fa2a123 | 2014-04-22 14:37:55 -0600 | [diff] [blame] | 12 | #include <asm/arch/gpio.h> |
Stephen Warren | a844b01 | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 13 | #include <asm/arch/pinmux.h> |
Alexandre Courbot | 5e270dc | 2015-07-09 16:33:01 +0900 | [diff] [blame] | 14 | #include <asm/arch-tegra/gpu.h> |
Thierry Reding | 0f4c83b | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 15 | |
Stephen Warren | a844b01 | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 16 | #include "pinmux-config-jetson-tk1.h" |
| 17 | |
Thierry Reding | 0f4c83b | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 18 | DECLARE_GLOBAL_DATA_PTR; |
| 19 | |
Stephen Warren | a844b01 | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 20 | /* |
| 21 | * Routine: pinmux_init |
| 22 | * Description: Do individual peripheral pinmux configs |
| 23 | */ |
| 24 | void pinmux_init(void) |
| 25 | { |
Stephen Warren | 2516bef | 2015-02-18 13:27:04 -0700 | [diff] [blame] | 26 | pinmux_clear_tristate_input_clamping(); |
Stephen Warren | f16f64f | 2014-04-22 14:37:56 -0600 | [diff] [blame] | 27 | |
Stephen Warren | fa2a123 | 2014-04-22 14:37:55 -0600 | [diff] [blame] | 28 | gpio_config_table(jetson_tk1_gpio_inits, |
| 29 | ARRAY_SIZE(jetson_tk1_gpio_inits)); |
| 30 | |
Stephen Warren | a844b01 | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 31 | pinmux_config_pingrp_table(jetson_tk1_pingrps, |
| 32 | ARRAY_SIZE(jetson_tk1_pingrps)); |
| 33 | |
| 34 | pinmux_config_drvgrp_table(jetson_tk1_drvgrps, |
| 35 | ARRAY_SIZE(jetson_tk1_drvgrps)); |
| 36 | } |
Thierry Reding | 0f4c83b | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 37 | |
| 38 | #ifdef CONFIG_PCI_TEGRA |
| 39 | int tegra_pcie_board_init(void) |
| 40 | { |
| 41 | struct udevice *pmic; |
| 42 | int err; |
| 43 | |
| 44 | err = as3722_init(&pmic); |
| 45 | if (err) { |
| 46 | error("failed to initialize AS3722 PMIC: %d\n", err); |
| 47 | return err; |
| 48 | } |
| 49 | |
| 50 | err = as3722_sd_enable(pmic, 4); |
| 51 | if (err < 0) { |
| 52 | error("failed to enable SD4: %d\n", err); |
| 53 | return err; |
| 54 | } |
| 55 | |
| 56 | err = as3722_sd_set_voltage(pmic, 4, 0x24); |
| 57 | if (err < 0) { |
| 58 | error("failed to set SD4 voltage: %d\n", err); |
| 59 | return err; |
| 60 | } |
| 61 | |
| 62 | err = as3722_gpio_configure(pmic, 1, AS3722_GPIO_OUTPUT_VDDH | |
| 63 | AS3722_GPIO_INVERT); |
| 64 | if (err < 0) { |
| 65 | error("failed to configure GPIO#1 as output: %d\n", err); |
| 66 | return err; |
| 67 | } |
| 68 | |
| 69 | err = as3722_gpio_direction_output(pmic, 2, 1); |
| 70 | if (err < 0) { |
| 71 | error("failed to set GPIO#2 high: %d\n", err); |
| 72 | return err; |
| 73 | } |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | int board_eth_init(bd_t *bis) |
| 79 | { |
| 80 | return pci_eth_init(bis); |
| 81 | } |
| 82 | #endif /* PCI */ |
Alexandre Courbot | 5e270dc | 2015-07-09 16:33:01 +0900 | [diff] [blame] | 83 | |
| 84 | int ft_board_setup(void *blob, bd_t *bd) |
| 85 | { |
| 86 | gpu_enable_node(blob, "/gpu@0,57000000"); |
| 87 | |
| 88 | return 0; |
| 89 | } |