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