From: Tony Lindgren <tony@atomide.com> To: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Subject: [PATCH 6/8] omap: Split i2c platform init for mach-omap1 and mach-omap2 Date: Wed, 25 Nov 2009 16:19:52 -0800 [thread overview] Message-ID: <20091126001952.1546.21444.stgit@localhost> (raw) In-Reply-To: <20091126001646.1546.34352.stgit@localhost> Otherwise we cannot limit new mux code to mach-omap2. The same signal names should eventually work for other omaps under mach-omap2. Note that these pins don't need to be OMAP_PIN_INPUT_PULLUP, just OMAP_PIN_INPUT is enough. Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/mach-omap2/devices.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/i2c.c | 24 +++++++++--------------- arch/arm/plat-omap/include/plat/common.h | 1 + 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 733d3dc..000f304 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -743,6 +743,26 @@ static inline void omap_hdq_init(void) {} /*-------------------------------------------------------------------------*/ +#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) + +/* Called from omap_i2c_mux_pins. The first i2c bus is non-muxable */ +void omap_i2c_mach_mux(int bus_id) +{ + char mux_name[sizeof("i2c2_scl.i2c2_scl")]; + + if (cpu_is_omap34xx() && bus_id == 1) + return; + + sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id); + omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); + sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id); + omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); +} + +#endif + +/*-------------------------------------------------------------------------*/ + static int __init omap2_init_devices(void) { /* please keep these calls, and their implementations above, diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index c08362d..ba2306a 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -27,6 +27,7 @@ #include <linux/platform_device.h> #include <linux/i2c.h> #include <mach/irqs.h> +#include <plat/common.h> #include <plat/mux.h> #define OMAP_I2C_SIZE 0x3f @@ -88,15 +89,6 @@ static const int omap24xx_pins[][2] = { #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 #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) @@ -104,15 +96,17 @@ static void __init omap_i2c_mux_pins(int bus) { int scl, sda; + if (cpu_is_omap34xx()) { + omap_i2c_mach_mux(bus); + return; + } + 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]; + scl = omap24xx_pins[bus - 1][0]; + sda = omap24xx_pins[bus - 1][1]; } else { return; } @@ -156,7 +150,7 @@ static int __init omap_i2c_add_bus(int bus_id) res[1].start = irq; } - omap_i2c_mux_pins(bus_id - 1); + omap_i2c_mux_pins(bus_id); return platform_device_register(pdev); } diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 064f173..e46aefe 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h @@ -40,6 +40,7 @@ extern struct sys_timer omap_timer; extern int omap_register_i2c_bus(int bus_id, u32 clkrate, struct i2c_board_info const *info, unsigned len); +extern void omap_i2c_mach_mux(int bus_id); #else static inline int omap_register_i2c_bus(int bus_id, u32 clkrate, struct i2c_board_info const *info,
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/8] omap: Split i2c platform init for mach-omap1 and mach-omap2 Date: Wed, 25 Nov 2009 16:19:52 -0800 [thread overview] Message-ID: <20091126001952.1546.21444.stgit@localhost> (raw) In-Reply-To: <20091126001646.1546.34352.stgit@localhost> Otherwise we cannot limit new mux code to mach-omap2. The same signal names should eventually work for other omaps under mach-omap2. Note that these pins don't need to be OMAP_PIN_INPUT_PULLUP, just OMAP_PIN_INPUT is enough. Signed-off-by: Tony Lindgren <tony@atomide.com> --- arch/arm/mach-omap2/devices.c | 20 ++++++++++++++++++++ arch/arm/plat-omap/i2c.c | 24 +++++++++--------------- arch/arm/plat-omap/include/plat/common.h | 1 + 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 733d3dc..000f304 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -743,6 +743,26 @@ static inline void omap_hdq_init(void) {} /*-------------------------------------------------------------------------*/ +#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) + +/* Called from omap_i2c_mux_pins. The first i2c bus is non-muxable */ +void omap_i2c_mach_mux(int bus_id) +{ + char mux_name[sizeof("i2c2_scl.i2c2_scl")]; + + if (cpu_is_omap34xx() && bus_id == 1) + return; + + sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id); + omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); + sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id); + omap_mux_init_signal(mux_name, OMAP_PIN_INPUT); +} + +#endif + +/*-------------------------------------------------------------------------*/ + static int __init omap2_init_devices(void) { /* please keep these calls, and their implementations above, diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index c08362d..ba2306a 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -27,6 +27,7 @@ #include <linux/platform_device.h> #include <linux/i2c.h> #include <mach/irqs.h> +#include <plat/common.h> #include <plat/mux.h> #define OMAP_I2C_SIZE 0x3f @@ -88,15 +89,6 @@ static const int omap24xx_pins[][2] = { #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 #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) @@ -104,15 +96,17 @@ static void __init omap_i2c_mux_pins(int bus) { int scl, sda; + if (cpu_is_omap34xx()) { + omap_i2c_mach_mux(bus); + return; + } + 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]; + scl = omap24xx_pins[bus - 1][0]; + sda = omap24xx_pins[bus - 1][1]; } else { return; } @@ -156,7 +150,7 @@ static int __init omap_i2c_add_bus(int bus_id) res[1].start = irq; } - omap_i2c_mux_pins(bus_id - 1); + omap_i2c_mux_pins(bus_id); return platform_device_register(pdev); } diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 064f173..e46aefe 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h @@ -40,6 +40,7 @@ extern struct sys_timer omap_timer; extern int omap_register_i2c_bus(int bus_id, u32 clkrate, struct i2c_board_info const *info, unsigned len); +extern void omap_i2c_mach_mux(int bus_id); #else static inline int omap_register_i2c_bus(int bus_id, u32 clkrate, struct i2c_board_info const *info,
next prev parent reply other threads:[~2009-11-26 0:19 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-11-26 0:18 [PATCH 0/8] Series short description Tony Lindgren 2009-11-26 0:18 ` Tony Lindgren 2009-11-26 0:18 ` [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write} Tony Lindgren 2009-11-26 0:18 ` Tony Lindgren 2009-11-29 10:03 ` Shilimkar, Santosh 2009-11-29 10:03 ` Shilimkar, Santosh 2009-11-30 18:54 ` Tony Lindgren 2009-11-30 18:54 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 2/8] omap: mux: Add new style pin multiplexing code for omap3 Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 3/8] omap: mux: Add new style pin multiplexing data for 34xx Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 4/8] omap: mux: Add new style init functions to omap3 board-*.c files Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` [PATCH 5/8] omap: mux: Add debugfs support for new mux code Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren 2009-11-26 0:19 ` Tony Lindgren [this message] 2009-11-26 0:19 ` [PATCH 6/8] omap: Split i2c platform init for mach-omap1 and mach-omap2 Tony Lindgren 2009-11-27 17:44 ` Tony Lindgren 2009-11-27 17:44 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 7/8] omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 8/8] omap: mux: Remove old mux code for 34xx Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 0:20 ` [PATCH 0/8] Omap mux changes for v2.6.33 merge window (Series short description) Tony Lindgren 2009-11-26 0:20 ` Tony Lindgren 2009-11-26 11:20 ` Mike Rapoport 2009-11-26 11:20 ` Mike Rapoport 2009-11-26 18:15 ` Tony Lindgren 2009-11-26 18:15 ` Tony Lindgren 2009-11-27 16:16 ` Tony Lindgren 2009-11-27 16:16 ` Tony Lindgren 2009-11-26 6:44 ` [PATCH 0/8] Series short description Hemanth V 2009-11-26 6:44 ` Hemanth V 2009-11-26 8:27 ` Tony Lindgren 2009-11-26 8:27 ` Tony Lindgren 2009-11-29 10:03 ` Shilimkar, Santosh 2009-11-29 10:03 ` Shilimkar, Santosh
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20091126001952.1546.21444.stgit@localhost \ --to=tony@atomide.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.