[U-Boot] [PATCH] EXYNOS: PINMUX: modify the gpio function value for mmc

Jaehoon Chung jh80.chung at samsung.com
Wed Jun 20 07:01:44 CEST 2012


In Exynos5, if used 8-bit busmode, set the gpio configuration to
GPIO_FUNC(0x2).

Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
---
 arch/arm/cpu/armv7/exynos/pinmux.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c
index d2b7d2c..356cf8d 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -66,12 +66,14 @@ static int exynos5_mmc_config(int peripheral, int flags)
 	struct exynos5_gpio_part1 *gpio1 =
 		(struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1();
 	struct s5p_gpio_bank *bank, *bank_ext;
-	int i;
+	int i, gpio_func, gpio_start;
 
 	switch (peripheral) {
 	case PERIPH_ID_SDMMC0:
 		bank = &gpio1->c0;
 		bank_ext = &gpio1->c1;
+		gpio_func = GPIO_FUNC(0x2);
+		gpio_start = 0;
 		break;
 	case PERIPH_ID_SDMMC1:
 		bank = &gpio1->c1;
@@ -80,6 +82,8 @@ static int exynos5_mmc_config(int peripheral, int flags)
 	case PERIPH_ID_SDMMC2:
 		bank = &gpio1->c2;
 		bank_ext = &gpio1->c3;
+		gpio_func = GPIO_FUNC(0x3);
+		gpio_start = 3;
 		break;
 	case PERIPH_ID_SDMMC3:
 		bank = &gpio1->c3;
@@ -92,18 +96,16 @@ static int exynos5_mmc_config(int peripheral, int flags)
 		return -1;
 	}
 	if (flags & PINMUX_FLAG_8BIT_MODE) {
-		for (i = 3; i <= 6; i++) {
-			s5p_gpio_cfg_pin(bank_ext, i, GPIO_FUNC(0x3));
+		for (i = gpio_start; i <= gpio_start + 3; i++) {
+			s5p_gpio_cfg_pin(bank_ext, i, gpio_func);
 			s5p_gpio_set_pull(bank_ext, i, GPIO_PULL_UP);
 			s5p_gpio_set_drv(bank_ext, i, GPIO_DRV_4X);
 		}
 	}
-	for (i = 0; i < 2; i++) {
-		s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
-		s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
-		s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);
-	}
-	for (i = 3; i <= 6; i++) {
+
+	for (i = 0; i <= 6; i++) {
+		if (i == 2)
+			continue;
 		s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
 		s5p_gpio_set_pull(bank, i, GPIO_PULL_UP);
 		s5p_gpio_set_drv(bank, i, GPIO_DRV_4X);


More information about the U-Boot mailing list