]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/tegra30-common/funcmux.c
Merge branch 'master' of git://git.denx.de/u-boot
[karo-tx-uboot.git] / arch / arm / cpu / tegra30-common / funcmux.c
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(PINGRP_ULPI_DATA0, PMUX_FUNC_UARTA);
33                         pinmux_set_func(PINGRP_ULPI_DATA1, PMUX_FUNC_UARTA);
34                         pinmux_set_func(PINGRP_ULPI_DATA2, PMUX_FUNC_UARTA);
35                         pinmux_set_func(PINGRP_ULPI_DATA3, PMUX_FUNC_UARTA);
36                         pinmux_tristate_disable(PINGRP_ULPI_DATA0);
37                         pinmux_tristate_disable(PINGRP_ULPI_DATA1);
38                         pinmux_tristate_disable(PINGRP_ULPI_DATA2);
39                         pinmux_tristate_disable(PINGRP_ULPI_DATA3);
40                         break;
41                 }
42                 break;
43
44         /* Add other periph IDs here as needed */
45
46         default:
47                 debug("%s: invalid periph_id %d", __func__, id);
48                 return -1;
49         }
50
51         if (bad_config) {
52                 debug("%s: invalid config %d for periph_id %d", __func__,
53                       config, id);
54                 return -1;
55         }
56         return 0;
57 }