[U-Boot] [PATCH 4/7] tegra: Add SDMMC support to funcmux

Simon Glass sjg at chromium.org
Mon Jan 9 23:53:30 CET 2012


This adds support for SDMMC ports to the funcmux. Only one
option is supported: FUNCMUXO_SDMMC_8BIT which selects an 8-bit
wide SDIO interface where available.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 arch/arm/cpu/armv7/tegra2/funcmux.c        |   70 ++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra2/funcmux.h |    5 ++
 2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra2/funcmux.c b/arch/arm/cpu/armv7/tegra2/funcmux.c
index ea40f1a..accae5c 100644
--- a/arch/arm/cpu/armv7/tegra2/funcmux.c
+++ b/arch/arm/cpu/armv7/tegra2/funcmux.c
@@ -94,6 +94,76 @@ int funcmux_select(enum periph_id id, int config, int options)
 		}
 		break;
 
+	case PERIPH_ID_SDMMC2:
+		if (config == 0) {
+			if (options & FUNCMUXO_SDMMC_8BIT) {
+				pinmux_set_func(PINGRP_DTA, PMUX_FUNC_SDIO2);
+				pinmux_set_func(PINGRP_DTD, PMUX_FUNC_SDIO2);
+
+				pinmux_tristate_disable(PINGRP_DTA);
+				pinmux_tristate_disable(PINGRP_DTD);
+				options &= ~FUNCMUXO_SDMMC_8BIT;
+			} else {
+				required_options = FUNCMUXO_SDMMC_8BIT;
+			}
+		}
+		break;
+
+	case PERIPH_ID_SDMMC3:
+		if (config == 0) {
+			pinmux_set_func(PINGRP_SDB, PMUX_FUNC_SDIO3);
+			pinmux_set_func(PINGRP_SDC, PMUX_FUNC_SDIO3);
+			pinmux_set_func(PINGRP_SDD, PMUX_FUNC_SDIO3);
+
+			pinmux_tristate_disable(PINGRP_SDC);
+			pinmux_tristate_disable(PINGRP_SDD);
+			pinmux_tristate_disable(PINGRP_SDB);
+
+			if (options & FUNCMUXO_SDMMC_8BIT) {
+				pinmux_set_func(PINGRP_SLXA, PMUX_FUNC_SDIO3);
+				pinmux_set_func(PINGRP_SLXC, PMUX_FUNC_SDIO3);
+				pinmux_set_func(PINGRP_SLXD, PMUX_FUNC_SDIO3);
+				pinmux_set_func(PINGRP_SLXK, PMUX_FUNC_SDIO3);
+
+				pinmux_tristate_disable(PINGRP_SLXA);
+				pinmux_tristate_disable(PINGRP_SLXC);
+				pinmux_tristate_disable(PINGRP_SLXD);
+				pinmux_tristate_disable(PINGRP_SLXK);
+				options &= ~FUNCMUXO_SDMMC_8BIT;
+			}
+		}
+		break;
+
+	case PERIPH_ID_SDMMC4:
+		switch (config) {
+		case 0:
+			if (options & FUNCMUXO_SDMMC_8BIT) {
+				pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
+				pinmux_set_func(PINGRP_ATC, PMUX_FUNC_SDIO4);
+				pinmux_set_func(PINGRP_ATD, PMUX_FUNC_SDIO4);
+
+				pinmux_tristate_disable(PINGRP_ATB);
+				pinmux_tristate_disable(PINGRP_ATC);
+				pinmux_tristate_disable(PINGRP_ATD);
+				options &= ~FUNCMUXO_SDMMC_8BIT;
+			} else {
+				required_options = FUNCMUXO_SDMMC_8BIT;
+			}
+			break;
+
+		case 1:
+			pinmux_set_func(PINGRP_ATB, PMUX_FUNC_SDIO4);
+			pinmux_set_func(PINGRP_GMA, PMUX_FUNC_SDIO4);
+			pinmux_set_func(PINGRP_GME, PMUX_FUNC_SDIO4);
+
+			pinmux_tristate_disable(PINGRP_ATB);
+			pinmux_tristate_disable(PINGRP_GMA);
+			pinmux_tristate_disable(PINGRP_GME);
+			bad_config = 0;
+			break;
+		}
+		break;
+
 	default:
 		debug("%s: invalid periph_id %d", __func__, id);
 		return -1;
diff --git a/arch/arm/include/asm/arch-tegra2/funcmux.h b/arch/arm/include/asm/arch-tegra2/funcmux.h
index a3b315b..2c48433 100644
--- a/arch/arm/include/asm/arch-tegra2/funcmux.h
+++ b/arch/arm/include/asm/arch-tegra2/funcmux.h
@@ -24,6 +24,11 @@
 #ifndef __FUNCMUX_H
 #define __FUNCMUX_H
 
+/* Options supported by the func mux */
+enum {
+	FUNCMUXO_SDMMC_8BIT	= 1 << 0,	/* 8-pin SDMMC interface */
+};
+
 /**
  * Select a config for a particular peripheral.
  *
-- 
1.7.3.1



More information about the U-Boot mailing list