Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Lucas Stach |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 8 | #include <asm/arch/clock.h> |
| 9 | #include <asm/arch/funcmux.h> |
| 10 | #include <asm/arch/pinmux.h> |
| 11 | #include <asm/arch-tegra/board.h> |
Marcel Ziswiler | af72262 | 2015-03-26 01:31:53 +0100 | [diff] [blame] | 12 | #include <asm/gpio.h> |
Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 13 | |
| 14 | #ifdef CONFIG_TEGRA_MMC |
Tom Warren | 9745cf8 | 2013-02-21 12:31:30 +0000 | [diff] [blame] | 15 | /* |
| 16 | * Routine: pin_mux_mmc |
| 17 | * Description: setup the pin muxes/tristate values for the SDMMC(s) |
| 18 | */ |
| 19 | void pin_mux_mmc(void) |
Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 20 | { |
| 21 | funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); |
Stephen Warren | f27f4e8 | 2014-03-21 12:28:58 -0600 | [diff] [blame] | 22 | pinmux_tristate_disable(PMUX_PINGRP_GMB); |
Lucas Stach | 85990a9 | 2012-10-07 11:36:06 +0000 | [diff] [blame] | 23 | } |
| 24 | #endif |
Marcel Ziswiler | af72262 | 2015-03-26 01:31:53 +0100 | [diff] [blame] | 25 | |
| 26 | #ifdef CONFIG_TEGRA_NAND |
| 27 | void pin_mux_nand(void) |
| 28 | { |
| 29 | funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT); |
Marcel Ziswiler | bdddbab | 2015-03-27 01:31:45 +0100 | [diff] [blame] | 30 | |
| 31 | /* |
| 32 | * configure pingroup ATC to something unrelated to |
| 33 | * avoid ATC overriding KBC |
| 34 | */ |
| 35 | pinmux_set_func(PMUX_PINGRP_ATC, PMUX_FUNC_GMI); |
Marcel Ziswiler | af72262 | 2015-03-26 01:31:53 +0100 | [diff] [blame] | 36 | } |
| 37 | #endif |
| 38 | |
| 39 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 40 | void pin_mux_usb(void) |
| 41 | { |
| 42 | /* module internal USB bus to connect ethernet chipset */ |
| 43 | funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); |
| 44 | |
| 45 | /* ULPI reference clock output */ |
| 46 | pinmux_set_func(PMUX_PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); |
| 47 | pinmux_tristate_disable(PMUX_PINGRP_CDEV2); |
| 48 | |
| 49 | /* PHY reset GPIO */ |
| 50 | pinmux_tristate_disable(PMUX_PINGRP_UAC); |
| 51 | |
| 52 | /* VBus GPIO */ |
| 53 | pinmux_tristate_disable(PMUX_PINGRP_DTE); |
| 54 | |
Marcel Ziswiler | c33dd26 | 2015-03-26 02:17:07 +0100 | [diff] [blame] | 55 | /* Reset ASIX using LAN_RESET */ |
| 56 | gpio_request(GPIO_PV4, "LAN_RESET"); |
| 57 | gpio_direction_output(GPIO_PV4, 0); |
| 58 | pinmux_tristate_disable(PMUX_PINGRP_GPV); |
| 59 | udelay(5); |
| 60 | gpio_set_value(GPIO_PV4, 1); |
| 61 | |
| 62 | /* USBH_PEN: USB 1 aka Tegra USB port 3 VBus */ |
Marcel Ziswiler | af72262 | 2015-03-26 01:31:53 +0100 | [diff] [blame] | 63 | pinmux_tristate_disable(PMUX_PINGRP_SPIG); |
| 64 | } |
| 65 | #endif |