Series short description
Subsystems (5)
Tony Lindgren
maintainercover Series short description
Hi all,
Here are some omap mux updates for review. These are intended for the v2.6.33 merge window.
Initially this series changes the omap34xx mux code, I'm planning on adding 3630, 2420, and 2430 code later on.
There are several reasons why we need better mux code:
- We want to make the mux code more generic and this will allow us to use the internal signal names and gpio numbers instead of mux register offsets. The internal signal names stay the same across omap generations for some devices.
- We need to map mux registers to GPIO registers for dynamic muxing of the GPIO pins during off-idle.
- We want to be able to override the bootloader mux values for the modded boards, such as the Beagle.
- We want to have the mux signals and balls available under debugfs for debugging new drivers.
Some of these might eventually work for other archs too, so let me know if you have any comments on that.
Regards,
Tony
Here are some instructions on how to use:
To see what got muxed during init, edit the kernel CMDLINE to have debug in it:
# dmesg | grep mux mux: Setting signal i2c2_scl.i2c2_scl 0x0100 -> 0x0100 mux: Setting signal i2c2_sda.i2c2_sda 0x0100 -> 0x0100 mux: Setting signal i2c3_scl.i2c3_scl 0x0100 -> 0x0100 mux: Setting signal i2c3_sda.i2c3_sda 0x0100 -> 0x0100 mux: Setting signal gpmc_ncs3.gpio54 0x410c -> 0x010c ...
Looks like the gpmc_ncs3.gpio54 muxing in the kernel has a bug where we should have OMAP_WAKEUP_EN set for board_smc91x_init for board-rx51? :)
To override bootloader mux settings, edit the kernel CMDLINE:
omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100
Note that this only changes the bootloader settings, not what might be muxed from the board-*.c files.
With CONFIG_DEBUG_FS set:
# mount -t sysfs sys /sys # mount -t debugfs debug /sys/kernel/debug
# ls /sys/kernel/debug/omap_mux/i2c i2c2_scl i2c2_sda i2c3_scl i2c3_sda i2c4_scl i2c4_sda
# cat /sys/kernel/debug/omap_mux/i2c2_scl name: i2c2_scl.i2c2_scl (0x480021be/0x18e = 0x0100), b af15, t NA mode: OMAP_PIN_INPUT | OMAP_MUX_MODE0 signals: i2c2_scl | NA | NA | NA | gpio_168 | NA | NA | safe_mode
---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (7):
omap: mux: Add new style pin multiplexing code for omap3
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add debugfs support for new mux code
omap: Split i2c platform init for mach-omap1 and mach-omap2
omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions
omap: mux: Remove old mux code for 34xx
arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/board-3430sdp.c | 13 arch/arm/mach-omap2/board-3630sdp.c | 3 arch/arm/mach-omap2/board-am3517evm.c | 11 arch/arm/mach-omap2/board-cm-t35.c | 13 arch/arm/mach-omap2/board-igep0020.c | 11 arch/arm/mach-omap2/board-ldp.c | 10 arch/arm/mach-omap2/board-omap3beagle.c | 21 arch/arm/mach-omap2/board-omap3evm.c | 21 arch/arm/mach-omap2/board-omap3pandora.c | 15 arch/arm/mach-omap2/board-overo.c | 14 arch/arm/mach-omap2/board-rx51-peripherals.c | 7 arch/arm/mach-omap2/board-rx51.c | 16 arch/arm/mach-omap2/board-zoom2.c | 11 arch/arm/mach-omap2/devices.c | 62 + arch/arm/mach-omap2/mux.c | 961 ++++++++++------ arch/arm/mach-omap2/mux.h | 150 +++ arch/arm/mach-omap2/mux34xx.c | 1558 ++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 351 ++++++ arch/arm/mach-omap2/usb-ehci.c | 122 +- arch/arm/plat-omap/i2c.c | 24 arch/arm/plat-omap/include/plat/common.h | 1 arch/arm/plat-omap/include/plat/mux.h | 222 ---- arch/arm/plat-omap/mux.c | 8 24 files changed, 2932 insertions(+), 697 deletions(-) create mode 100644 arch/arm/mach-omap2/mux.h create mode 100644 arch/arm/mach-omap2/mux34xx.c create mode 100644 arch/arm/mach-omap2/mux34xx.h
Signature · 1 line
Signature
Tony Lindgren
maintainerPATCH 1/8 omap2: mux: intoduce omap_mux_{read,write}
From: Mike Rapoport <[email protected]>
intoduce omap_mux_{read,write}
--- arch/arm/mach-omap2/mux.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 38 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/mux.c +38 -6
@@ -35,7 +35,27 @@#ifdef CONFIG_OMAP_MUX +#define OMAP_MUX_BASE_OFFSET 0x30/* Offset from CTRL_BASE */ +#define OMAP_MUX_BASE_SZ 0x5ca +static struct omap_mux_cfg arch_mux_cfg; +static void __iomem *mux_base; + +static inline u16 omap_mux_read (u16 reg) +{ +if (cpu_is_omap24xx ()) +return __raw_readb (mux_base + reg); +else +return __raw_readw (mux_base + reg); +} + +static inline void omap_mux_write (u16 val,u16 reg) +{ +if (cpu_is_omap24xx ()) +__raw_writeb (val, mux_base + reg); +else +__raw_writew (val, mux_base + reg); +}/* NOTE: See mux.h for the enumeration */
@@ -581,10 +601,7 @@ static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 ru16 orig;u8 warn =0 , debug =0 ; -if (cpu_is_omap24xx ()) - orig =omap_ctrl_readb (cfg->mux_reg); -else - orig =omap_ctrl_readw (cfg->mux_reg); + orig =omap_mux_read (cfg->mux_reg -OMAP_MUX_BASE_OFFSET );#ifdef CONFIG_OMAP_MUX_DEBUG debug = cfg->debug;
@@ -614,7 +631,7 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)if (cfg->pu_pd_val) reg |=OMAP2_PULL_UP ;omap2_cfg_debug (cfg, reg); -omap_ctrl_writeb (reg, cfg->mux_reg); +omap_mux_write (reg, cfg->mux_reg -OMAP_MUX_BASE_OFFSET );spin_unlock_irqrestore (&mux_spin_lock, flags);return 0 ;
@@ -633,7 +650,7 @@ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg)spin_lock_irqsave (&mux_spin_lock, flags); reg |= cfg->mux_val;omap2_cfg_debug (cfg, reg); -omap_ctrl_writew (reg, cfg->mux_reg); +omap_mux_write (reg, cfg->mux_reg -OMAP_MUX_BASE_OFFSET );spin_unlock_irqrestore (&mux_spin_lock, flags);return 0 ;
@@ -644,6 +661,21 @@ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg)int __init omap2_mux_init (void ) { +u32 mux_pbase; + +if (cpu_is_omap2420 ()) + mux_pbase =OMAP2420_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap2430 ()) + mux_pbase =OMAP243X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap34xx ()) + mux_pbase =OMAP343X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; + + mux_base =ioremap (mux_pbase,OMAP_MUX_BASE_SZ ); +if (!mux_base) { +printk (KERN_ERR "mux: Could not ioremap\n" ); +return -ENODEV ; + } +if (cpu_is_omap24xx ()) { arch_mux_cfg.pins = omap24xx_pins; arch_mux_cfg.size =OMAP24XX_PINS_SZ ;
PATCH 1/8 omap2: mux: intoduce omap_mux_{read,write}
Quoted 36 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Thursday, November 26, 2009 5:49 AM
To: linux-arm-kernel at lists.infradead.org
Cc: linux-omap at vger.kernel.org; Mike Rapoport
Subject: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write}From: Mike Rapoport <[email protected]>
intoduce omap_mux_{read,write}
Signed-off-by Mike Rapoport <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/mux.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 38 insertions(+), 6 deletions(-)arch/arm/mach-omap2/mux.c +7
-0@@ -35,7 +35,27 @@#ifdef CONFIG_OMAP_MUX +#define OMAP_MUX_BASE_OFFSET 0x30/* Offset from CTRL_BASE */ +#define OMAP_MUX_BASE_SZ 0x5ca +static struct omap_mux_cfg arch_mux_cfg; +static void __iomem *mux_base; + +static inline u16 omap_mux_read (u16 reg) +{
arch/arm/mach-omap2/mux.c line 56
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+if (cpu_is_omap24xx ()) +return __raw_readb (mux_base + reg); +else +return __raw_readw (mux_base + reg); +} + +static inline void omap_mux_write (u16 val,u16 reg) +{ +if (cpu_is_omap24xx ()) +__raw_writeb (val, mux_base + reg);
This will work on board but the code relies on underneath function typecast here. OMAP24xx reg write suppose to be 8 bit and __raw_writeb will take care of this with forced typecast.
Quoted 44 lines
arch/arm/mach-omap2/mux.c +3
-0+else +__raw_writew (val, mux_base + reg); +}/* NOTE: See mux.h for the enumeration */ @@ -581,10 +601,7 @@ static void __init_or_moduleomap2_cfg_debug(const struct
pin_config*cfg, u16 rarch/arm/mach-omap2/mux.c +2
-5u16 orig;u8 warn =0 , debug =0 ; -if (cpu_is_omap24xx ()) - orig =omap_ctrl_readb (cfg->mux_reg); -else - orig =omap_ctrl_readw (cfg->mux_reg); + orig =omap_mux_read (cfg->mux_reg -OMAP_MUX_BASE_OFFSET );#ifdef CONFIG_OMAP_MUX_DEBUG debug = cfg->debug;@@ -614,7 +631,7 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) if (cfg->pu_pd_val) reg |= OMAP2_PULL_UP;omap2_cfg_debug (cfg, reg); -omap_ctrl_writeb (reg, cfg->mux_reg); +omap_mux_write (reg, cfg->mux_reg -OMAP_MUX_BASE_OFFSET );spin_unlock_irqrestore (&mux_spin_lock, flags);arch/arm/mach-omap2/mux.c +1
-1return 0 ;@@ -633,7 +650,7 @@ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) spin_lock_irqsave(&mux_spin_lock, flags); reg |= cfg->mux_val;omap2_cfg_debug (cfg, reg); -omap_ctrl_writew (reg, cfg->mux_reg); +omap_mux_write (reg, cfg->mux_reg -OMAP_MUX_BASE_OFFSET );spin_unlock_irqrestore (&mux_spin_lock, flags);arch/arm/mach-omap2/mux.c +0
-0return 0 ;@@ -644,6 +661,21 @@ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) int __init omap2_mux_init(void) {
arch/arm/mach-omap2/mux.c static int __init_or_module · line 674
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+u32 mux_pbase; + +if (cpu_is_omap2420 ()) + mux_pbase =OMAP2420_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap2430 ()) + mux_pbase =OMAP243X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap34xx ()) + mux_pbase =OMAP343X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; + + mux_base =ioremap (mux_pbase,OMAP_MUX_BASE_SZ );
The control modules on OMAP's divided into 2 domains with different base address
1. pads in CORE power domain
2. Pads in wakeup domain.
If we map these two separately, then we can differentiate the wakeup capable pads. Not sure whether I am making any sense here but just thought it would be useful.
Quoted 14 lines
arch/arm/mach-omap2/mux.c +5
-0+if (!mux_base) { +printk (KERN_ERR "mux: Could not ioremap\n" ); +return -ENODEV ; + } +if (cpu_is_omap24xx ()) { arch_mux_cfg.pins = omap24xx_pins;arch_mux_cfg.size =
OMAP24XX_PINS_SZ;--
To unsubscribe from this list: send the line "unsubscribe linux- omap" in
the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerPATCH 1/8 omap2: mux: intoduce omap_mux_{read,write}
Quoted 11 lines · Shilimkar, Santosh
Quoted 11 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Thursday, November 26, 2009 5:49 AM
To: linux-arm-kernel at lists.infradead.org
Cc: linux-omap at vger.kernel.org; Mike Rapoport
Subject: [PATCH 1/8] omap2: mux: intoduce omap_mux_{read,write}From: Mike Rapoport <[email protected]>
intoduce omap_mux_{read,write}
<snip>
Quoted 17 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 673
Quoted 12 lines
int
__initomap2_mux_init(void)
{arch/arm/mach-omap2/mux.c +10
-0+u32 mux_pbase; + +if (cpu_is_omap2420 ()) + mux_pbase =OMAP2420_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap2430 ()) + mux_pbase =OMAP243X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; +else if (cpu_is_omap34xx ()) + mux_pbase =OMAP343X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; + + mux_base =ioremap (mux_pbase,OMAP_MUX_BASE_SZ );The control modules on OMAP's divided into 2 domains with different base address
1. pads in CORE power domain
2. Pads in wakeup domain.
Quoted 2 lines
If we map these two separately, then we can differentiate the wakeup capable pads. Not sure whether I am making any sense here but just thought it would be useful.
OK, maybe we can consider doing that later on.
If we separate the core and wakeup domains for muxing, we should do it in a way where it's transparent to the users. Otherwise the the muxing again gets confusing easily if we have separate sets of functions for the core and wakeup domains.
Regards,
Tony
Tony Lindgren
maintainerPATCH 2/8 omap: mux: Add new style pin multiplexing code for omap3
In reply to Tony LindgrenInitially only for 34xx. This code allows us to:
- Make the code more generic as the omap internal signal names can stay the same across omap generations for some devices
- Map mux registers to GPIO registers that is needed for dynamic muxing of pins during off-idle
- Override bootloader mux values via kernel cmdline using omap_mux=some.signa1=0x1234,some.signal2=0x1234
- View and set the mux registers via debugfs if
CONFIG_DEBUG_FS is enabled
--- arch/arm/mach-omap2/mux.c | 358 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 148 +++++++++++++++++++ arch/arm/plat-omap/mux.c | 8 + 3 files changed, 510 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-omap2/mux.h
arch/arm/mach-omap2/mux.c +356 -2
@@ -27,17 +27,25 @@#include <linux/init.h> #include <linux/io.h> #include <linux/spinlock.h> +#include <linux/list.h> #include <asm/system.h> #include <plat/control.h> #include <plat/mux.h> +#include "mux.h" +#ifdef CONFIG_OMAP_MUX #define OMAP_MUX_BASE_OFFSET 0x30/* Offset from CTRL_BASE */ #define OMAP_MUX_BASE_SZ 0x5ca +struct omap_mux_entry { +struct omap_mux mux; +struct list_head node; +}; +static struct omap_mux_cfg arch_mux_cfg;static void __iomem *mux_base;
@@ -659,6 +667,352 @@ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg)#define omap34xx_cfg_reg NULL#endif +/*----------------------------------------------------------------------------*/ + +#ifdef CONFIG_ARCH_OMAP34XX + +static LIST_HEAD (muxmodes); +static DEFINE_MUTEX (muxmode_mutex); + +static char *omap_mux_options; + +int __init omap_mux_init_gpio (int gpio,int val) +{ +struct omap_mux_entry *e; +int found =0 ; + +if (!gpio) +return -EINVAL ; + +list_for_each_entry (e, &muxmodes, node) { +struct omap_mux *m = &e->mux; +if (gpio == m->gpio) { +u16 old_mode; +u16 mux_mode; + + old_mode =omap_mux_read (m->reg_offset); + mux_mode = val & ~(OMAP_MUX_NR_MODES -1 ); + mux_mode |=OMAP_MUX_MODE4 ; +printk (KERN_DEBUG "mux: Setting signal " +"%s.gpio%i 0x%04x -> 0x%04x\n" , + m->muxnames[0 ], gpio, old_mode, mux_mode); +omap_mux_write (mux_mode, m->reg_offset); + found++; + } + } + +if (found ==1 ) +return 0 ; + +if (found >1 ) { +printk (KERN_ERR "mux: Multiple gpio paths for gpio%i\n" , gpio); +return -EINVAL ; + } + +printk (KERN_ERR "mux: Could not set gpio%i\n" , gpio); + +return -ENODEV ; +} + +int __init omap_mux_init_signal (char *muxname,int val) +{ +struct omap_mux_entry *e; +char *m0_name =NULL , *mode_name =NULL ; +int found =0 ; + + mode_name =strchr (muxname,'.' ); +if (mode_name) { + *mode_name ='\0' ; + mode_name++; + m0_name = muxname; + }else { + mode_name = muxname; + } + +list_for_each_entry (e, &muxmodes, node) { +struct omap_mux *m = &e->mux; +char *m0_entry = m->muxnames[0 ]; +int i; + +if (m0_name &&strcmp (m0_name, m0_entry)) +continue ; + +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) { +char *mode_cur = m->muxnames[i]; + +if (!mode_cur) +continue ; + +if (!strcmp (mode_name, mode_cur)) { +u16 old_mode; +u16 mux_mode; + + old_mode =omap_mux_read (m->reg_offset); + mux_mode = val | i; +printk (KERN_DEBUG "mux: Setting signal " +"%s.%s 0x%04x -> 0x%04x\n" , + m0_entry, muxname, old_mode, mux_mode); +omap_mux_write (mux_mode, m->reg_offset); + found++; + } + } + } + +if (found ==1 ) +return 0 ; + +if (found >1 ) { +printk (KERN_ERR "mux: Multiple signal paths (%i) for %s\n" , + found, muxname); +return -EINVAL ; + } + +printk (KERN_ERR "mux: Could not set signal %s\n" , muxname); + +return -ENODEV ; +} + +static void __init omap_mux_free_names (struct omap_mux *m) +{ +int i; + +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) +kfree (m->muxnames[i]); + +#ifdef CONFIG_DEBUG_FS +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) +kfree (m->balls[i]); +#endif + +} + +static int __init omap_mux_late_init (void ) +{ +struct omap_mux_entry *e, *tmp; + +list_for_each_entry_safe (e, tmp, &muxmodes, node) { +struct omap_mux *m = &e->mux; +u16 mode =omap_mux_read (m->reg_offset); + +if (OMAP_MODE_GPIO (mode)) +continue ; + +#ifndef CONFIG_DEBUG_FS +mutex_lock (&muxmode_mutex); +list_del (&e->node); +mutex_unlock (&muxmode_mutex); +omap_mux_free_names (m); +kfree (m); +#endif + + } + +return 0 ; +} +late_initcall (omap_mux_late_init); + +static void __init omap_mux_package_fixup (struct omap_mux *p, +struct omap_mux *superset) +{ +while (p->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *s = superset; +int found =0 ; + +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +if (s->reg_offset == p->reg_offset) { + *s = *p; + found++; +break ; + } + s++; + } +if (!found) +printk (KERN_ERR "mux: Unknown entry offset 0x%x\n" , + p->reg_offset); + p++; + } +} + +#ifdef CONFIG_DEBUG_FS + +static void __init omap_mux_package_init_balls (struct omap_ball *b, +struct omap_mux *superset) +{ +while (b->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *s = superset; +int found =0 ; + +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +if (s->reg_offset == b->reg_offset) { + s->balls[0 ] = b->balls[0 ]; + s->balls[1 ] = b->balls[1 ]; + found++; +break ; + } + s++; + } +if (!found) +printk (KERN_ERR "mux: Unknown ball offset 0x%x\n" , + b->reg_offset); + b++; + } +} + +#else /* CONFIG_DEBUG_FS */ + +static inline void omap_mux_package_init_balls (struct omap_ball *b, +struct omap_mux *superset) +{ +} + +#endif /* CONFIG_DEBUG_FS */ + +static int __init omap_mux_setup (char *options) +{ +if (!options) +return 0 ; + + omap_mux_options = options; + +return 1 ; +} +__setup ("omap_mux=" , omap_mux_setup); + +/* +* Note that the omap_mux=some.signal1=0x1234,some.signal2=0x1234 +* cmdline options only override the bootloader values. +* During development, please enable CONFIG_DEBUG_FS, and use the +* signal specific entries under debugfs. +*/ +static void __init omap_mux_set_cmdline_signals (void ) +{ +char *options, *next_opt, *token; + +if (!omap_mux_options) +return ; + + options =kmalloc (strlen (omap_mux_options) +1 ,GFP_KERNEL ); +if (!options) +return ; + +strcpy (options, omap_mux_options); + next_opt = options; + +while ((token =strsep (&next_opt,"," )) !=NULL ) { +char *keyval, *name; +unsigned long val; + + keyval = token; + name =strsep (&keyval,"=" ); +if (name) { + val =simple_strtoul (keyval,NULL ,0x10 ); +omap_mux_init_signal (name, (u16 )val); + } + } + +kfree (options); +} + +static void __init omap_mux_set_board_signals (struct omap_board_mux *board_mux) +{ +while (board_mux->reg_offset !=OMAP_MUX_TERMINATOR ) { +omap_mux_write (board_mux->value, board_mux->reg_offset); + board_mux++; + } +} + +static struct omap_mux *__init omap_mux_list_add (struct omap_mux *src) +{ +struct omap_mux_entry *entry; +struct omap_mux *m; + +int i; + + entry =kzalloc (sizeof (struct omap_mux_entry ),GFP_KERNEL ); +if (!entry) +return NULL ; + + m = &entry->mux; +memcpy (m, src,sizeof (struct omap_mux_entry )); + +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) { +if (src->muxnames[i]) { + m->muxnames[i] = +kmalloc (strlen (src->muxnames[i]) +1 , +GFP_KERNEL ); +if (!m->muxnames[i]) + goto free; +strcpy (m->muxnames[i], src->muxnames[i]); + } + } + +#ifdef CONFIG_DEBUG_FS +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) { +if (src->balls[i]) { + m->balls[i] = +kmalloc (strlen (src->balls[i]) +1 , +GFP_KERNEL ); +if (!m->balls[i]) + goto free; +strcpy (m->balls[i], src->balls[i]); + } + } +#endif + +mutex_lock (&muxmode_mutex); +list_add_tail (&entry->node, &muxmodes); +mutex_unlock (&muxmode_mutex); + +return m; + +free: +omap_mux_free_names (m); +kfree (entry); + +return NULL ; +} + +static void __init omap_mux_init_list (struct omap_mux *superset) +{ +while (superset->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *entry; + + entry =omap_mux_list_add (superset); +if (!entry) { +printk (KERN_ERR "mux: Could not add entry\n" ); +return ; + } + superset++; + } +} + +int __init omap_mux_init (u32 mux_pbase,u32 mux_size, +struct omap_mux *superset, +struct omap_mux *package_subset, +struct omap_board_mux *board_mux, +struct omap_ball *package_balls) +{ +if (mux_base) +return -EBUSY ; + + mux_base =ioremap (mux_pbase, mux_size); +if (!mux_base) { +printk (KERN_ERR "mux: Could not ioremap\n" ); +return -ENODEV ; + } +omap_mux_package_fixup (package_subset, superset); +omap_mux_package_init_balls (package_balls, superset); +omap_mux_set_cmdline_signals (); +omap_mux_set_board_signals (board_mux); +omap_mux_init_list (superset); + +return 0 ; +} + +#endif + +/*----------------------------------------------------------------------------*/ +int __init omap2_mux_init (void ) {u32 mux_pbase;
@@ -667,8 +1021,8 @@ int __init omap2_mux_init(void) mux_pbase =OMAP2420_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; else if (cpu_is_omap2430()) mux_pbase =OMAP243X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; - else if (cpu_is_omap34xx()) - mux_pbase =OMAP343X_CTRL_BASE +OMAP_MUX_BASE_OFFSET ; + else + return -ENODEV; mux_base =ioremap (mux_pbase,OMAP_MUX_BASE_SZ );if (!mux_base) {
arch/arm/mach-omap2/mux.h new file +148 -0
148 lines not on this page · raw message
arch/arm/plat-omap/mux.c +6 -2
@@ -54,8 +54,12 @@ int __init_or_module omap_cfg_reg(const unsigned long index) {struct pin_config *reg; -if (cpu_is_omap44xx ()) -return 0 ; +if (cpu_is_omap34xx () ||cpu_is_omap44xx ()) { +printk (KERN_ERR "mux: Broken omap_cfg_reg(%lu) entry\n" , + index); +WARN_ON (1 ); +return -EINVAL ; + }if (mux_cfg ==NULL ) {printk (KERN_ERR "Pin mux table not initialized\n" );
Tony Lindgren
maintainerPATCH 3/8 omap: mux: Add new style pin multiplexing data for 34xx
In reply to Tony LindgrenAdd new style mux data for 34xx. This should also work with 3630 easily by adding the processor subset and ball data.
Note that this data is __initdata, and gets optimized out except for the GPIO pins if CONFIG_OMAP_MUX is not set.
--- arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/mux.h | 2 arch/arm/mach-omap2/mux34xx.c | 1558 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 351 +++++++++ 4 files changed, 1915 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux34xx.c create mode 100644 arch/arm/mach-omap2/mux34xx.h
arch/arm/mach-omap2/Makefile +4 -0
@@ -23,6 +23,10 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o +ifeq ($(CONFIG_OMAP_MUX),y) +obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o +endif + # SMS/SDRC obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o # obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
arch/arm/mach-omap2/mux.h +2 -0
@@ -7,6 +7,8 @@* published by the Free Software Foundation. */ +#include "mux34xx.h" +#define OMAP_MUX_TERMINATOR 0xffff/* 34xx mux mode options for each pin. See TRM for options */
arch/arm/mach-omap2/mux34xx.c new file +1558 -0
1,558 lines not on this page · raw message
arch/arm/mach-omap2/mux34xx.h new file +351 -0
351 lines not on this page · raw message
Tony Lindgren
maintainerPATCH 4/8 omap: mux: Add new style init functions to omap3 board-*.c files
In reply to Tony LindgrenAdd new style mux init functions to omap3 board-*.c files
So far Beagle has been confirmed to be a CBB package, and CM-T35 a CUS package.
--- arch/arm/mach-omap2/board-3430sdp.c | 10 ++++++++++ arch/arm/mach-omap2/board-am3517evm.c | 11 +++++++++++ arch/arm/mach-omap2/board-cm-t35.c | 10 ++++++++++ arch/arm/mach-omap2/board-igep0020.c | 10 ++++++++++ arch/arm/mach-omap2/board-ldp.c | 10 ++++++++++ arch/arm/mach-omap2/board-omap3beagle.c | 10 ++++++++++ arch/arm/mach-omap2/board-omap3evm.c | 10 ++++++++++ arch/arm/mach-omap2/board-omap3pandora.c | 10 ++++++++++ arch/arm/mach-omap2/board-overo.c | 9 +++++++++ arch/arm/mach-omap2/board-rx51.c | 11 +++++++++++ arch/arm/mach-omap2/board-zoom2.c | 11 +++++++++++ 11 files changed, 112 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +10 -0
@@ -41,6 +41,7 @@#include <plat/control.h> #include <plat/gpmc-smc91x.h> +#include "mux.h" #include "sdram-qimonda-hyb18m512160af-6.h" #include "mmc-twl4030.h"
@@ -506,8 +507,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap_3430sdp_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap3430_i2c_init ();platform_add_devices (sdp3430_devices,ARRAY_SIZE (sdp3430_devices));if (omap_rev () >OMAP3430_REV_ES1_0 )
arch/arm/mach-omap2/board-am3517evm.c +11 -0
@@ -30,6 +30,8 @@#include <plat/common.h> #include <plat/usb.h> +#include "mux.h" +/* * Board initialization */
@@ -60,8 +62,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init am3517_evm_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );platform_add_devices (am3517_evm_devices,ARRAY_SIZE (am3517_evm_devices));
arch/arm/mach-omap2/board-cm-t35.c +10 -0
@@ -45,6 +45,7 @@#include <mach/hardware.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -482,8 +483,17 @@ static void __init cm_t35_map_io(void)omap2_map_common_io (); } +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init cm_t35_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CUS );omap_serial_init ();cm_t35_init_i2c ();cm_t35_init_nand ();
arch/arm/mach-omap2/board-igep0020.c +10 -0
@@ -30,6 +30,7 @@#include <plat/mux.h> #include <plat/usb.h> +#include "mux.h" #include "mmc-twl4030.h" #define IGEP2_SMSC911X_CS 5
@@ -203,8 +204,17 @@ static int __init igep2_i2c_init(void)return 0 ; } +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init igep2_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );igep2_i2c_init ();omap_serial_init ();usb_musb_init ();
arch/arm/mach-omap2/board-ldp.c +10 -0
@@ -43,6 +43,7 @@#include <plat/control.h> #include <plat/usb.h> +#include "mux.h" #include "mmc-twl4030.h" #define LDP_SMSC911X_CS 1
@@ -374,8 +375,17 @@ static struct platform_device *ldp_devices[] __initdata = { &ldp_gpio_keys_device, }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap_ldp_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap_i2c_init ();platform_add_devices (ldp_devices,ARRAY_SIZE (ldp_devices)); ts_gpio =54 ;
arch/arm/mach-omap2/board-omap3beagle.c +10 -0
@@ -45,6 +45,7 @@#include <plat/usb.h> #include <plat/timer-gp.h> +#include "mux.h" #include "mmc-twl4030.h" #define GPMC_CS0_BASE 0x60
@@ -422,8 +423,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap3_beagle_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap3_beagle_i2c_init ();platform_add_devices (omap3_beagle_devices,ARRAY_SIZE (omap3_beagle_devices));
arch/arm/mach-omap2/board-omap3evm.c +10 -0
@@ -43,6 +43,7 @@#include <plat/common.h> #include <plat/mcspi.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -422,9 +423,18 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap3_evm_init (void ) {omap3_evm_get_revision (); +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap3_evm_i2c_init ();
arch/arm/mach-omap2/board-omap3pandora.c +10 -0
@@ -42,6 +42,7 @@#include <plat/usb.h> #include <plat/mux.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -409,8 +410,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap3pandora_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap3pandora_i2c_init ();platform_add_devices (omap3pandora_devices,ARRAY_SIZE (omap3pandora_devices));
arch/arm/mach-omap2/board-overo.c +9 -0
@@ -47,6 +47,7 @@#include <plat/mux.h> #include <plat/usb.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -405,9 +406,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { .reset_gpio_port[2] = -EINVAL }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif static void __init overo_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );overo_i2c_init ();platform_add_devices (overo_devices,ARRAY_SIZE (overo_devices));omap_serial_init ();
arch/arm/mach-omap2/board-rx51.c +11 -0
@@ -30,6 +30,8 @@#include <plat/gpmc.h> #include <plat/usb.h> +#include "mux.h" +struct omap_sdrc_params *rx51_get_sdram_timings (void );static struct omap_lcd_config rx51_lcd_config = {
@@ -69,8 +71,17 @@ static void __init rx51_init_irq(void)extern void __init rx51_peripherals_init (void ); +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init rx51_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );omap_serial_init ();usb_musb_init ();rx51_peripherals_init ();
arch/arm/mach-omap2/board-zoom2.c +11 -0
@@ -23,6 +23,8 @@#include <mach/board-zoom.h> +#include "mux.h" +#include "sdram-micron-mt46h32m32lf-6.h" static void __init omap_zoom2_init_irq (void )
@@ -58,8 +60,17 @@ static struct twl4030_platform_data zoom2_twldata = {#endif +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[]__initdata = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#else +#define board_mux NULL +#endif +static void __init omap_zoom2_init (void ) { +omap3_mux_init (board_mux,OMAP_PACKAGE_CBB );zoom_peripherals_init ();zoom_debugboard_init (); }
Tony Lindgren
maintainerPATCH 5/8 omap: mux: Add debugfs support for new mux code
In reply to Tony LindgrenAdd debugfs support for new mux code
--- arch/arm/mach-omap2/mux.c | 224 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 224 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mux.c +224 -0
@@ -28,6 +28,10 @@#include <linux/io.h> #include <linux/spinlock.h> #include <linux/list.h> +#include <linux/ctype.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h> +#include <linux/uaccess.h> #include <asm/system.h>
@@ -47,6 +51,7 @@ struct omap_mux_entry { };static struct omap_mux_cfg arch_mux_cfg; +static unsigned long mux_phys;static void __iomem *mux_base;static inline u16 omap_mux_read (u16 reg)
@@ -772,6 +777,222 @@ int __init omap_mux_init_signal(char *muxname, int val)return -ENODEV ; } +#ifdef CONFIG_DEBUG_FS + +#define OMAP_MUX_MAX_NR_FLAGS 10 +#define OMAP_MUX_TEST_FLAG (val, mask) \ + if (((val) & (mask)) == (mask)) { \ + i++; \ + flags[i] = #mask; \ + } + +/* REVISIT: Add checking for non-optimal mux settings */ +static inline void omap_mux_decode (struct seq_file *s,u16 val) +{ +char *flags[OMAP_MUX_MAX_NR_FLAGS ]; +char mode[14 ]; +int i =-1 ; + +sprintf (mode,"OMAP_MUX_MODE%d" , val &0x7 ); + i++; + flags[i] = mode; + +OMAP_MUX_TEST_FLAG (val,OMAP_PIN_OFF_WAKEUPENABLE ); +if (val &OMAP_OFF_EN ) { +if (!(val &OMAP_OFFOUT_EN )) { +if (!(val &OMAP_OFF_PULL_UP )) { +OMAP_MUX_TEST_FLAG (val, +OMAP_PIN_OFF_INPUT_PULLDOWN ); + }else { +OMAP_MUX_TEST_FLAG (val, +OMAP_PIN_OFF_INPUT_PULLUP ); + } + }else { +if (!(val &OMAP_OFFOUT_VAL )) { +OMAP_MUX_TEST_FLAG (val, +OMAP_PIN_OFF_OUTPUT_LOW ); + }else { +OMAP_MUX_TEST_FLAG (val, +OMAP_PIN_OFF_OUTPUT_HIGH ); + } + } + } + +if (val &OMAP_INPUT_EN ) { +if (val &OMAP_PULL_ENA ) { +if (!(val &OMAP_PULL_UP )) { +OMAP_MUX_TEST_FLAG (val, +OMAP_PIN_INPUT_PULLDOWN ); + }else { +OMAP_MUX_TEST_FLAG (val,OMAP_PIN_INPUT_PULLUP ); + } + }else { +OMAP_MUX_TEST_FLAG (val,OMAP_PIN_INPUT ); + } + }else { + i++; + flags[i] ="OMAP_PIN_OUTPUT" ; + } + +do { +seq_printf (s,"%s" , flags[i]); +if (i >0 ) +seq_printf (s," | " ); + }while (i-- >0 ); +} + +#define OMAP_MUX_DEFNAME_LEN 16 + +static int omap_mux_dbg_board_show (struct seq_file *s,void *unused) +{ +struct omap_mux_entry *e; + +list_for_each_entry (e, &muxmodes, node) { +struct omap_mux *m = &e->mux; +char m0_def[OMAP_MUX_DEFNAME_LEN ]; +char *m0_name = m->muxnames[0 ]; +u16 val; +int i, mode; + +if (!m0_name) +continue ; + +for (i =0 ; i <OMAP_MUX_DEFNAME_LEN ; i++) { +if (m0_name[i] =='\0' ) { + m0_def[i] = m0_name[i]; +break ; + } + m0_def[i] =toupper (m0_name[i]); + } + val =omap_mux_read (m->reg_offset); + mode = val &OMAP_MUX_MODE7 ; + +seq_printf (s,"OMAP%i_MUX(%s, " , +cpu_is_omap34xx () ?3 :0 , m0_def); +omap_mux_decode (s, val); +seq_printf (s,"),\n" ); + } + +return 0 ; +} + +static int omap_mux_dbg_board_open (struct inode *inode,struct file *file) +{ +return single_open (file, omap_mux_dbg_board_show, &inode->i_private); +} + +static const struct file_operations omap_mux_dbg_board_fops = { + .open = omap_mux_dbg_board_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int omap_mux_dbg_signal_show (struct seq_file *s,void *unused) +{ +struct omap_mux *m = s->private; +const char *none ="NA" ; +u16 val; +int mode; + + val =omap_mux_read (m->reg_offset); + mode = val &OMAP_MUX_MODE7 ; + +seq_printf (s,"name: %s.%s (0x%08lx/0x%03x = 0x%04x), b %s, t %s\n" , + m->muxnames[0 ], m->muxnames[mode], + mux_phys + m->reg_offset, m->reg_offset, val, + m->balls[0 ] ? m->balls[0 ] : none, + m->balls[1 ] ? m->balls[1 ] : none); +seq_printf (s,"mode: " ); +omap_mux_decode (s, val); +seq_printf (s,"\n" ); +seq_printf (s,"signals: %s | %s | %s | %s | %s | %s | %s | %s\n" , + m->muxnames[0 ] ? m->muxnames[0 ] : none, + m->muxnames[1 ] ? m->muxnames[1 ] : none, + m->muxnames[2 ] ? m->muxnames[2 ] : none, + m->muxnames[3 ] ? m->muxnames[3 ] : none, + m->muxnames[4 ] ? m->muxnames[4 ] : none, + m->muxnames[5 ] ? m->muxnames[5 ] : none, + m->muxnames[6 ] ? m->muxnames[6 ] : none, + m->muxnames[7 ] ? m->muxnames[7 ] : none); + +return 0 ; +} + +#define OMAP_MUX_MAX_ARG_CHAR 7 + +static ssize_t omap_mux_dbg_signal_write (struct file *file, +const char __user *user_buf, +size_t count,loff_t *ppos) +{ +char buf[OMAP_MUX_MAX_ARG_CHAR ]; +struct seq_file *seqf; +struct omap_mux *m; +unsigned long val; +int buf_size; + +if (count >OMAP_MUX_MAX_ARG_CHAR ) +return -EINVAL ; + +memset (buf,0 ,sizeof (buf)); + buf_size =min (count,sizeof (buf) -1 ); + +if (copy_from_user (buf, user_buf, buf_size)) +return -EFAULT ; + + val =simple_strtoul (buf,NULL ,0x10 ); +if (val >0xffff ) +return -EINVAL ; + + seqf = file->private_data; + m = seqf->private; + +omap_mux_write ((u16 )val, m->reg_offset); + *ppos += count; + +return count; +} + +static int omap_mux_dbg_signal_open (struct inode *inode,struct file *file) +{ +return single_open (file, omap_mux_dbg_signal_show, inode->i_private); +} + +static const struct file_operations omap_mux_dbg_signal_fops = { + .open = omap_mux_dbg_signal_open, + .read = seq_read, + .write = omap_mux_dbg_signal_write, + .llseek = seq_lseek, + .release = single_release, +}; + +static struct dentry *mux_dbg_dir; + +static void __init omap_mux_dbg_init (void ) +{ +struct omap_mux_entry *e; + + mux_dbg_dir =debugfs_create_dir ("omap_mux" ,NULL ); +if (!mux_dbg_dir) +return ; + + (void )debugfs_create_file ("board" ,S_IRUGO , mux_dbg_dir, +NULL , &omap_mux_dbg_board_fops); + +list_for_each_entry (e, &muxmodes, node) { +struct omap_mux *m = &e->mux; + + (void )debugfs_create_file (m->muxnames[0 ],S_IWUGO , mux_dbg_dir, + m, &omap_mux_dbg_signal_fops); + } +} + +#else +static inline void omap_mux_dbg_init (void ) +{ +} +#endif /* CONFIG_DEBUG_FS */ +static void __init omap_mux_free_names (struct omap_mux *m) {int i;
@@ -807,6 +1028,8 @@ static int __init omap_mux_late_init(void) } +omap_mux_dbg_init (); +return 0 ; }late_initcall (omap_mux_late_init);
@@ -995,6 +1218,7 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size,if (mux_base)return -EBUSY ; + mux_phys = mux_pbase; mux_base =ioremap (mux_pbase, mux_size);if (!mux_base) {printk (KERN_ERR "mux: Could not ioremap\n" );
Tony Lindgren
maintainerPATCH 6/8 omap: Split i2c platform init for mach-omap1 and mach-omap2
In reply to Tony LindgrenOtherwise 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.
--- 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(-)
arch/arm/mach-omap2/devices.c +20 -0
@@ -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,
arch/arm/plat-omap/i2c.c +9 -15
@@ -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); }
arch/arm/plat-omap/include/plat/common.h +1 -0
@@ -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,
Tony Lindgren
maintainerPATCH 6/8 omap: Split i2c platform init for mach-omap1 and mach-omap2
Quoted 6 lines · Tony Lindgren
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, justOMAP_PIN_INPUTis enough.
Here's a better version of this patch that actually does the splitting. The earlier version was a bit of a hack.
Regards,
Tony
Quoted 1 line
From
8cadff260f4212873501bbc4e4d2e62c40668ec9Mon Sep 17 00:00:00 2001
From: Tony Lindgren <[email protected]>
Date: Wed, 25 Nov 2009 10:46:07 -0800
Subject: [PATCH] omap: Split i2c platform init for mach-omap1 and mach-omap2
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.
arch/arm/mach-omap1/Makefile +3 -0
@@ -17,6 +17,9 @@ obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o mailbox_mach-objs := mailbox.o +i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o +obj-y += $(i2c-omap-m) $(i2c-omap-y) + led-y := leds.o # Specific board support
arch/arm/mach-omap1/i2c.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Helper module for board specific I2C bus registration +* +* Copyright (C) 2009 Nokia Corporation. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#include <plat/i2c.h> +#include <plat/mux.h> + +int __init omap_register_i2c_bus (int bus_id,u32 clkrate, +struct i2c_board_info const *info, +unsigned len) +{ +omap_cfg_reg (I2C_SDA ); +omap_cfg_reg (I2C_SCL ); + +return omap_plat_register_i2c_bus (bus_id, clkrate, info, len); +}
arch/arm/mach-omap2/Makefile +3 -0
@@ -56,6 +56,9 @@ iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o obj-$(CONFIG_OMAP_IOMMU) += $(iommu-y) +i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o +obj-y += $(i2c-omap-m) $(i2c-omap-y) + # Specific board support obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
arch/arm/mach-omap2/i2c.c new file +56 -0
56 lines not on this page · raw message
arch/arm/plat-omap/i2c.c +2 -42
70 lines not on this page · raw message
arch/arm/plat-omap/include/plat/common.h +1 -13
@@ -27,7 +27,7 @@#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H#define __ARCH_ARM_MACH_OMAP_COMMON_H -#include <linux/i2c.h> +#include <plat/i2c.h> struct sys_timer ;
@@ -36,18 +36,6 @@ extern void __iomem *gic_cpu_base_addr;extern void omap_map_common_io (void );extern struct sys_timer omap_timer; -#if defined(CONFIG_I2C_OMAP ) || defined(CONFIG_I2C_OMAP_MODULE ) -extern int omap_register_i2c_bus (int bus_id,u32 clkrate, -struct i2c_board_info const *info, -unsigned len); -#else -static inline int omap_register_i2c_bus (int bus_id,u32 clkrate, -struct i2c_board_info const *info, -unsigned len) -{ -return 0 ; -} -#endif /* IO bases for various OMAP processors */ struct omap_globals {
arch/arm/plat-omap/include/plat/i2c.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Helper module for board specific I2C bus registration +* +* Copyright (C) 2009 Nokia Corporation. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#include <linux/i2c.h> + +#if defined(CONFIG_I2C_OMAP ) || defined(CONFIG_I2C_OMAP_MODULE ) +extern int omap_register_i2c_bus (int bus_id,u32 clkrate, +struct i2c_board_info const *info, +unsigned len); +#else +static inline int omap_register_i2c_bus (int bus_id,u32 clkrate, +struct i2c_board_info const *info, +unsigned len) +{ +return 0 ; +} +#endif + +int omap_plat_register_i2c_bus (int bus_id,u32 clkrate, +struct i2c_board_info const *info, +unsigned len);
Tony Lindgren
maintainerPATCH 7/8 omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions
In reply to Tony LindgrenReplace omap_cfg_reg() with new style signal or gpio functions
--- arch/arm/mach-omap2/board-3430sdp.c | 2 arch/arm/mach-omap2/board-3630sdp.c | 3 - arch/arm/mach-omap2/board-cm-t35.c | 2 arch/arm/mach-omap2/board-omap3beagle.c | 10 +- arch/arm/mach-omap2/board-omap3evm.c | 10 +- arch/arm/mach-omap2/board-omap3pandora.c | 4 - arch/arm/mach-omap2/board-overo.c | 4 - arch/arm/mach-omap2/board-rx51-peripherals.c | 7 + arch/arm/mach-omap2/board-rx51.c | 4 - arch/arm/mach-omap2/devices.c | 42 +++++---- arch/arm/mach-omap2/usb-ehci.c | 122 +++++++++++++------------- 11 files changed, 108 insertions(+), 102 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +1 -1
@@ -492,7 +492,7 @@ static inline void board_smc91x_init(void)static void enable_board_wakeup_source (void ) { -omap_cfg_reg (AF26_34XX_SYS_NIRQ );/* T2 interrupt line (keypad) */ +omap_mux_init_signal ("sys_nirq" ,OMAP_WAKEUP_EN |OMAP_PIN_INPUT_PULLUP );/* T2 interrupt line (keypad) */ }static struct ehci_hcd_omap_platform_data ehci_pdata__initconst = {
arch/arm/mach-omap2/board-3630sdp.c +2 -1
@@ -23,6 +23,7 @@#include <mach/board-zoom.h> +#include "mux.h" #include "sdram-hynix-h8mbx00u0mer-0em.h" #if defined(CONFIG_SMC91X ) || defined(CONFIG_SMC91X_MODULE )
@@ -48,7 +49,7 @@ static inline void board_smc91x_init(void)static void enable_board_wakeup_source (void ) { -omap_cfg_reg (AF26_34XX_SYS_NIRQ );/* T2 interrupt line (keypad) */ +omap_mux_init_signal ("sys_nirq" ,OMAP_WAKEUP_EN |OMAP_PIN_INPUT_PULLUP );/* T2 interrupt line (keypad) */ }static struct ehci_hcd_omap_platform_data ehci_pdata__initconst = {
arch/arm/mach-omap2/board-cm-t35.c +1 -1
@@ -503,7 +503,7 @@ static void __init cm_t35_init(void)usb_musb_init (); -omap_cfg_reg (AF26_34XX_SYS_NIRQ ); +omap_mux_init_signal ("sys_nirq" ,OMAP_WAKEUP_EN |OMAP_PIN_INPUT_PULLUP ); }MACHINE_START (CM_T35 ,"Compulab CM-T35" )
arch/arm/mach-omap2/board-omap3beagle.c +5 -5
@@ -141,10 +141,10 @@ static int beagle_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) {if (system_rev >=0x20 && system_rev <=0x34301000 ) { -omap_cfg_reg (AG9_34XX_GPIO23 ); +omap_mux_init_gpio (23 ,OMAP_PIN_INPUT ); mmc[0 ].gpio_wp =23 ; }else { -omap_cfg_reg (AH8_34XX_GPIO29 ); +omap_mux_init_gpio (29 ,OMAP_PIN_INPUT ); }/* gpio + 0 is "mmc0_cd" (input/IRQ) */ mmc[0 ].gpio_cd = gpio +0 ;
@@ -439,7 +439,7 @@ static void __init omap3_beagle_init(void) ARRAY_SIZE(omap3_beagle_devices));omap_serial_init (); -omap_cfg_reg (J25_34XX_GPIO170 ); +omap_mux_init_gpio (170 ,OMAP_PIN_INPUT );gpio_request (170 ,"DVI_nPD" );/* REVISIT leave DVI powered down until it's needed ... */ gpio_direction_output (170 , true);
@@ -449,8 +449,8 @@ static void __init omap3_beagle_init(void)omap3beagle_flash_init ();/* Ensure SDRC pins are mux'd for self-refresh */ -omap_cfg_reg (H16_34XX_SDRC_CKE0 ); -omap_cfg_reg (H17_34XX_SDRC_CKE1 ); +omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT ); +omap_mux_init_signal ("sdrc_cke1" ,OMAP_PIN_OUTPUT ); }static void __init omap3_beagle_map_io (void )
arch/arm/mach-omap2/board-omap3evm.c +5 -5
@@ -224,7 +224,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) {/* gpio + 0 is "mmc0_cd" (input/IRQ) */ -omap_cfg_reg (L8_34XX_GPIO63 ); +omap_mux_init_gpio (63 ,OMAP_PIN_INPUT ); mmc[0 ].gpio_cd = gpio +0 ;twl4030_mmc_init (mmc);
@@ -450,24 +450,24 @@ static void __init omap3_evm_init(void)#endif if (get_omap3_evm_rev () >=OMAP3EVM_BOARD_GEN_2 ) {/* enable EHCI VBUS using GPIO22 */ -omap_cfg_reg (AF9_34XX_GPIO22 ); +omap_mux_init_gpio (22 ,OMAP_PIN_INPUT_PULLUP );gpio_request (OMAP3_EVM_EHCI_VBUS ,"enable EHCI VBUS" );gpio_direction_output (OMAP3_EVM_EHCI_VBUS ,0 );gpio_set_value (OMAP3_EVM_EHCI_VBUS ,1 );/* Select EHCI port on main board */ -omap_cfg_reg (U3_34XX_GPIO61 ); +omap_mux_init_gpio (61 ,OMAP_PIN_INPUT_PULLUP );gpio_request (OMAP3_EVM_EHCI_SELECT ,"select EHCI port" );gpio_direction_output (OMAP3_EVM_EHCI_SELECT ,0 );gpio_set_value (OMAP3_EVM_EHCI_SELECT ,0 );/* setup EHCI phy reset config */ -omap_cfg_reg (AH14_34XX_GPIO21 ); +omap_mux_init_gpio (21 ,OMAP_PIN_INPUT_PULLUP ); ehci_pdata.reset_gpio_port[1 ] =21 ; }else {/* setup EHCI phy reset on MDC */ -omap_cfg_reg (AF4_34XX_GPIO135_OUT ); +omap_mux_init_gpio (135 ,OMAP_PIN_OUTPUT ); ehci_pdata.reset_gpio_port[1 ] =135 ; }usb_musb_init ();
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
@@ -433,8 +433,8 @@ static void __init omap3pandora_init(void)usb_musb_init ();/* Ensure SDRC pins are mux'd for self-refresh */ -omap_cfg_reg (H16_34XX_SDRC_CKE0 ); -omap_cfg_reg (H17_34XX_SDRC_CKE1 ); +omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT ); +omap_mux_init_signal ("sdrc_cke1" ,OMAP_PIN_OUTPUT ); }static void __init omap3pandora_map_io (void )
arch/arm/mach-omap2/board-overo.c +2 -2
@@ -427,8 +427,8 @@ static void __init overo_init(void)overo_init_smsc911x ();/* Ensure SDRC pins are mux'd for self-refresh */ -omap_cfg_reg (H16_34XX_SDRC_CKE0 ); -omap_cfg_reg (H17_34XX_SDRC_CKE1 ); +omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT ); +omap_mux_init_signal ("sdrc_cke1" ,OMAP_PIN_OUTPUT ); if ((gpio_request(OVERO_GPIO_W2W_NRESET, "OVERO_GPIO_W2W_NRESET") == 0) &&
arch/arm/mach-omap2/board-rx51-peripherals.c +4 -3
@@ -33,6 +33,7 @@#include <plat/onenand.h> #include <plat/gpmc-smc91x.h> +#include "mux.h" #include "mmc-twl4030.h" #define SYSTEM_REV_B_USES_VAUX3 0x1699
@@ -630,9 +631,9 @@ static struct omap_smc91x_platform_data board_smc91x_data = {static void __init board_smc91x_init (void ) { -omap_cfg_reg (U8_34XX_GPIO54_DOWN ); -omap_cfg_reg (G25_34XX_GPIO86_OUT ); -omap_cfg_reg (H19_34XX_GPIO164_OUT ); +omap_mux_init_gpio (54 ,OMAP_PIN_INPUT_PULLDOWN ); +omap_mux_init_gpio (86 ,OMAP_PIN_OUTPUT ); +omap_mux_init_gpio (164 ,OMAP_PIN_OUTPUT );gpmc_smc91x_init (&board_smc91x_data); }
arch/arm/mach-omap2/board-rx51.c +2 -2
@@ -87,8 +87,8 @@ static void __init rx51_init(void)rx51_peripherals_init ();/* Ensure SDRC pins are mux'd for self-refresh */ -omap_cfg_reg (H16_34XX_SDRC_CKE0 ); -omap_cfg_reg (H17_34XX_SDRC_CKE1 ); +omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT ); +omap_mux_init_signal ("sdrc_cke1" ,OMAP_PIN_OUTPUT ); }static void __init rx51_map_io (void )
arch/arm/mach-omap2/devices.c +22 -20
70 lines not on this page · raw message
arch/arm/mach-omap2/usb-ehci.c +62 -60
150 lines not on this page · raw message
Tony Lindgren
maintainerPATCH 8/8 omap: mux: Remove old mux code for 34xx
In reply to Tony LindgrenRemove old mux code for 34xx
--- arch/arm/mach-omap2/board-3430sdp.c | 1 arch/arm/mach-omap2/board-cm-t35.c | 1 arch/arm/mach-omap2/board-igep0020.c | 1 arch/arm/mach-omap2/board-omap3beagle.c | 1 arch/arm/mach-omap2/board-omap3evm.c | 1 arch/arm/mach-omap2/board-omap3pandora.c | 1 arch/arm/mach-omap2/board-overo.c | 1 arch/arm/mach-omap2/board-rx51.c | 1 arch/arm/mach-omap2/mux.c | 363 +----------------------------- arch/arm/plat-omap/include/plat/mux.h | 222 ------------------ 10 files changed, 9 insertions(+), 584 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +0 -1
@@ -31,7 +31,6 @@#include <asm/mach/map.h> #include <plat/mcspi.h> -#include <plat/mux.h> #include <plat/board.h> #include <plat/usb.h> #include <plat/common.h>
arch/arm/mach-omap2/board-cm-t35.c +0 -1
@@ -38,7 +38,6 @@#include <plat/board.h> #include <plat/common.h> -#include <plat/mux.h> #include <plat/nand.h> #include <plat/gpmc.h> #include <plat/usb.h>
arch/arm/mach-omap2/board-igep0020.c +0 -1
@@ -27,7 +27,6 @@#include <plat/board.h> #include <plat/common.h> #include <plat/gpmc.h> -#include <plat/mux.h> #include <plat/usb.h> #include "mux.h"
arch/arm/mach-omap2/board-omap3beagle.c +0 -1
@@ -41,7 +41,6 @@#include <plat/common.h> #include <plat/gpmc.h> #include <plat/nand.h> -#include <plat/mux.h> #include <plat/usb.h> #include <plat/timer-gp.h>
arch/arm/mach-omap2/board-omap3evm.c +0 -1
@@ -38,7 +38,6 @@#include <asm/mach/map.h> #include <plat/board.h> -#include <plat/mux.h> #include <plat/usb.h> #include <plat/common.h> #include <plat/mcspi.h>
arch/arm/mach-omap2/board-omap3pandora.c +0 -1
@@ -40,7 +40,6 @@#include <mach/hardware.h> #include <plat/mcspi.h> #include <plat/usb.h> -#include <plat/mux.h> #include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h"
arch/arm/mach-omap2/board-overo.c +0 -1
@@ -44,7 +44,6 @@#include <plat/gpmc.h> #include <mach/hardware.h> #include <plat/nand.h> -#include <plat/mux.h> #include <plat/usb.h> #include "mux.h"
arch/arm/mach-omap2/board-rx51.c +0 -1
@@ -23,7 +23,6 @@#include <asm/mach/map.h> #include <plat/mcspi.h> -#include <plat/mux.h> #include <plat/board.h> #include <plat/common.h> #include <plat/dma.h>
arch/arm/mach-omap2/mux.c +9 -354
402 lines not on this page · raw message
arch/arm/plat-omap/include/plat/mux.h +0 -222
239 lines not on this page · raw message
Tony Lindgren
maintainercover Omap mux changes for v2.6.33 merge window (Series short description)
In reply to Tony LindgrenQuoted 4 lines · Tony Lindgren
Hi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.
Forgot to edit the subject :)
Also, these patches are available in the mux branch of the linux-omap tree for easy testing.
Regards,
Tony
cover Omap mux changes for v2.6.33 merge window (Series short description)
Tony,
Quoted 10 lines · Tony Lindgren
Quoted 4 lines · Tony Lindgren
Hi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.Forgot to edit the subject :)
Also, these patches are available in the mux branch of the linux-omap tree for easy testing.
After all the discussions we had, what would be preferable way to define the board mux configuration? The omap_board_mux array or a calls for omap_mux_init_signal?
Quoted 8 lines
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainercover Omap mux changes for v2.6.33 merge window (Series short description)
Quoted 9 lines · Mike Rapoport
Tony,
Quoted 6 lines · Tony Lindgren
Quoted 4 lines · Tony Lindgren
Hi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.
Quoted 8 lines
Quoted 4 lines
Forgot to edit the subject :)
Also, these patches are available in the mux branch of the linux-omap tree for easy testing.
After all the discussions we had, what would be preferable way to define the board mux configuration? The
omap_board_muxarray or a calls foromap_mux_init_signal?
You should be able to just boot with CONFIG_DEBUG_FS, check how the pins are set, and adjust as needed via sysfs. Then when happy with the settings, just do:
# cat /sys/kernel/debug/omap_mux/board OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE7), OMAP3_MUX(CAM_D11, OMAP_PIN_INPUT | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D1, OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D2, OMAP_PIN_INPUT | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE7), OMAP3_MUX(CAM_D5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE4), OMAP3_MUX(CAM_D6, OMAP_PIN_INPUT | OMAP_MUX_MODE0), OMAP3_MUX(CAM_D7, OMAP_PIN_INPUT | OMAP_MUX_MODE0), OMAP3_MUX(CAM_D8, OMAP_PIN_INPUT | OMAP_MUX_MODE0), OMAP3_MUX(CAM_D9, OMAP_PIN_INPUT | OMAP_MUX_MODE0), ...
And then use the output for the struct omap_board_mux board_mux[] in your board-*.c files.
For the common device init functions and omap_hwmod, we probably want to use the signal names. That allows more generic initialization of the internal devices, but some pins for sure still need to be muxed in a board specific way.
Regards,
Tony
Tony Lindgren
maintainercover Omap mux changes for v2.6.33 merge window (Series short description)
In reply to Tony LindgrenQuoted 10 lines · Tony Lindgren
Quoted 4 lines · Tony Lindgren
Hi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.Forgot to edit the subject :)
Also, these patches are available in the mux branch of the linux-omap tree for easy testing.
Also forgot to thank Benoit Cousson and Paul Walmsley for generating big parts of the omap mux register data.
Without this help the code would not be be complete.
Cheers,
Tony
cover Series short description
In reply to Tony Lindgren----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, November 26, 2009 5:48 AM
Subject: [PATCH 0/8] Series short description
Quoted 18 lines
Hi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.Initially this series changes the omap34xx mux
code, I'm planning on adding 3630, 2420, and 2430
code later on.There are several reasons why we need better mux
code:- We want to make the mux code more generic and this will allow us to use the internal signal names and gpio numbers instead of mux register offsets. The internal signal names stay the same across omap generations for some devices.
Quoted 8 lines
- We need to map mux registers to GPIO registers for dynamic muxing of the GPIO pins during off-idle.
- We want to be able to override the bootloader mux values for the modded boards, such as the Beagle.
- We want to have the mux signals and balls available under debugfs for debugging new drivers.
Does it also detect conflicts when two drivers try to step on each other and overwrite the mux settings of other. SPI and EHCI was one of the problems I faced.
Quoted 98 lines
Some of these might eventually work for other archs too, so let me know if you have any comments on that.
Regards,
Tony
Here are some instructions on how to use:
To see what got muxed during init, edit the kernel CMDLINE to have debug in it:
# dmesg | grep mux mux: Setting signal i2c2_scl.i2c2_scl 0x0100 -> 0x0100 mux: Setting signal i2c2_sda.i2c2_sda 0x0100 -> 0x0100 mux: Setting signal i2c3_scl.i2c3_scl 0x0100 -> 0x0100 mux: Setting signal i2c3_sda.i2c3_sda 0x0100 -> 0x0100 mux: Setting signal gpmc_ncs3.gpio54 0x410c -> 0x010c ...Looks like the gpmc_ncs3.gpio54 muxing in the kernel has a bug where we should have
OMAP_WAKEUP_ENset forboard_smc91x_initfor board-rx51? :)To override bootloader mux settings, edit the kernel CMDLINE:
omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100
Note that this only changes the bootloader settings, not what might be muxed from the board-*.c files.
With
CONFIG_DEBUG_FSset:# mount -t sysfs sys /sys # mount -t debugfs debug /sys/kernel/debug# ls /sys/kernel/debug/omap_mux/i2c i2c2_scl i2c2_sda i2c3_scl i2c3_sda i2c4_scl i2c4_sda# cat /sys/kernel/debug/omap_mux/i2c2_scl name: i2c2_scl.i2c2_scl (0x480021be/0x18e = 0x0100), b af15, t NA mode: OMAP_PIN_INPUT | OMAP_MUX_MODE0 signals: i2c2_scl | NA | NA | NA | gpio_168 | NA | NA | safe_mode---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (7):
omap: mux: Add new style pin multiplexing code for omap3
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add debugfs support for new mux code
omap: Split i2c platform init for mach-omap1 and mach-omap2
omap: mux: Replaceomap_cfg_reg()with new style signal or gpio
functions
omap: mux: Remove old mux code for 34xxarch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/board-3430sdp.c | 13 arch/arm/mach-omap2/board-3630sdp.c | 3 arch/arm/mach-omap2/board-am3517evm.c | 11 arch/arm/mach-omap2/board-cm-t35.c | 13 arch/arm/mach-omap2/board-igep0020.c | 11 arch/arm/mach-omap2/board-ldp.c | 10 arch/arm/mach-omap2/board-omap3beagle.c | 21 arch/arm/mach-omap2/board-omap3evm.c | 21 arch/arm/mach-omap2/board-omap3pandora.c | 15 arch/arm/mach-omap2/board-overo.c | 14 arch/arm/mach-omap2/board-rx51-peripherals.c | 7 arch/arm/mach-omap2/board-rx51.c | 16 arch/arm/mach-omap2/board-zoom2.c | 11 arch/arm/mach-omap2/devices.c | 62 + arch/arm/mach-omap2/mux.c | 961 ++++++++++------ arch/arm/mach-omap2/mux.h | 150 +++ arch/arm/mach-omap2/mux34xx.c | 1558 ++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 351 ++++++ arch/arm/mach-omap2/usb-ehci.c | 122 +- arch/arm/plat-omap/i2c.c | 24 arch/arm/plat-omap/include/plat/common.h | 1 arch/arm/plat-omap/include/plat/mux.h | 222 ---- arch/arm/plat-omap/mux.c | 8 24 files changed, 2932 insertions(+), 697 deletions(-)create mode 100644
arch/arm/mach-omap2/mux.h
create mode 100644arch/arm/mach-omap2/mux34xx.c
create mode 100644arch/arm/mach-omap2/mux34xx.hSignature · 5 lines
Signature -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainercover Series short description
Quoted 32 lines · Hemanth V
----- Original Message ----- From: "Tony Lindgren" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Thursday, November 26, 2009 5:48 AM
Subject: [PATCH 0/8] Series short descriptionQuoted 24 lines
Hi all,
Here are some omap mux updates for review. These are intended for the v2.6.33 merge window.
Initially this series changes the omap34xx mux code, I'm planning on adding 3630, 2420, and 2430 code later on.
There are several reasons why we need better mux code:
- We want to make the mux code more generic and this will allow us to use the internal signal names and gpio numbers instead of mux register offsets. The internal signal names stay the same across omap generations for some devices.
- We need to map mux registers to GPIO registers for dynamic muxing of the GPIO pins during off-idle.
- We want to be able to override the bootloader mux values for the modded boards, such as the Beagle.
Quoted 6 lines
Quoted 2 lines
- We want to have the mux signals and balls available under debugfs for debugging new drivers.
Does it also detect conflicts when two drivers try to step on each other and overwrite the mux settings of other. SPI and EHCI was one of the problems I faced.
It does not, but that could be added by adding a usecount to struct omap_mux.
In fact it's already a problem with the cmdline mux options as that does not prevent other init code from muxing over the cmdline options.
But then again, just being able to override the bootloader settings might do the trick for most people customizing their Beagle boards.
Currently we're not checking the return values for muxing, so adding a usecount sounds like a follow-up patch after these changes.
Regards,
Tony
cover Series short description
In reply to Tony LindgrenTony,
Quoted 29 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Tony Lindgren
Sent: Thursday, November 26, 2009 5:49 AM
To: linux-arm-kernel at lists.infradead.org
Cc: linux-omap at vger.kernel.org
Subject: [PATCH 0/8] Series short descriptionHi all,
Here are some omap mux updates for review. These
are intended for the v2.6.33 merge window.Initially this series changes the omap34xx mux
code, I'm planning on adding 3630, 2420, and 2430
code later on.There are several reasons why we need better mux
code:- We want to make the mux code more generic and this will allow us to use the internal signal names and gpio numbers instead of mux register offsets. The internal signal names stay the same across omap generations for some devices.
- We need to map mux registers to GPIO registers for dynamic muxing of the GPIO pins during off-idle.
Quoted 8 lines
- We want to be able to override the bootloader mux values for the modded boards, such as the Beagle.
- We want to have the mux signals and balls available under debugfs for debugging new drivers.
Some of these might eventually work for other archs too, so let me know if you have any comments on that.
Thanks for the series. Managing mux is always an issue and most time consuming one. This series will improve mux code greatly.
Regards,
Santosh