* [PATCH 1/2] ARM: OMAP2: Add pin multiplexing configuration for OMAP34xx I2C pins
@ 2008-06-09 14:46 Jarkko Nikula
2008-06-09 14:46 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper Jarkko Nikula
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2008-06-09 14:46 UTC (permalink / raw)
To: linux-omap; +Cc: Jarkko Nikula
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
arch/arm/mach-omap2/mux.c | 18 ++++++++++++++++++
include/asm-arm/arch-omap/mux.h | 9 +++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 6919d52..5a68fb3 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -226,6 +226,24 @@ static struct pin_config __initdata_or_module omap34xx_pins[] = {
* mux-mode | [active-mode | off-mode]
*/
+/* 34xx I2C */
+MUX_CFG_34XX("K21_34XX_I2C1_SCL", 0x1ba,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("J21_34XX_I2C1_SDA", 0x1bc,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AF15_34XX_I2C2_SCL", 0x1be,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AE15_34XX_I2C2_SDA", 0x1c0,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AF14_34XX_I2C3_SCL", 0x1c2,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AG14_34XX_I2C3_SDA", 0x1c4,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AD26_34XX_I2C4_SCL", 0xa00,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AE26_34XX_I2C4_SDA", 0xa02,
+ OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
+
/* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
MUX_CFG_34XX("Y8_3430_USB1HS_PHY_CLK", 0x5da,
OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_OUTPUT)
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
index ad39b0b..7a51aa0 100644
--- a/include/asm-arm/arch-omap/mux.h
+++ b/include/asm-arm/arch-omap/mux.h
@@ -644,6 +644,15 @@ enum omap24xx_index {
};
enum omap34xx_index {
+ /* 34xx I2C */
+ K21_34XX_I2C1_SCL,
+ J21_34XX_I2C1_SDA,
+ AF15_34XX_I2C2_SCL,
+ AE15_34XX_I2C2_SDA,
+ AF14_34XX_I2C3_SCL,
+ AG14_34XX_I2C3_SDA,
+ AD26_34XX_I2C4_SCL,
+ AE26_34XX_I2C4_SDA,
/* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
Y8_3430_USB1HS_PHY_CLK,
--
1.5.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper
2008-06-09 14:46 [PATCH 1/2] ARM: OMAP2: Add pin multiplexing configuration for OMAP34xx I2C pins Jarkko Nikula
@ 2008-06-09 14:46 ` Jarkko Nikula
2008-06-10 5:19 ` Jarkko Nikula
2008-06-10 5:42 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing " Jarkko Nikula
0 siblings, 2 replies; 5+ messages in thread
From: Jarkko Nikula @ 2008-06-09 14:46 UTC (permalink / raw)
To: linux-omap; +Cc: Jarkko Nikula
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
arch/arm/plat-omap/i2c.c | 51 ++++++++++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 7990ab1..23c2920 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -80,26 +80,39 @@ static struct platform_device omap_i2c_devices[] = {
#endif
};
-static void __init omap_i2c_mux_pins(int bus_id)
+static const int omap1_pins[][2] = {
+ { I2C_SCL, I2C_SDA },
+};
+static const int omap24xx_pins[][2] = {
+ { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
+ { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
+};
+static const int omap34xx_pins[][2] = {
+ { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
+ { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
+ { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
+ { AD26_34XX_I2C4_SCL, AE26_34XX_I2C4_SDA},
+};
+
+static void __init omap_i2c_mux_pins(int bus)
{
- /* TODO: Muxing for OMAP3 */
- switch (bus_id) {
- case 1:
- if (cpu_class_is_omap1()) {
- omap_cfg_reg(I2C_SCL);
- omap_cfg_reg(I2C_SDA);
- } else if (cpu_is_omap24xx()) {
- omap_cfg_reg(M19_24XX_I2C1_SCL);
- omap_cfg_reg(L15_24XX_I2C1_SDA);
- }
- break;
- case 2:
- if (cpu_is_omap24xx()) {
- omap_cfg_reg(J15_24XX_I2C2_SCL);
- omap_cfg_reg(H19_24XX_I2C2_SDA);
- }
- break;
+ int scl, sda;
+
+ if (cpu_class_is_omap1()) {
+ scl = omap1_pins[bus][0];
+ sda = omap1_pins[bus][1];
+ } else if (cpu_is_omap24xx()) {
+ scl = omap24xx_pins[bus][0];
+ sda = omap24xx_pins[bus][1];
+ } else if (cpu_is_omap34xx()) {
+ scl = omap34xx_pins[bus][0];
+ sda = omap34xx_pins[bus][1];
+ } else {
+ return;
}
+
+ omap_cfg_reg(sda);
+ omap_cfg_reg(scl);
}
int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -143,6 +156,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
res[1].start = irq;
}
- omap_i2c_mux_pins(bus_id);
+ omap_i2c_mux_pins(bus_id - 1);
return platform_device_register(pdev);
}
--
1.5.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper
2008-06-09 14:46 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper Jarkko Nikula
@ 2008-06-10 5:19 ` Jarkko Nikula
2008-06-10 5:42 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing " Jarkko Nikula
1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Nikula @ 2008-06-10 5:19 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: linux-omap
On Mon, 9 Jun 2008 17:46:41 +0300
Jarkko Nikula <jarkko.nikula@nokia.com> wrote:
> Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
> ---
> arch/arm/plat-omap/i2c.c | 51 +++++++++++++++++++++++++++
> +----------------- 1 files changed, 32 insertions(+), 19 deletions(-)
>
> -static void __init omap_i2c_mux_pins(int bus_id)
> +static const int omap1_pins[][2] = {
> + { I2C_SCL, I2C_SDA },
> +};
> +static const int omap24xx_pins[][2] = {
> + { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
> + { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
> +};
> +static const int omap34xx_pins[][2] = {
> + { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
> + { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
> + { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
> + { AD26_34XX_I2C4_SCL, AE26_34XX_I2C4_SDA},
> +};
> +
NAK to myself. Avoiding few #ifdefs is not an excuse for spending some
bytes here and also it doesn't look good to add muxing support for bus
4 where the module itself doesn't support it (yet).
Lazy me :-)
Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing into I2C bus registration helper
2008-06-09 14:46 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper Jarkko Nikula
2008-06-10 5:19 ` Jarkko Nikula
@ 2008-06-10 5:42 ` Jarkko Nikula
2008-06-10 21:24 ` Tony Lindgren
1 sibling, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2008-06-10 5:42 UTC (permalink / raw)
To: linux-omap; +Cc: Jarkko Nikula
- Simplify function omap_i2c_mux_pins
- Add OMAP34xx pin multiplexing for busses 1 - 3
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
arch/arm/plat-omap/i2c.c | 55 ++++++++++++++++++++++++++++++----------------
1 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 7990ab1..eddc24e 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -80,26 +80,43 @@ static struct platform_device omap_i2c_devices[] = {
#endif
};
-static void __init omap_i2c_mux_pins(int bus_id)
+#if defined(CONFIG_ARCH_OMAP24XX)
+static const int omap24xx_pins[][2] = {
+ { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
+ { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
+};
+#else
+static const int omap24xx_pins[][2] = {};
+#endif
+#if defined(CONFIG_ARCH_OMAP34XX)
+static const int omap34xx_pins[][2] = {
+ { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
+ { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
+ { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
+};
+#else
+static const int omap34xx_pins[][2] = {};
+#endif
+
+static void __init omap_i2c_mux_pins(int bus)
{
- /* TODO: Muxing for OMAP3 */
- switch (bus_id) {
- case 1:
- if (cpu_class_is_omap1()) {
- omap_cfg_reg(I2C_SCL);
- omap_cfg_reg(I2C_SDA);
- } else if (cpu_is_omap24xx()) {
- omap_cfg_reg(M19_24XX_I2C1_SCL);
- omap_cfg_reg(L15_24XX_I2C1_SDA);
- }
- break;
- case 2:
- if (cpu_is_omap24xx()) {
- omap_cfg_reg(J15_24XX_I2C2_SCL);
- omap_cfg_reg(H19_24XX_I2C2_SDA);
- }
- break;
+ int scl, sda;
+
+ if (cpu_class_is_omap1()) {
+ scl = I2C_SCL;
+ sda = I2C_SDA;
+ } else if (cpu_is_omap24xx()) {
+ scl = omap24xx_pins[bus][0];
+ sda = omap24xx_pins[bus][1];
+ } else if (cpu_is_omap34xx()) {
+ scl = omap34xx_pins[bus][0];
+ sda = omap34xx_pins[bus][1];
+ } else {
+ return;
}
+
+ omap_cfg_reg(sda);
+ omap_cfg_reg(scl);
}
int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -143,6 +160,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
res[1].start = irq;
}
- omap_i2c_mux_pins(bus_id);
+ omap_i2c_mux_pins(bus_id - 1);
return platform_device_register(pdev);
}
--
1.5.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing into I2C bus registration helper
2008-06-10 5:42 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing " Jarkko Nikula
@ 2008-06-10 21:24 ` Tony Lindgren
0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2008-06-10 21:24 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: linux-omap
* Jarkko Nikula <jarkko.nikula@nokia.com> [080609 22:43]:
> - Simplify function omap_i2c_mux_pins
> - Add OMAP34xx pin multiplexing for busses 1 - 3
Pushing today.
Tony
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
> ---
> arch/arm/plat-omap/i2c.c | 55 ++++++++++++++++++++++++++++++----------------
> 1 files changed, 36 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
> index 7990ab1..eddc24e 100644
> --- a/arch/arm/plat-omap/i2c.c
> +++ b/arch/arm/plat-omap/i2c.c
> @@ -80,26 +80,43 @@ static struct platform_device omap_i2c_devices[] = {
> #endif
> };
>
> -static void __init omap_i2c_mux_pins(int bus_id)
> +#if defined(CONFIG_ARCH_OMAP24XX)
> +static const int omap24xx_pins[][2] = {
> + { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
> + { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
> +};
> +#else
> +static const int omap24xx_pins[][2] = {};
> +#endif
> +#if defined(CONFIG_ARCH_OMAP34XX)
> +static const int omap34xx_pins[][2] = {
> + { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
> + { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
> + { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
> +};
> +#else
> +static const int omap34xx_pins[][2] = {};
> +#endif
> +
> +static void __init omap_i2c_mux_pins(int bus)
> {
> - /* TODO: Muxing for OMAP3 */
> - switch (bus_id) {
> - case 1:
> - if (cpu_class_is_omap1()) {
> - omap_cfg_reg(I2C_SCL);
> - omap_cfg_reg(I2C_SDA);
> - } else if (cpu_is_omap24xx()) {
> - omap_cfg_reg(M19_24XX_I2C1_SCL);
> - omap_cfg_reg(L15_24XX_I2C1_SDA);
> - }
> - break;
> - case 2:
> - if (cpu_is_omap24xx()) {
> - omap_cfg_reg(J15_24XX_I2C2_SCL);
> - omap_cfg_reg(H19_24XX_I2C2_SDA);
> - }
> - break;
> + int scl, sda;
> +
> + if (cpu_class_is_omap1()) {
> + scl = I2C_SCL;
> + sda = I2C_SDA;
> + } else if (cpu_is_omap24xx()) {
> + scl = omap24xx_pins[bus][0];
> + sda = omap24xx_pins[bus][1];
> + } else if (cpu_is_omap34xx()) {
> + scl = omap34xx_pins[bus][0];
> + sda = omap34xx_pins[bus][1];
> + } else {
> + return;
> }
> +
> + omap_cfg_reg(sda);
> + omap_cfg_reg(scl);
> }
>
> int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
> @@ -143,6 +160,6 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
> res[1].start = irq;
> }
>
> - omap_i2c_mux_pins(bus_id);
> + omap_i2c_mux_pins(bus_id - 1);
> return platform_device_register(pdev);
> }
> --
> 1.5.5.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-10 21:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-09 14:46 [PATCH 1/2] ARM: OMAP2: Add pin multiplexing configuration for OMAP34xx I2C pins Jarkko Nikula
2008-06-09 14:46 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin muxing into I2C bus registration helper Jarkko Nikula
2008-06-10 5:19 ` Jarkko Nikula
2008-06-10 5:42 ` [PATCH 2/2] ARM: OMAP: Add OMAP34xx pin multiplexing " Jarkko Nikula
2008-06-10 21:24 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox