Patchwork [U-Boot,2/4] EXYNOS4: Add pinmux support for I2C

login
register
mail settings
Submitter Jeong-Hyeon Kim
Date Dec. 12, 2012, 7:54 a.m.
Message ID <1355298896-10803-3-git-send-email-jhkim@insignal.co.kr>
Download mbox | patch
Permalink /patch/205448/
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 I2C channels

Signed-off-by: Jeong-Hyeon Kim <jhkim@insignal.co.kr>
---
 arch/arm/cpu/armv7/exynos/pinmux.c |   51 ++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
Heiko Schocher - Dec. 12, 2012, 8:16 a.m.
Hello Jeong,

On 12.12.2012 08:54, Jeong Hyeon Kim wrote:
> From: Jeong-Hyeon Kim<jhkim@insignal.co.kr>
>
> This patch adds pinmux support for I2C channels
>
> Signed-off-by: Jeong-Hyeon Kim<jhkim@insignal.co.kr>
> ---
>   arch/arm/cpu/armv7/exynos/pinmux.c |   51 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 51 insertions(+)

similiar patch is applied to u-boot-i2c, see:

http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=commitdiff;h=4d4628dcaa51b501bec148a9c5c55df3920350dc

and pull request is pending. Can you check, if the above patch fits
your needs?

Thanks!

bye,
Heiko
Jeong-Hyeon Kim - Dec. 12, 2012, 10:19 a.m.
Dear Heiko,

Thanks for your concern.

I didn't know the patch.
It can be replaced my patch.

Thank you,
JHKIM



2012년 12월 12일 17:16, Heiko Schocher 쓴 글:
> Hello Jeong,
>
> On 12.12.2012 08:54, Jeong Hyeon Kim wrote:
>> From: Jeong-Hyeon Kim<jhkim@insignal.co.kr>
>>
>> This patch adds pinmux support for I2C channels
>>
>> Signed-off-by: Jeong-Hyeon Kim<jhkim@insignal.co.kr>
>> ---
>> arch/arm/cpu/armv7/exynos/pinmux.c | 51
>> ++++++++++++++++++++++++++++++++++++
>> 1 file changed, 51 insertions(+)
>
> similiar patch is applied to u-boot-i2c, see:
>
> http://git.denx.de/?p=u-boot/u-boot-i2c.git;a=commitdiff;h=4d4628dcaa51b501bec148a9c5c55df3920350dc
>
>
> and pull request is pending. Can you check, if the above patch fits
> your needs?
>
> Thanks!
>
> bye,
> Heiko

Patch

diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c
index 364ee2a..d778b46 100644
--- a/arch/arm/cpu/armv7/exynos/pinmux.c
+++ b/arch/arm/cpu/armv7/exynos/pinmux.c
@@ -401,6 +401,48 @@  static void exynos4_uart_config(int peripheral)
 	}
 }
 
+static void exynos4_i2c_config(int peripheral, int flags)
+{
+
+	struct exynos4_gpio_part1 *gpio1 =
+		(struct exynos4_gpio_part1 *) samsung_get_base_gpio_part1();
+
+	switch (peripheral) {
+	case PERIPH_ID_I2C0:
+		s5p_gpio_cfg_pin(&gpio1->d1, 0, GPIO_FUNC(0x2));
+		s5p_gpio_cfg_pin(&gpio1->d1, 1, GPIO_FUNC(0x2));
+		break;
+	case PERIPH_ID_I2C1:
+		s5p_gpio_cfg_pin(&gpio1->d1, 2, GPIO_FUNC(0x2));
+		s5p_gpio_cfg_pin(&gpio1->d1, 3, GPIO_FUNC(0x2));
+		break;
+	case PERIPH_ID_I2C2:
+		s5p_gpio_cfg_pin(&gpio1->a0, 6, GPIO_FUNC(0x3));
+		s5p_gpio_cfg_pin(&gpio1->a0, 7, GPIO_FUNC(0x3));
+		break;
+	case PERIPH_ID_I2C3:
+		s5p_gpio_cfg_pin(&gpio1->a1, 2, GPIO_FUNC(0x3));
+		s5p_gpio_cfg_pin(&gpio1->a1, 3, GPIO_FUNC(0x3));
+		break;
+	case PERIPH_ID_I2C4:
+		s5p_gpio_cfg_pin(&gpio1->b, 0, GPIO_FUNC(0x3));
+		s5p_gpio_cfg_pin(&gpio1->b, 1, GPIO_FUNC(0x3));
+		break;
+	case PERIPH_ID_I2C5:
+		s5p_gpio_cfg_pin(&gpio1->b, 2, GPIO_FUNC(0x3));
+		s5p_gpio_cfg_pin(&gpio1->b, 3, GPIO_FUNC(0x3));
+		break;
+	case PERIPH_ID_I2C6:
+		s5p_gpio_cfg_pin(&gpio1->c1, 3, GPIO_FUNC(0x4));
+		s5p_gpio_cfg_pin(&gpio1->c1, 4, GPIO_FUNC(0x4));
+		break;
+	case PERIPH_ID_I2C7:
+		s5p_gpio_cfg_pin(&gpio1->d0, 2, GPIO_FUNC(0x3));
+		s5p_gpio_cfg_pin(&gpio1->d0, 3, GPIO_FUNC(0x3));
+		break;
+	}
+}
+
 static int exynos4_pinmux_config(int peripheral, int flags)
 {
 	switch (peripheral) {
@@ -417,6 +459,15 @@  static int exynos4_pinmux_config(int peripheral, int flags)
 	case PERIPH_ID_UART2:
 	case PERIPH_ID_UART3:
 		exynos4_uart_config(peripheral);
+	case PERIPH_ID_I2C0:
+	case PERIPH_ID_I2C1:
+	case PERIPH_ID_I2C2:
+	case PERIPH_ID_I2C3:
+	case PERIPH_ID_I2C4:
+	case PERIPH_ID_I2C5:
+	case PERIPH_ID_I2C6:
+	case PERIPH_ID_I2C7:
+		exynos4_i2c_config(peripheral, flags);
 		break;
 	default:
 		debug("%s: invalid peripheral %d", __func__, peripheral);