Skip to contentSkip to conversation

Exynos5: Pinmux: Add fdt for pinmux

PATCH Superseded Akshay Saraswat 1 participant 1 message Feb 18, 2013

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Exynos5: Pinmux: Add fdt for pinmux

This patch adds fdt nodes for peripherals which require pin muxing and configuration. Device tree bindings for pinctrl are kept same as required for Linux. Existing pinmux code modified to retrieve gpio range and function related info from fdt.

Depends-on: [PATCH 0/3 V2] EXYNOS5: Add GPIO numbering feature
URL: http://lists.denx.de/pipermail/u-boot/2013-January/144681.html

---
Changes since v1:
- Device tree bindings changed to linux style.
- Added documentation for samsung pinctrl.

 arch/arm/cpu/armv7/exynos/pinmux.c           |  445 +++++++++++++----
 arch/arm/dts/exynos5250-pinctrl.dtsi         |  675 ++++++++++++++++++++++++++
 arch/arm/dts/exynos5250.dtsi                 |    1 +
 doc/device-tree-bindings/samsung-pinctrl.txt |  253 ++++++++++
 include/fdtdec.h                             |    1 +
 lib/fdtdec.c                                 |    1 +
 6 files changed, 1280 insertions(+), 96 deletions(-)
 create mode 100644 arch/arm/dts/exynos5250-pinctrl.dtsi
 create mode 100644 doc/device-tree-bindings/samsung-pinctrl.txt
arch/arm/cpu/armv7/exynos/pinmux.c +349 -96
index c79d58e..da59483 100644
@@ -23,91 +23,302 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <linux/ctype.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
 
