Stephen Warren | e04bfda | 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 | 6e2fca9 | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 9 | #include <netdev.h> |
| 10 | #include <power/as3722.h> |
| 11 | |
Stephen Warren | 9348532 | 2014-04-22 14:37:55 -0600 | [diff] [blame] | 12 | #include <asm/arch/gpio.h> |
Stephen Warren | e04bfda | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 13 | #include <asm/arch/pinmux.h> |
Thierry Reding | 6e2fca9 | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 14 | |
Stephen Warren | e04bfda | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 15 | #include "pinmux-config-jetson-tk1.h" |
| 16 | |
Thierry Reding | 6e2fca9 | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 17 | DECLARE_GLOBAL_DATA_PTR; |
| 18 | |
Stephen Warren | e04bfda | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 19 | /* |
| 20 | * Routine: pinmux_init |
| 21 | * Description: Do individual peripheral pinmux configs |
| 22 | */ |
| 23 | void pinmux_init(void) |
| 24 | { |
Stephen Warren | c1fe92f | 2015-02-18 13:27:04 -0700 | [diff] [blame] | 25 | pinmux_clear_tristate_input_clamping(); |
Stephen Warren | 4ff213b | 2014-04-22 14:37:56 -0600 | [diff] [blame] | 26 | |
Stephen Warren | 9348532 | 2014-04-22 14:37:55 -0600 | [diff] [blame] | 27 | gpio_config_table(jetson_tk1_gpio_inits, |
| 28 | ARRAY_SIZE(jetson_tk1_gpio_inits)); |
| 29 | |
Stephen Warren | e04bfda | 2014-03-25 11:39:33 -0600 | [diff] [blame] | 30 | pinmux_config_pingrp_table(jetson_tk1_pingrps, |
| 31 | ARRAY_SIZE(jetson_tk1_pingrps)); |
| 32 | |
| 33 | pinmux_config_drvgrp_table(jetson_tk1_drvgrps, |
| 34 | ARRAY_SIZE(jetson_tk1_drvgrps)); |
| 35 | } |
Thierry Reding | 6e2fca9 | 2014-12-09 22:25:21 -0700 | [diff] [blame] | 36 | |
| 37 | #ifdef CONFIG_PCI_TEGRA |
| 38 | int tegra_pcie_board_init(void) |
| 39 | { |
| 40 | struct udevice *pmic; |
| 41 | int err; |
| 42 | |
| 43 | err = as3722_init(&pmic); |
| 44 | if (err) { |
| 45 | error("failed to initialize AS3722 PMIC: %d\n", err); |
| 46 | return err; |
| 47 | } |
| 48 | |
| 49 | err = as3722_sd_enable(pmic, 4); |
| 50 | if (err < 0) { |
| 51 | error("failed to enable SD4: %d\n", err); |
| 52 | return err; |
| 53 | } |
| 54 | |
| 55 | err = as3722_sd_set_voltage(pmic, 4, 0x24); |
| 56 | if (err < 0) { |
| 57 | error("failed to set SD4 voltage: %d\n", err); |
| 58 | return err; |
| 59 | } |
| 60 | |
| 61 | err = as3722_gpio_configure(pmic, 1, AS3722_GPIO_OUTPUT_VDDH | |
| 62 | AS3722_GPIO_INVERT); |
| 63 | if (err < 0) { |
| 64 | error("failed to configure GPIO#1 as output: %d\n", err); |
| 65 | return err; |
| 66 | } |
| 67 | |
| 68 | err = as3722_gpio_direction_output(pmic, 2, 1); |
| 69 | if (err < 0) { |
| 70 | error("failed to set GPIO#2 high: %d\n", err); |
| 71 | return err; |
| 72 | } |
| 73 | |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | int board_eth_init(bd_t *bis) |
| 78 | { |
| 79 | return pci_eth_init(bis); |
| 80 | } |
| 81 | #endif /* PCI */ |