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