-static void exynos5_uart_config(int peripheral)
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Struct for storing pin function and gpio related info */
+struct pin_group {
+	void *dev_name;
+	int npins;
+	int function;
+	enum exynos5_gpio_pin gpio[];
+};
+
+static void get_pins(const struct fdt_property *fprop, struct pin_group *pgrp)
+{
+	int i;
+
+	pgrp->npins = 0;
+
+	for (i = 0; !(fprop->data[i] == (int)NULL &&
+				fprop->data[i-1] == (int)NULL); i += 7) {
+		int pin_bank = -1;
+
+		if (strncmp(fprop->data + i, "gpa0", 4) == 0)
+			pin_bank = GPIO_A00;
+		else if (strncmp(fprop->data + i, "gpa1", 4) == 0)
+			pin_bank = GPIO_A10;
+		else if (strncmp(fprop->data + i, "gpa2", 4) == 0)
+			pin_bank = GPIO_A20;
+		else if (strncmp(fprop->data + i, "gpb0", 4) == 0)
+			pin_bank = GPIO_B00;
+		else if (strncmp(fprop->data + i, "gpb1", 4) == 0)
+			pin_bank = GPIO_B10;
+		else if (strncmp(fprop->data + i, "gpb2", 4) == 0)
+			pin_bank = GPIO_B20;
+		else if (strncmp(fprop->data + i, "gpb3", 4) == 0)
+			pin_bank = GPIO_B30;
+		else if (strncmp(fprop->data + i, "gpc0", 4) == 0)
+			pin_bank = GPIO_C00;
+		else if (strncmp(fprop->data + i, "gpc1", 4) == 0)
+			pin_bank = GPIO_C10;
+		else if (strncmp(fprop->data + i, "gpc2", 4) == 0)
+			pin_bank = GPIO_C20;
+		else if (strncmp(fprop->data + i, "gpc3", 4) == 0)
+			pin_bank = GPIO_C30;
+		else if (strncmp(fprop->data + i, "gpd0", 4) == 0)
+			pin_bank = GPIO_D00;
+		else if (strncmp(fprop->data + i, "gpd1", 4) == 0)
+			pin_bank = GPIO_D10;
+		else if (strncmp(fprop->data + i, "gpy0", 4) == 0)
+			pin_bank = GPIO_Y00;
+		else if (strncmp(fprop->data + i, "gpy1", 4) == 0)
+			pin_bank = GPIO_Y10;
+		else if (strncmp(fprop->data + i, "gpy2", 4) == 0)
+			pin_bank = GPIO_Y20;
+		else if (strncmp(fprop->data + i, "gpy3", 4) == 0)
+			pin_bank = GPIO_Y30;
+		else if (strncmp(fprop->data + i, "gpy4", 4) == 0)
+			pin_bank = GPIO_Y40;
+		else if (strncmp(fprop->data + i, "gpy5", 4) == 0)
+			pin_bank = GPIO_Y50;
+		else if (strncmp(fprop->data + i, "gpy6", 4) == 0)
+			pin_bank = GPIO_Y60;
+		else if (strncmp(fprop->data + i, "gpc4", 4) == 0)
+			pin_bank = GPIO_C40;
+		else if (strncmp(fprop->data + i, "gpx0", 4) == 0)
+			pin_bank = GPIO_X00;
+		else if (strncmp(fprop->data + i, "gpx1", 4) == 0)
+			pin_bank = GPIO_X10;
+		else if (strncmp(fprop->data + i, "gpx2", 4) == 0)
+			pin_bank = GPIO_X20;
+		else if (strncmp(fprop->data + i, "gpx3", 4) == 0)
+			pin_bank = GPIO_X30;
+		else if (strncmp(fprop->data + i, "gpe0", 4) == 0)
+			pin_bank = GPIO_E00;
+		else if (strncmp(fprop->data + i, "gpe1", 4) == 0)
+			pin_bank = GPIO_E10;
+		else if (strncmp(fprop->data + i, "gpf0", 4) == 0)
+			pin_bank = GPIO_F10;
+		else if (strncmp(fprop->data + i, "gpf1", 4) == 0)
+			pin_bank = GPIO_F10;
+		else if (strncmp(fprop->data + i, "gpg0", 4) == 0)
+			pin_bank = GPIO_G00;
+		else if (strncmp(fprop->data + i, "gpg1", 4) == 0)
+			pin_bank = GPIO_G10;
+		else if (strncmp(fprop->data + i, "gpg2", 4) == 0)
+			pin_bank = GPIO_G20;
+		else if (strncmp(fprop->data + i, "gph0", 4) == 0)
+			pin_bank = GPIO_H00;
+		else if (strncmp(fprop->data + i, "gph1", 4) == 0)
+			pin_bank = GPIO_H10;
+		else if (strncmp(fprop->data + i, "gpv0", 4) == 0)
+			pin_bank = GPIO_V00;
+		else if (strncmp(fprop->data + i, "gpv1", 4) == 0)
+			pin_bank = GPIO_V10;
+		else if (strncmp(fprop->data + i, "gpv2", 4) == 0)
+			pin_bank = GPIO_V20;
+		else if (strncmp(fprop->data + i, "gpv3", 4) == 0)
+			pin_bank = GPIO_V30;
+		else if (strncmp(fprop->data + i, "gpv4", 4) == 0)
+			pin_bank = GPIO_V40;
+		else if (strncmp(fprop->data + i, "gpz", 4) == 0)
+			pin_bank = GPIO_Z0;
+
+		if (pin_bank >= 0 && isdigit(fprop->data[i+5])) {
+			pgrp->gpio[pgrp->npins] =
+					pin_bank + (fprop->data[i+5] - '0');
+			pgrp->npins++;
+		}
+	}
+}
+
+static int get_fdt_values(struct pin_group *pgrp)
+{
+	int i;
+	int node, subnode;
+	const struct fdt_property *fprop;
+
+	for (i = 0; i < 4; i++) {
+		/* Get the node from FDT for pinctrl */
+		node = fdtdec_next_compatible(gd->fdt_blob, 0,
+						COMPAT_SAMSUNG_PINCTRL);
+		if (node < 0) {
+			printf("PINCTRL: No node for pinctrl in device tree\n");
+			return -1;
+		}
+
+		subnode = fdt_subnode_offset(gd->fdt_blob,
+						node, pgrp->dev_name);
+		if (subnode < 0)
+			continue;
+
+		fprop = fdt_get_property(gd->fdt_blob,
+					subnode, "samsung,pins", NULL);
+		pgrp->function = fdtdec_get_int(gd->fdt_blob,
+					subnode, "samsung,pin-function", -1);
+		get_pins(fprop, pgrp);
+
+		return 0;
+	}
+
+	printf("PINCTRL: No subnode for %s", (char *)pgrp->dev_name);
+
+	return -1;
+}
+
+static int exynos5_uart_config(int peripheral)
 {
-	int i, start, count;
+	int i;
+	char *data, *fctl = NULL;
+	struct pin_group pgrp;
 
 	switch (peripheral) {
 	case PERIPH_ID_UART0:
-		start = GPIO_A00;
-		count = 4;
+		data = "uart0-data";
+		fctl = "uart0-fctl";
 		break;
 	case PERIPH_ID_UART1:
-		start = GPIO_D00;
-		count = 4;
+		data = "uart1-data";
+		fctl = "uart1-fctl";
 		break;
 	case PERIPH_ID_UART2:
-		start = GPIO_A10;
-		count = 4;
+		data = "uart2-data";
+		fctl = "uart2-fctl";
 		break;
 	case PERIPH_ID_UART3:
-		start = GPIO_A14;
-		count = 2;
+		data = "uart3-data";
 		break;
 	}
-	for (i = start; i < start + count; i++) {
-		gpio_set_pull(i, GPIO_PULL_NONE);
-		gpio_cfg_pin(i, GPIO_FUNC(0x2));
+
+	pgrp.dev_name = data;
+
+	/* Retrieve gpio pins for this UART's data line */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++) {
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_NONE);
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
 	}
