1*09f455dcSMasahiro Yamada /* 2*09f455dcSMasahiro Yamada * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved. 3*09f455dcSMasahiro Yamada * 4*09f455dcSMasahiro Yamada * This program is free software; you can redistribute it and/or modify it 5*09f455dcSMasahiro Yamada * under the terms and conditions of the GNU General Public License, 6*09f455dcSMasahiro Yamada * version 2, as published by the Free Software Foundation. 7*09f455dcSMasahiro Yamada * 8*09f455dcSMasahiro Yamada * This program is distributed in the hope it will be useful, but WITHOUT 9*09f455dcSMasahiro Yamada * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10*09f455dcSMasahiro Yamada * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11*09f455dcSMasahiro Yamada * more details. 12*09f455dcSMasahiro Yamada * 13*09f455dcSMasahiro Yamada * You should have received a copy of the GNU General Public License 14*09f455dcSMasahiro Yamada * along with this program. If not, see <http://www.gnu.org/licenses/>. 15*09f455dcSMasahiro Yamada */ 16*09f455dcSMasahiro Yamada 17*09f455dcSMasahiro Yamada /* Tegra30 high-level function multiplexing */ 18*09f455dcSMasahiro Yamada 19*09f455dcSMasahiro Yamada #include <common.h> 20*09f455dcSMasahiro Yamada #include <asm/arch/clock.h> 21*09f455dcSMasahiro Yamada #include <asm/arch/funcmux.h> 22*09f455dcSMasahiro Yamada #include <asm/arch/pinmux.h> 23*09f455dcSMasahiro Yamada 24*09f455dcSMasahiro Yamada int funcmux_select(enum periph_id id, int config) 25*09f455dcSMasahiro Yamada { 26*09f455dcSMasahiro Yamada int bad_config = config != FUNCMUX_DEFAULT; 27*09f455dcSMasahiro Yamada 28*09f455dcSMasahiro Yamada switch (id) { 29*09f455dcSMasahiro Yamada case PERIPH_ID_UART1: 30*09f455dcSMasahiro Yamada switch (config) { 31*09f455dcSMasahiro Yamada case FUNCMUX_UART1_ULPI: 32*09f455dcSMasahiro Yamada pinmux_set_func(PMUX_PINGRP_ULPI_DATA0_PO1, 33*09f455dcSMasahiro Yamada PMUX_FUNC_UARTA); 34*09f455dcSMasahiro Yamada pinmux_set_func(PMUX_PINGRP_ULPI_DATA1_PO2, 35*09f455dcSMasahiro Yamada PMUX_FUNC_UARTA); 36*09f455dcSMasahiro Yamada pinmux_set_func(PMUX_PINGRP_ULPI_DATA2_PO3, 37*09f455dcSMasahiro Yamada PMUX_FUNC_UARTA); 38*09f455dcSMasahiro Yamada pinmux_set_func(PMUX_PINGRP_ULPI_DATA3_PO4, 39*09f455dcSMasahiro Yamada PMUX_FUNC_UARTA); 40*09f455dcSMasahiro Yamada pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA0_PO1); 41*09f455dcSMasahiro Yamada pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA1_PO2); 42*09f455dcSMasahiro Yamada pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA2_PO3); 43*09f455dcSMasahiro Yamada pinmux_tristate_disable(PMUX_PINGRP_ULPI_DATA3_PO4); 44*09f455dcSMasahiro Yamada break; 45*09f455dcSMasahiro Yamada } 46*09f455dcSMasahiro Yamada break; 47*09f455dcSMasahiro Yamada 48*09f455dcSMasahiro Yamada /* Add other periph IDs here as needed */ 49*09f455dcSMasahiro Yamada 50*09f455dcSMasahiro Yamada default: 51*09f455dcSMasahiro Yamada debug("%s: invalid periph_id %d", __func__, id); 52*09f455dcSMasahiro Yamada return -1; 53*09f455dcSMasahiro Yamada } 54*09f455dcSMasahiro Yamada 55*09f455dcSMasahiro Yamada if (bad_config) { 56*09f455dcSMasahiro Yamada debug("%s: invalid config %d for periph_id %d", __func__, 57*09f455dcSMasahiro Yamada config, id); 58*09f455dcSMasahiro Yamada return -1; 59*09f455dcSMasahiro Yamada } 60*09f455dcSMasahiro Yamada return 0; 61*09f455dcSMasahiro Yamada } 62