Patchwork [U-Boot,1/4] EXYNOS4: Add pinmux support for UART

login
register
mail settings
Submitter Jeong-Hyeon Kim
Date Dec. 12, 2012, 7:54 a.m.
Message ID <1355298896-10803-2-git-send-email-jhkim@insignal.co.kr>
Download mbox | patch
Permalink /patch/205447/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Jeong-Hyeon Kim - Dec. 12, 2012, 7:54 a.m.
From: Jeong-Hyeon Kim <jhkim@insignal.co.kr>

This patch adds pinmux support for UART channels

Signed-off-by: Jeong-Hyeon Kim <jhkim@insignal.co.kr>
---
 arch/arm/cpu/armv7/exynos/pinmux.c |   41 ++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

Patch

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c
index f02f441..364ee2a 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -366,6 +366,41 @@  static int exynos4_mmc_config(int peripheral, int flags)
 	return 0;
 }
 
+static void exynos4_uart_config(int peripheral)
+{
+	struct exynos4_gpio_part1 *gpio1 =
+		(struct exynos4_gpio_part1 *) samsung_get_base_gpio_part1();
+	struct s5p_gpio_bank *bank;
+	int i, start, count;
+
+	switch (peripheral) {
+	case PERIPH_ID_UART0:
+		bank = &gpio1->a0;
+		start = 0;
+		count = 4;
+		break;
+	case PERIPH_ID_UART1:
+		bank = &gpio1->a0;
+		start = 4;
+		count = 4;
+		break;
+	case PERIPH_ID_UART2:
+		bank = &gpio1->a1;
+		start = 0;
+		count = 4;
+		break;
+	case PERIPH_ID_UART3:
+		bank = &gpio1->a1;
+		start = 4;
+		count = 2;
+		break;
+	}
+	for (i = start; i < start + count; i++) {
+		s5p_gpio_set_pull(bank, i, GPIO_PULL_NONE);
+		s5p_gpio_cfg_pin(bank, i, GPIO_FUNC(0x2));
+	}
+}
+
 static int exynos4_pinmux_config(int peripheral, int flags)
 {
 	switch (peripheral) {
@@ -377,6 +412,12 @@  static int exynos4_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_SDMMC4:
 		printf("SDMMC device %d not implemented\n", peripheral);
 		return -1;
+	case PERIPH_ID_UART0:
+	case PERIPH_ID_UART1:
+	case PERIPH_ID_UART2:
+	case PERIPH_ID_UART3:
+		exynos4_uart_config(peripheral);
+		break;
 	default:
 		debug("%s: invalid peripheral %d", __func__, peripheral);
 		return -1;