+
+	if (peripheral != PERIPH_ID_UART3) {
+		pgrp.dev_name = fctl;
+
+		/* Retrieve gpio pins for this UART's data line */
+		if (get_fdt_values(&pgrp))
+			return -1;
+
+		/* Apply pin configurations */
+		for (i = 0; i < pgrp.npins; i++) {
+			gpio_set_pull(pgrp.gpio[i], GPIO_PULL_NONE);
+			gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		}
+	}
+
+	return 0;
 }
 
 static int exynos5_mmc_config(int peripheral, int flags)
 {
-	int i, start, start_ext, gpio_func = 0;
+	int i;
+	char *clk, *cmd, *width4, *width8 = NULL;
+	struct pin_group pgrp;
 
 	switch (peripheral) {
 	case PERIPH_ID_SDMMC0:
-		start = GPIO_C00;
-		start_ext = GPIO_C10;
-		gpio_func = GPIO_FUNC(0x2);
+		clk = "sd0-clk";
+		cmd = "sd0-cmd";
+		width4 = "sd0-bus-width4";
+		width8 = "sd0-bus-width8";
 		break;
 	case PERIPH_ID_SDMMC1:
-		start = GPIO_C20;
-		start_ext = 0;
+		clk = "sd1-clk";
+		cmd = "sd1-cmd";
+		width4 = "sd1-bus-width4";
 		break;
 	case PERIPH_ID_SDMMC2:
-		start = GPIO_C30;
-		start_ext = GPIO_C43;
-		gpio_func = GPIO_FUNC(0x3);
+		clk = "sd2-clk";
+		cmd = "sd2-cmd";
+		width4 = "sd2-bus-width4";
+		width8 = "sd2-bus-width8";
 		break;
 	case PERIPH_ID_SDMMC3:
-		start = GPIO_C40;
-		start_ext = 0;
+		clk = "sd3-clk";
+		cmd = "sd3-cmd";
+		width4 = "sd3-bus-width4";
 		break;
 	}
-	if ((flags & PINMUX_FLAG_8BIT_MODE) && !start_ext) {
+
+	/* Apply pin configurations */
+	if ((flags & PINMUX_FLAG_8BIT_MODE) && width8 == NULL) {
 		debug("SDMMC device %d does not support 8bit mode",
 				peripheral);
 		return -1;
 	}
+
 	if (flags & PINMUX_FLAG_8BIT_MODE) {
-		for (i = start_ext; i <= (start_ext + 3); i++) {
-			gpio_cfg_pin(i, gpio_func);
-			gpio_set_pull(i, GPIO_PULL_UP);
-			gpio_set_drv(i, GPIO_DRV_4X);
+		pgrp.dev_name = width8;
+
+		/* Retrieve gpio range and base for this SDMMC */
+		if (get_fdt_values(&pgrp))
+			return -1;
+
+		for (i = 0; i < pgrp.npins; i++) {
+			gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+			gpio_set_pull(pgrp.gpio[i], GPIO_PULL_UP);
+			gpio_set_drv(pgrp.gpio[i], GPIO_DRV_4X);
 		}
 	}
-	for (i = 0; i < 2; i++) {
-		gpio_cfg_pin(start + i, GPIO_FUNC(0x2));
-		gpio_set_pull(start + i, GPIO_PULL_NONE);
-		gpio_set_drv(start + i, GPIO_DRV_4X);
+
+	pgrp.dev_name = clk;
+
+	/* Retrieve gpio range and base for this SDMMC */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	for (i = 0; i < pgrp.npins; i++) {
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_NONE);
+		gpio_set_drv(pgrp.gpio[i], GPIO_DRV_4X);
 	}
-	for (i = 3; i <= 6; i++) {
-		gpio_cfg_pin(start + i, GPIO_FUNC(0x2));
-		gpio_set_pull(start + i, GPIO_PULL_UP);
-		gpio_set_drv(start + i, GPIO_DRV_4X);
+
+	pgrp.dev_name = cmd;
+
+	/* Retrieve gpio range and base for this SDMMC */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	for (i = 0; i < pgrp.npins; i++) {
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_NONE);
+		gpio_set_drv(pgrp.gpio[i], GPIO_DRV_4X);
+	}
+
+	pgrp.dev_name = width4;
+
+	/* Retrieve gpio range and base for this SDMMC */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	for (i = 0; i < pgrp.npins ; i++) {
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_UP);
+		gpio_set_drv(pgrp.gpio[i], GPIO_DRV_4X);
 	}
 
 	return 0;
 }
 
-static void exynos5_sromc_config(int flags)
+static int exynos5_sromc_config(int flags)
 {
 	int i;
+	static struct pin_group pgrp;
 
 	/*
 	 * SROM:CS1 and EBI
@@ -124,13 +335,28 @@ static void exynos5_sromc_config(int flags)
 	 * GPY1[2]	SROM_WAIT(2)
 	 * GPY1[3]	EBI_DATA_RDn(2)
 	 */
-	gpio_cfg_pin(GPIO_Y00 + (flags & PINMUX_FLAG_BANK),
-				GPIO_FUNC(2));
-	gpio_cfg_pin(GPIO_Y04, GPIO_FUNC(2));
-	gpio_cfg_pin(GPIO_Y05, GPIO_FUNC(2));
+	pgrp.dev_name = "srom-cs1";
+
+	/* Retrieve gpio range and base for SROM CS1 */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	gpio_cfg_pin(pgrp.gpio[0] + (flags & PINMUX_FLAG_BANK),
+						GPIO_FUNC(pgrp.function));
+
+	for (i = 1; i < pgrp.npins; i++)
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
 
-	for (i = 0; i < 4; i++)
-		gpio_cfg_pin(GPIO_Y10 + i, GPIO_FUNC(2));
+	pgrp.dev_name = "srom-ebi-enable";
+
+	/* Retrieve gpio range and base for SROM EBI */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++)
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
 
 	/*
 	 * EBI: 8 Addrss Lines
@@ -164,97 +390,126 @@ static void exynos5_sromc_config(int flags)
 	 * GPY6[6]	EBI_DATA[14](2)
 	 * GPY6[7]	EBI_DATA[15](2)
 	 */
-	for (i = 0; i < 8; i++) {
-		gpio_cfg_pin(GPIO_Y30 + i, GPIO_FUNC(2));
-		gpio_set_pull(GPIO_Y30 + i, GPIO_PULL_UP);
+	pgrp.dev_name = "srom-ebi-addr-lines";
 
-		gpio_cfg_pin(GPIO_Y50 + i, GPIO_FUNC(2));
-		gpio_set_pull(GPIO_Y50 + i, GPIO_PULL_UP);
+	/* Retrieve gpio range and base for SROM EBI address lines */
+	if (get_fdt_values(&pgrp))
+		return -1;
 
-		gpio_cfg_pin(GPIO_Y60 + i, GPIO_FUNC(2));
-		gpio_set_pull(GPIO_Y60 + i, GPIO_PULL_UP);
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++) {
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_UP);
 	}
