]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/tegra20-common/funcmux.c
Merge branch 'next' of git://git.denx.de/u-boot-mpc83xx
[u-boot] / arch / arm / cpu / tegra20-common / funcmux.c
index b2129adf2fec76da8cc0072583da09cbe645f636..1931908199d1682a732b41a33a9b5625abc03554 100644 (file)
@@ -1,22 +1,7 @@
 /*
  * Copyright (c) 2011 The Chromium OS Authors.
- * See file CREDITS for list of people who contributed to this
- * project.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /* Tegra20 high-level function multiplexing */
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
 
+/*
+ * The PINMUX macro is used to set up pinmux tables.
+ */
+#define PINMUX(grp, mux, pupd, tri)                   \
+       {PINGRP_##grp, PMUX_FUNC_##mux, PMUX_PULL_##pupd, PMUX_TRI_##tri}
+
+static const struct pingroup_config disp1_default[] = {
+       PINMUX(LDI,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP1,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHP2,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LHS,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LM0,   RSVD4,      NORMAL,    NORMAL),
+       PINMUX(LPP,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(LPW0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LPW2,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LSC0,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LSPI,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LVP1,  DISPA,      NORMAL,    NORMAL),
+       PINMUX(LVS,   DISPA,      NORMAL,    NORMAL),
+       PINMUX(SLXD,  SPDIF,      NORMAL,    NORMAL),
+};
+
+
 int funcmux_select(enum periph_id id, int config)
 {
        int bad_config = config != FUNCMUX_DEFAULT;
@@ -74,8 +83,8 @@ int funcmux_select(enum periph_id id, int config)
                break;
 
        case PERIPH_ID_UART2:
-               if (config == FUNCMUX_UART2_IRDA) {
-                       pinmux_set_func(PINGRP_UAD, PMUX_FUNC_IRDA);
+               if (config == FUNCMUX_UART2_UAD) {
+                       pinmux_set_func(PINGRP_UAD, PMUX_FUNC_UARTB);
                        pinmux_tristate_disable(PINGRP_UAD);
                }
                break;
@@ -235,9 +244,39 @@ int funcmux_select(enum periph_id id, int config)
                break;
 
        case PERIPH_ID_NDFLASH:
-               if (config == FUNCMUX_NDFLASH_ATC) {
+               switch (config) {
+               case FUNCMUX_NDFLASH_ATC:
                        pinmux_set_func(PINGRP_ATC, PMUX_FUNC_NAND);
                        pinmux_tristate_disable(PINGRP_ATC);
+                       break;
+               case FUNCMUX_NDFLASH_KBC_8_BIT:
+                       pinmux_set_func(PINGRP_KBCA, PMUX_FUNC_NAND);
+                       pinmux_set_func(PINGRP_KBCC, PMUX_FUNC_NAND);
+                       pinmux_set_func(PINGRP_KBCD, PMUX_FUNC_NAND);
+                       pinmux_set_func(PINGRP_KBCE, PMUX_FUNC_NAND);
+                       pinmux_set_func(PINGRP_KBCF, PMUX_FUNC_NAND);
+
+                       pinmux_tristate_disable(PINGRP_KBCA);
+                       pinmux_tristate_disable(PINGRP_KBCC);
+                       pinmux_tristate_disable(PINGRP_KBCD);
+                       pinmux_tristate_disable(PINGRP_KBCE);
+                       pinmux_tristate_disable(PINGRP_KBCF);
+
+                       bad_config = 0;
+                       break;
+               }
+               break;
+       case PERIPH_ID_DISP1:
+               if (config == FUNCMUX_DEFAULT) {
+                       int i;
+
+                       for (i = PINGRP_LD0; i <= PINGRP_LD17; i++) {
+                               pinmux_set_func(i, PMUX_FUNC_DISPA);
+                               pinmux_tristate_disable(i);
+                               pinmux_set_pullupdown(i, PMUX_PULL_NORMAL);
+                       }
+                       pinmux_config_table(disp1_default,
+                                           ARRAY_SIZE(disp1_default));
                }
                break;