+
+	pgrp.dev_name = "srom-ebi-data-lines";
+
+	/* Retrieve gpio range and base for SROM EBI data lines */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++) {
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+		gpio_set_pull(pgrp.gpio[i], GPIO_PULL_UP);
+	}
+
+	return 0;
 }
 
-static void exynos5_i2c_config(int peripheral, int flags)
+static int exynos5_i2c_config(int peripheral, int flags)
 {
+	int i;
+	struct pin_group pgrp;
 
 	switch (peripheral) {
 	case PERIPH_ID_I2C0:
-		gpio_cfg_pin(GPIO_B30, GPIO_FUNC(0x2));
-		gpio_cfg_pin(GPIO_B31, GPIO_FUNC(0x2));
+		pgrp.dev_name = "i2c0-bus";
 		break;
 	case PERIPH_ID_I2C1:
-		gpio_cfg_pin(GPIO_B32, GPIO_FUNC(0x2));
-		gpio_cfg_pin(GPIO_B33, GPIO_FUNC(0x2));
+		pgrp.dev_name = "i2c1-bus";
 		break;
 	case PERIPH_ID_I2C2:
-		gpio_cfg_pin(GPIO_A06, GPIO_FUNC(0x3));
-		gpio_cfg_pin(GPIO_A07, GPIO_FUNC(0x3));
+		pgrp.dev_name = "i2c2-bus";
 		break;
 	case PERIPH_ID_I2C3:
-		gpio_cfg_pin(GPIO_A12, GPIO_FUNC(0x3));
-		gpio_cfg_pin(GPIO_A13, GPIO_FUNC(0x3));
+		pgrp.dev_name = "i2c3-bus";
 		break;
 	case PERIPH_ID_I2C4:
-		gpio_cfg_pin(GPIO_A20, GPIO_FUNC(0x3));
-		gpio_cfg_pin(GPIO_A21, GPIO_FUNC(0x3));
+		pgrp.dev_name = "i2c4-bus";
 		break;
 	case PERIPH_ID_I2C5:
-		gpio_cfg_pin(GPIO_A22, GPIO_FUNC(0x3));
-		gpio_cfg_pin(GPIO_A23, GPIO_FUNC(0x3));
+		pgrp.dev_name = "i2c5-bus";
 		break;
 	case PERIPH_ID_I2C6:
-		gpio_cfg_pin(GPIO_B13, GPIO_FUNC(0x4));
-		gpio_cfg_pin(GPIO_B14, GPIO_FUNC(0x4));
+		pgrp.dev_name = "i2c6-bus";
 		break;
 	case PERIPH_ID_I2C7:
-		gpio_cfg_pin(GPIO_B22, GPIO_FUNC(0x3));
-		gpio_cfg_pin(GPIO_B23, GPIO_FUNC(0x3));
+		pgrp.dev_name = "i2c7-bus";
 		break;
 	}
+
+	/* Retrieve gpio range and base for this I2C */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++)
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+
+	return 0;
 }
 
-static void exynos5_i2s_config(int peripheral)
+static int exynos5_i2s_config(int peripheral)
 {
 	int i;
+	struct pin_group pgrp;
 
-	for (i = 0; i < 5; i++)
-		gpio_cfg_pin(GPIO_B00+i, GPIO_FUNC(0x02));
+	pgrp.dev_name = "i2s";
+
+	/* Retrieve gpio range and base for I2S */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++)
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+
+	return 0;
 }
 
-void exynos5_spi_config(int peripheral)
+int exynos5_spi_config(int peripheral)
 {
-	int cfg = 0, pin = 0, i;
+	int i;
+	static struct pin_group pgrp;
 
 	switch (peripheral) {
 	case PERIPH_ID_SPI0:
-		cfg = GPIO_FUNC(0x2);
-		pin = GPIO_A20;
+		pgrp.dev_name = "spi0-bus";
 		break;
 	case PERIPH_ID_SPI1:
-		cfg = GPIO_FUNC(0x2);
-		pin = GPIO_A24;
+		pgrp.dev_name = "spi1-bus";
 		break;
 	case PERIPH_ID_SPI2:
-		cfg = GPIO_FUNC(0x5);
-		pin = GPIO_B11;
+		pgrp.dev_name = "spi2-bus";
 		break;
 	case PERIPH_ID_SPI3:
-		cfg = GPIO_FUNC(0x2);
-		pin = GPIO_F10;
+		pgrp.dev_name = "spi3-bus";
 		break;
 	case PERIPH_ID_SPI4:
-		for (i = 0; i < 2; i++) {
-			gpio_cfg_pin(GPIO_F02 + i, GPIO_FUNC(0x4));
-			gpio_cfg_pin(GPIO_E04 + i, GPIO_FUNC(0x4));
-		}
+		pgrp.dev_name = "spi4-bus";
 		break;
 	}
-	if (peripheral != PERIPH_ID_SPI4) {
-		for (i = pin; i < pin + 4; i++)
-			gpio_cfg_pin(i, cfg);
-	}
+
+	/* Retrieve gpio range and base for this SPI */
+	if (get_fdt_values(&pgrp))
+		return -1;
+
+	/* Apply pin configurations */
+	for (i = 0; i < pgrp.npins; i++)
+		gpio_cfg_pin(pgrp.gpio[i], GPIO_FUNC(pgrp.function));
+
+	return 0;
 }
 
 static int exynos5_pinmux_config(int peripheral, int flags)
@@ -264,7 +519,7 @@ static int exynos5_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_UART1:
 	case PERIPH_ID_UART2:
 	case PERIPH_ID_UART3:
-		exynos5_uart_config(peripheral);
+		return exynos5_uart_config(peripheral);
 		break;
 	case PERIPH_ID_SDMMC0:
 	case PERIPH_ID_SDMMC1:
@@ -272,7 +527,7 @@ static int exynos5_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_SDMMC3:
 		return exynos5_mmc_config(peripheral, flags);
 	case PERIPH_ID_SROMC:
-		exynos5_sromc_config(flags);
+		return exynos5_sromc_config(flags);
 		break;
 	case PERIPH_ID_I2C0:
 	case PERIPH_ID_I2C1:
@@ -282,24 +537,22 @@ static int exynos5_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_I2C5:
 	case PERIPH_ID_I2C6:
 	case PERIPH_ID_I2C7:
-		exynos5_i2c_config(peripheral, flags);
+		return exynos5_i2c_config(peripheral, flags);
 		break;
 	case PERIPH_ID_I2S1:
-		exynos5_i2s_config(peripheral);
+		return exynos5_i2s_config(peripheral);
 		break;
 	case PERIPH_ID_SPI0:
 	case PERIPH_ID_SPI1:
 	case PERIPH_ID_SPI2:
 	case PERIPH_ID_SPI3:
 	case PERIPH_ID_SPI4:
-		exynos5_spi_config(peripheral);
+		return exynos5_spi_config(peripheral);
 		break;
 	default:
 		debug("%s: invalid peripheral %d", __func__, peripheral);
 		return -1;
 	}
-
-	return 0;
 }
 
 static void exynos4_i2c_config(int peripheral, int flags)
arch/arm/dts/exynos5250-pinctrl.dtsi new file +675 -0

675 lines not on this page · raw message

arch/arm/dts/exynos5250.dtsi +1 -0
index ed8c8dd..8fcf432 100644
@@ -18,6 +18,7 @@
 */
 
 /include/ "skeleton.dtsi"
+/include/ "exynos5250-pinctrl.dtsi"
 
 / {
 	compatible = "samsung,exynos5250";
doc/device-tree-bindings/samsung-pinctrl.txt new file +253 -0

253 lines not on this page · raw message

include/fdtdec.h +1 -0
index 77f244f..9c1bd82 100644
@@ -81,6 +81,7 @@ enum fdt_compat_id {
 	COMPAT_SAMSUNG_EXYNOS_EHCI,	/* Exynos EHCI controller */
 	COMPAT_SAMSUNG_EXYNOS_USB_PHY,	/* Exynos phy controller for usb2.0 */
 	COMPAT_MAXIM_MAX77686_PMIC,	/* MAX77686 PMIC */
+	COMPAT_SAMSUNG_PINCTRL,		/* PINCTRL */
 
 	COMPAT_COUNT,
 };
lib/fdtdec.c +1 -0
index 3ae348d..16dbdcd 100644
@@ -56,6 +56,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"),
 	COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"),
 	COMPAT(MAXIM_MAX77686_PMIC, "maxim,max77686_pmic"),
+	COMPAT(SAMSUNG_PINCTRL, "samsung,pinctrl"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
Signature · 1 line
1.7.9.5