New mux code for 34xx
Subsystems (4)
Tony Lindgren
maintainercover New mux code for 34xx
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
To try out the new code, compile a kernel with CONFIG_OMAP_MUX and CONFIG_DEBUG_FS and these patches. The series is also availabe in the l-o git in mux branch.
To see the mux configuration on your board:
# mount -t debugfs debugfs /sys/kernel/debug # cat /sys/kernel/debug/omap_mux | less OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), padconf: cam_d0 signal: gpio_99: offset: 0x0e6 value: 0x4104 m0: cam_d0 m1: m2: m3: m4: gpio_99 m5: m6: m7: safe_mode phys: 0x48002116 ball bottom: ag17 ball top:
OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0),
padconf: cam_d10 signal: safe_mode: offset: 0x0fa value: 0x0007
m0: cam_d10 m1: m2: m3:
m4: gpio_109 m5: m6: m7: safe_mode
phys: 0x4800212a ball bottom: b25 ball top:
...
Then to produce a list of board mux entries from a working system, do:
# cat /sys/kernel/debug/omap_mux | grep OMAP3_MUX OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0), OMAP3_MUX(CAM_D11, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABL E | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D1, OMAP_PIN_INPUT | OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_NONE | O MAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), ...
Currenly no write support to tweak the pins via debugfs, but I'll add that soon with command line support too.
I have not really verified the data yet, but it mostly looks right. Adding support for 3630 and omap4 should be easy after generating the data. It's currently implemented only for 34xx.
I guess the next step would be to convert all omap3 calls to omap_cfg_reg() to use omap_mux_set() instead with the new data and make sure things work. Then we can remove the old data for 34xx.
Comments welcome as always.
Regards,
Tony
---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (4):
omap: mux: Add debugfs support for new mux code
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style pin multiplexing code for omap3
arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/board-3430sdp.c | 9 arch/arm/mach-omap2/board-cm-t35.c | 9 arch/arm/mach-omap2/board-ldp.c | 9 arch/arm/mach-omap2/board-omap3beagle.c | 9 arch/arm/mach-omap2/board-omap3evm.c | 9 arch/arm/mach-omap2/board-omap3pandora.c | 9 arch/arm/mach-omap2/board-overo.c | 8 arch/arm/mach-omap2/board-rx51.c | 10 arch/arm/mach-omap2/board-zoom2.c | 8 arch/arm/mach-omap2/mux.c | 424 ++++++++ arch/arm/mach-omap2/mux.h | 127 ++ arch/arm/mach-omap2/mux34xx.c | 1552 ++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++ 14 files changed, 2533 insertions(+), 6 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/5 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 */
@@ -566,10 +586,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;
@@ -599,7 +616,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 ;
@@ -618,7 +635,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 ;
@@ -629,6 +646,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 ;
Tony Lindgren
maintainerPATCH 2/5 omap: mux: Add new style pin multiplexing code for omap3
In reply to Tony LindgrenInitially only for 34xx. Keep the old code working until the data has been converted to the new style format.
REVISIT: Add support for cmdline parsing
REVISIT: Add a function to get mux register by GPIO pin
REVISIT: Add a function to set an array of mux entries
--- arch/arm/mach-omap2/mux.c | 237 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 125 ++++++++++++++++++++++++ 2 files changed, 362 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux.h
arch/arm/mach-omap2/mux.c +237 -0
@@ -27,12 +27,15 @@#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 */
@@ -626,6 +629,11 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)#endif #ifdef CONFIG_ARCH_OMAP34XX + +/* +* NOTE: This function will disappear soon, please use the new +* omap_mux_set() instead +*/ static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) {static DEFINE_SPINLOCK (mux_spin_lock);
@@ -644,6 +652,235 @@ 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); + +/* +* REVISIT: See if pin is set dynamic, and add it to the list +*/ +int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +omap_mux_write (val, mux_offset); + +return 0 ; +} + +struct omap_mux_entry { +struct omap_mux mux; +struct list_head node; +}; + +static struct omap_mux *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 )); + +#ifdef CONFIG_DEBUG_FS +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) { +if (src->muxnames[i]) { + m->muxnames[i] = +kzalloc (strlen (src->muxnames[i]) +1 , +GFP_KERNEL ); +if (!m->muxnames[i]) + goto free_names; +strcpy (m->muxnames[i], src->muxnames[i]); + } + } +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) { +if (src->balls[i]) { + m->balls[i] = +kzalloc (strlen (src->balls[i]) +1 , +GFP_KERNEL ); +if (!m->balls[i]) + goto free_balls; +strcpy (m->balls[i], src->balls[i]); + } + } +#endif + +mutex_lock (&muxmode_mutex); +list_add (&entry->node, &muxmodes); +mutex_unlock (&muxmode_mutex); + +return m; + +#ifdef CONFIG_DEBUG_FS +free_balls: +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) +if (m->balls[i]) +kfree (m->balls[i]); +free_names: +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) +if (m->muxnames[i]) +kfree (m->muxnames[i]); +#endif + +kfree (entry); + +return NULL ; +} + +static void __init omap_mux_apply_subset (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_apply_pins (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_apply_pins (struct omap_ball *b, +struct omap_mux *superset) +{ +} + +#endif /* CONFIG_DEBUG_FS */ + +static void __init omap_mux_set_board (struct omap_board_mux *board) +{ +while (board->reg_offset !=OMAP_MUX_TERMINATOR ) { +omap_mux_write (board->value, board->reg_offset); + board++; + } +} + +static void __init omap_mux_init_dynamic (struct omap_board_mux *board_subset, +struct omap_mux *superset, +int flags) +{ +struct omap_mux *s = superset; +int always_dynamic = flags &OMAP_MUX_ALL_DYNAMIC ; + +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *entry; + +if (!always_dynamic) { +u16 mode; + +/* GPIO pins must be always dynamic for PM */ + mode =omap_mux_read (s->reg_offset) &0x7 ; +if (mode !=OMAP_MUX_MODE4 ) +continue ; + } + + entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add entry\n" ); +return ; + } + s++; + } + +if (always_dynamic) +return ; + +/* Search for pins set as dynamic in the board-*.c file */ +while (board_subset->reg_offset !=OMAP_MUX_TERMINATOR ) { + +/* GPIO pins are always dynamic, and already handled */ +if ((board_subset->value &0x7 ) ==OMAP_MUX_MODE4 ) +continue ; + +if (!(board_subset->flags &OMAP_MUX_DYNAMIC )) +continue ; + + s = superset; +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +if (s->reg_offset == board_subset->reg_offset) { +struct omap_mux *entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add " +"board entry\n" ); +return ; + } + } + s++; + } + board_subset++; + } +} + +/* +* Do not call this from board-*.c files, use omap3_mux_init() instead +*/ +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_subset, +struct omap_ball *package_balls, +int flags) +{ +/* +* REVISIT: Do the ioremap with mux_pbase here once after the old +* code is gone +* REVISIT: Do not initialize again if already called +*/ + +omap_mux_apply_subset (package_subset, superset); +omap_mux_apply_pins (package_balls, superset); +omap_mux_set_board (board_subset); +omap_mux_init_dynamic (board_subset, superset, flags); + +return 0 ; +} + +#endif + +/*----------------------------------------------------------------------------*/ +int __init omap2_mux_init (void ) {u32 mux_pbase;
arch/arm/mach-omap2/mux.h new file +125 -0
125 lines not on this page · raw message
Re: [PATCH 2/5] omap: mux: Add new style pin multiplexing code for omap3
Quoted 21 lines · Tony Lindgren
Initially only for 34xx. Keep the old code working until the data has been converted to the new style format.
REVISIT: Add support for cmdline parsing
REVISIT: Add a function to get mux register by GPIO pin
REVISIT: Add a function to set an array of mux entriesSigned-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/mux.c | 237 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 125 ++++++++++++++++++++++++ 2 files changed, 362 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux.harch/arm/mach-omap2/mux.c +0
-0@@ -27,12 +27,15 @@#include <linux/init.h>
arch/arm/mach-omap2/mux.c line 37
Quoted 10 lines
arch/arm/mach-omap2/mux.c +2
-0#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"
Wouldn't <mach/mux.h> be better?
arch/arm/mach-omap2/mux.c static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) · line 636
Quoted 12 lines
arch/arm/mach-omap2/mux.c +5
-0#ifdef CONFIG_OMAP_MUX #define OMAP_MUX_BASE_OFFSET 0x30/* Offset from CTRL_BASE */ @@ -626,6 +629,11 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)#endif #ifdef CONFIG_ARCH_OMAP34XX + +/* +* NOTE: This function will disappear soon, please use the new +* omap_mux_set() instead +*/
I think it's worth adding more visible notice, e.g. marking the function deprecated or adding a WARN statement to its body.
Quoted 81 lines
arch/arm/mach-omap2/mux.c +74
-0static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) {static DEFINE_SPINLOCK (mux_spin_lock);@@ -644,6 +652,235 @@ 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); + +/* +* REVISIT: See if pin is set dynamic, and add it to the list +*/ +int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +omap_mux_write (val, mux_offset); + +return 0 ; +} + +struct omap_mux_entry { +struct omap_mux mux; +struct list_head node; +}; + +static struct omap_mux *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 )); + +#ifdef CONFIG_DEBUG_FS +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) { +if (src->muxnames[i]) { + m->muxnames[i] = +kzalloc (strlen (src->muxnames[i]) +1 , +GFP_KERNEL ); +if (!m->muxnames[i]) + goto free_names; +strcpy (m->muxnames[i], src->muxnames[i]); + } + } +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) { +if (src->balls[i]) { + m->balls[i] = +kzalloc (strlen (src->balls[i]) +1 , +GFP_KERNEL ); +if (!m->balls[i]) + goto free_balls; +strcpy (m->balls[i], src->balls[i]); + } + } +#endif + +mutex_lock (&muxmode_mutex); +list_add (&entry->node, &muxmodes); +mutex_unlock (&muxmode_mutex); + +return m; + +#ifdef CONFIG_DEBUG_FS +free_balls: +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) +if (m->balls[i]) +kfree (m->balls[i]); +free_names: +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) +if (m->muxnames[i]) +kfree (m->muxnames[i]);
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 738
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+#endif + +kfree (entry); + +return NULL ; +} + +static void __init omap_mux_apply_subset (struct omap_mux *p, +struct omap_mux *superset) +{
I'm not sure it is required.
Is it for sure that CBC package will remain superset of all possible mux modes for all OMAP3 variants through entire OMAP3 lifespan? What about OMAP3630 and OMAP3517? Are their packages also subset of the CBC one?
I'd rather keep the entire tables for different packages/CPU variants. They are anyway __initdata, so they would be discarded later during boot. And, keeping the full tables rather than differences makes omap_mux_apply_subset and unnecessary and omap_mux_apply_pins much simpler.
If we keep the full tables instead of diffs we could do something like:
static struct omap_mux *muxmodes;
static void __init omap_mux_apply_subset(struct omap_mux *p)
{
muxmodes = p;
}Quoted 25 lines
arch/arm/mach-omap2/mux.c +25
-0+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_apply_pins (struct omap_ball *b, +struct omap_mux *superset) +{ +while (b->reg_offset !=OMAP_MUX_TERMINATOR ) {
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 773
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+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 ; + }
Again, if we keep the full tables instead of diffs we don't need the nested loop. Provided that balls table has pins in the same order as the mux table we could have only the assignments here.
Quoted 92 lines
arch/arm/mach-omap2/mux.c +92
-0+ 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_apply_pins (struct omap_ball *b, +struct omap_mux *superset) +{ +} + +#endif /* CONFIG_DEBUG_FS */ + +static void __init omap_mux_set_board (struct omap_board_mux *board) +{ +while (board->reg_offset !=OMAP_MUX_TERMINATOR ) { +omap_mux_write (board->value, board->reg_offset); + board++; + } +} + +static void __init omap_mux_init_dynamic (struct omap_board_mux *board_subset, +struct omap_mux *superset, +int flags) +{ +struct omap_mux *s = superset; +int always_dynamic = flags &OMAP_MUX_ALL_DYNAMIC ; + +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *entry; + +if (!always_dynamic) { +u16 mode; + +/* GPIO pins must be always dynamic for PM */ + mode =omap_mux_read (s->reg_offset) &0x7 ; +if (mode !=OMAP_MUX_MODE4 ) +continue ; + } + + entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add entry\n" ); +return ; + } + s++; + } + +if (always_dynamic) +return ; + +/* Search for pins set as dynamic in the board-*.c file */ +while (board_subset->reg_offset !=OMAP_MUX_TERMINATOR ) { + +/* GPIO pins are always dynamic, and already handled */ +if ((board_subset->value &0x7 ) ==OMAP_MUX_MODE4 ) +continue ; + +if (!(board_subset->flags &OMAP_MUX_DYNAMIC )) +continue ; + + s = superset; +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +if (s->reg_offset == board_subset->reg_offset) { +struct omap_mux *entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add " +"board entry\n" ); +return ; + } + } + s++; + } + board_subset++; + } +} + +/* +* Do not call this from board-*.c files, use omap3_mux_init() instead +*/ +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_subset, +struct omap_ball *package_balls, +int flags) +{
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 875
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+/* +* REVISIT: Do the ioremap with mux_pbase here once after the old +* code is gone +* REVISIT: Do not initialize again if already called +*/ + +omap_mux_apply_subset (package_subset, superset); +omap_mux_apply_pins (package_balls, superset); +omap_mux_set_board (board_subset); +omap_mux_init_dynamic (board_subset, superset, flags);
With full tables for each package we won't need superset here.
arch/arm/mach-omap2/mux.h
Quoted 16 lines
arch/arm/mach-omap2/mux.c +8
-0+ + return 0; +} + +#endif + +/*----------------------------------------------------------------------------*/ +int __init omap2_mux_init (void ) {u32 mux_pbase;arch/arm/mach-omap2/mux.h new file +0
-0
Wouldn't arch/arm/mach-omap2/include/mach/mux.h be better?
Quoted 132 lines
arch/arm/mach-omap2/mux.h new file +125
-1@@ -0,0 +1,125 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ + +#define OMAP_MUX_TERMINATOR 0xffff + +/* 34xx mux mode options for each pin. See TRM for options */ +#define OMAP_MUX_MODE0 0 +#define OMAP_MUX_MODE1 1 +#define OMAP_MUX_MODE2 2 +#define OMAP_MUX_MODE3 3 +#define OMAP_MUX_MODE4 4 +#define OMAP_MUX_MODE5 5 +#define OMAP_MUX_MODE6 6 +#define OMAP_MUX_MODE7 7 + +/* 24xx/34xx mux bit defines */ +#define OMAP_PULL_ENA (1 << 3) +#define OMAP_PULL_UP (1 << 4) +#define OMAP_ALTELECTRICALSEL (1 << 5) + +/* 34xx specific mux bit defines */ +#define OMAP_INPUT_EN (1 << 8) +#define OMAP_OFF_EN (1 << 9) +#define OMAP_OFFOUT_EN (1 << 10) +#define OMAP_OFFOUT_VAL (1 << 11) +#define OMAP_OFF_PULL_EN (1 << 12) +#define OMAP_OFF_PULL_UP (1 << 13) +#define OMAP_WAKEUP_EN (1 << 14) + +/* Active pin states */ +#define OMAP_PIN_OUTPUT 0 +#define OMAP_PIN_INPUT OMAP_INPUT_EN +#define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \ + | OMAP_PULL_UP) +#define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN) + +/* Off mode states */ +#define OMAP_PIN_OFF_NONE 0 +#define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \ + | OMAP_OFFOUT_VAL) +#define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN) +#define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \ + | OMAP_OFF_PULL_UP) +#define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) +#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN + +/* Flags for struct omap_board_mux */ +#define OMAP_MUX_DYNAMIC (1 << 0)/* Keep mux in memory */ + +/* Flags for omap_mux_init */ +#define OMAP_MUX_ALL_DYNAMIC (1 << 16)/* Always in memory */ +#define OMAP_PACKAGE_MASK 0xffff +#define OMAP_PACKAGE_CUS 3/* 423-pin 0.65 */ +#define OMAP_PACKAGE_CBB 2/* 515-pin 0.40 0.50 */ +#define OMAP_PACKAGE_CBC 1/* 515-pin 0.50 0.65 */ + + +#define OMAP_MUX_NR_MODES 8/* Available modes */ +#define OMAP_MUX_NR_SIDES 2/* Bottom & top */ + +/** +* struct omap_mux - data for omap mux register offset and it's value +* @reg_offset: mux register offset from the mux base +* @gpio: GPIO number +* @muxnames: available signal modes for a ball +*/ +struct omap_mux { +u16 reg_offset; +u16 gpio; +#ifdef CONFIG_DEBUG_FS +char *muxnames[OMAP_MUX_NR_MODES ]; +char *balls[OMAP_MUX_NR_SIDES ]; +#endif +}; + +/** +* struct omap_ball - data for balls on omap package +* @reg_offset: mux register offset from the mux base +* @balls: available balls on the package +*/ +struct omap_ball { +u16 reg_offset; +char *balls[OMAP_MUX_NR_SIDES ]; +}; + +/** +* struct omap_board_mux - data for initializing mux registers +* @reg_offset: mux register offset from the mux base +* @mux_value: desired mux value to set +* @flags: extra flags +*/ +struct omap_board_mux { +u16 reg_offset; +u16 value; +u32 flags; +}; + +#if defined(CONFIG_OMAP_MUX ) && defined(CONFIG_ARCH_OMAP34XX ) + +int omap3_mux_init (struct omap_board_mux *board_mux_config,int flags); +int omap_mux_init (u32 mux_pbase,u32 mux_size, +struct omap_mux *superset, +struct omap_mux *package_subset, +struct omap_board_mux *board_subset, +struct omap_ball *package_balls, +int flags); +int omap_mux_set (u16 val,u16 mux_offset,int flags); + +#else + +static inline int omap3_mux_init (struct omap_board_mux *board_mux_config, +int flags) +{ +} +static inline int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +} + +#endif --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
maintainerRe: [PATCH 2/5] omap: mux: Add new style pin multiplexing code for omap3
Quoted 28 lines · Mike Rapoport
Quoted 25 lines · Tony Lindgren
Initially only for 34xx. Keep the old code working until the data has been converted to the new style format.
REVISIT: Add support for cmdline parsing
REVISIT: Add a function to get mux register by GPIO pin
REVISIT: Add a function to set an array of mux entriesSigned-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/mux.c | 237 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 125 ++++++++++++++++++++++++ 2 files changed, 362 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux.harch/arm/mach-omap2/mux.c +1
-0@@ -27,12 +27,15 @@#include <linux/init.h> #include <linux/io.h> #include <linux/spinlock.h> +#include <linux/list.h>
Quoted 8 lines
arch/arm/mach-omap2/mux.c line 37
Quoted 6 lines
arch/arm/mach-omap2/mux.c +1
-0#include <asm/system.h> #include <plat/control.h> #include <plat/mux.h> +#include "mux.h" Wouldn't <
mach/mux.h> be better?
Well I've been thinking that we should limit pin muxing to the board-*.c and platform_data init files under mach-omap2. Keeping the mux.h header file under mach-omap2/mux.h would certainly flag any attempts to use it under drivers/* for example.
The reasons being that if we limit muxing to the files under mach-omap2, we can safely assume that the mux data and code is mostly __initdata and __init.
And then we can safely do things like multiplex the pins with the real signal names without having to keep all the mux data wasting memory later on.
Comments? I'm OK doing keeping it under mach/mux.h, but I'd like to establish a policy of doing the muxing only in platform init code under mach-omap2.
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-omap2/mux.c +0
-0#ifdef CONFIG_OMAP_MUX #define OMAP_MUX_BASE_OFFSET 0x30/* Offset from CTRL_BASE */ @@ -626,6 +629,11 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)#endif
Quoted 9 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) · line 636
Quoted 6 lines
arch/arm/mach-omap2/mux.c +5
-0#ifdef CONFIG_ARCH_OMAP34XX + +/* +* NOTE: This function will disappear soon, please use the new +* omap_mux_set() instead +*/ I think it's worth adding more visible notice, e.g. marking the function deprecated or adding a WARN statement to its body.
Agreed. I was thinking about writing a little script to convert the old mux entries to the new ones, and drop all the old code and data for omap3 hopefully this week..
Quoted 94 lines
Quoted 81 lines
arch/arm/mach-omap2/mux.c +74
-0static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) {static DEFINE_SPINLOCK (mux_spin_lock);@@ -644,6 +652,235 @@ 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); + +/* +* REVISIT: See if pin is set dynamic, and add it to the list +*/ +int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +omap_mux_write (val, mux_offset); + +return 0 ; +} + +struct omap_mux_entry { +struct omap_mux mux; +struct list_head node; +}; + +static struct omap_mux *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 )); + +#ifdef CONFIG_DEBUG_FS +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) { +if (src->muxnames[i]) { + m->muxnames[i] = +kzalloc (strlen (src->muxnames[i]) +1 , +GFP_KERNEL ); +if (!m->muxnames[i]) + goto free_names; +strcpy (m->muxnames[i], src->muxnames[i]); + } + } +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) { +if (src->balls[i]) { + m->balls[i] = +kzalloc (strlen (src->balls[i]) +1 , +GFP_KERNEL ); +if (!m->balls[i]) + goto free_balls; +strcpy (m->balls[i], src->balls[i]); + } + } +#endif + +mutex_lock (&muxmode_mutex); +list_add (&entry->node, &muxmodes); +mutex_unlock (&muxmode_mutex); + +return m; + +#ifdef CONFIG_DEBUG_FS +free_balls: +for (i =0 ; i <OMAP_MUX_NR_SIDES ; i++) +if (m->balls[i]) +kfree (m->balls[i]); +free_names: +for (i =0 ; i <OMAP_MUX_NR_MODES ; i++) +if (m->muxnames[i]) +kfree (m->muxnames[i]);arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 738
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+#endif + +kfree (entry); + +return NULL ; +} + +static void __init omap_mux_apply_subset (struct omap_mux *p, +struct omap_mux *superset) +{I'm not sure it is required.
Quoted 3 lines
Is it for sure that CBC package will remain superset of all possible mux modes for all OMAP3 variants through entire OMAP3 lifespan? What about OMAP3630 and OMAP3517? Are their packages also subset of the CBC one?
Basically the mux registers are the same for all omap3, then the packaging determines which signal options are available for the package.
Looks like 3630 changes the mux name for few entries, and adds some new registers, so that should be easily covered too.
The superset may not always be named CBC, but we should have one omap3 superset still.
Quoted 4 lines
I'd rather keep the entire tables for different packages/CPU variants. They are anyway
__initdata, so they would be discarded later during boot. And, keeping the full tables rather than differences makesomap_mux_apply_subsetand unnecessary andomap_mux_apply_pinsmuch simpler.
I agree it would make it a bit simpler. But then we need to patch multiple data tables if we found errors in the data.
And the signal data is mostly the same for all omap3.
Quoted 7 lines
If we keep the full tables instead of diffs we could do something like:
static struct
omap_mux*muxmodes;
static void__initomap_mux_apply_subset(struct omap_mux *p){ muxmodes = p; }
Right, that's the way I had it originally, but the amount of data duplicated three times so far looked ugly to me :)
Quoted 31 lines
Quoted 31 lines
arch/arm/mach-omap2/mux.c +31
-0+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_apply_pins (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 ];
Quoted 8 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 773
Quoted 4 lines
arch/arm/mach-omap2/mux.c +4
-0+ s->balls[1 ] = b->balls[1 ]; + found++; +break ; + }Again, if we keep the full tables instead of diffs we don't need the nested loop. Provided that balls table has pins in the same order as the mux table we could have only the assignments here.
The difference with the balls compared to signals is that they are different for each package. (Just to recap, the naming is a matrix of the pins where the coordinates are alphabets in one direction, and number in the other direction).
So the pin data is really separate data from the mux register and signal data.
Mux registers and signal names are mostly the same for each omap3, while the ball names are renamed for each package option.
Quoted 96 lines
Quoted 96 lines
arch/arm/mach-omap2/mux.c +96
-0+ 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_apply_pins (struct omap_ball *b, +struct omap_mux *superset) +{ +} + +#endif /* CONFIG_DEBUG_FS */ + +static void __init omap_mux_set_board (struct omap_board_mux *board) +{ +while (board->reg_offset !=OMAP_MUX_TERMINATOR ) { +omap_mux_write (board->value, board->reg_offset); + board++; + } +} + +static void __init omap_mux_init_dynamic (struct omap_board_mux *board_subset, +struct omap_mux *superset, +int flags) +{ +struct omap_mux *s = superset; +int always_dynamic = flags &OMAP_MUX_ALL_DYNAMIC ; + +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +struct omap_mux *entry; + +if (!always_dynamic) { +u16 mode; + +/* GPIO pins must be always dynamic for PM */ + mode =omap_mux_read (s->reg_offset) &0x7 ; +if (mode !=OMAP_MUX_MODE4 ) +continue ; + } + + entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add entry\n" ); +return ; + } + s++; + } + +if (always_dynamic) +return ; + +/* Search for pins set as dynamic in the board-*.c file */ +while (board_subset->reg_offset !=OMAP_MUX_TERMINATOR ) { + +/* GPIO pins are always dynamic, and already handled */ +if ((board_subset->value &0x7 ) ==OMAP_MUX_MODE4 ) +continue ; + +if (!(board_subset->flags &OMAP_MUX_DYNAMIC )) +continue ; + + s = superset; +while (s->reg_offset !=OMAP_MUX_TERMINATOR ) { +if (s->reg_offset == board_subset->reg_offset) { +struct omap_mux *entry =omap_mux_list_add (s); +if (!entry) { +printk (KERN_ERR "mux: Could not add " +"board entry\n" ); +return ; + } + } + s++; + } + board_subset++; + } +} + +/* +* Do not call this from board-*.c files, use omap3_mux_init() instead +*/ +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_subset, +struct omap_ball *package_balls, +int flags) +{ +/* +* REVISIT: Do the ioremap with mux_pbase here once after the old +* code is gone +* REVISIT: Do not initialize again if already called
Quoted 8 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 875
Quoted 6 lines
arch/arm/mach-omap2/mux.c +6
-0+*/ + +omap_mux_apply_subset (package_subset, superset); +omap_mux_apply_pins (package_balls, superset); +omap_mux_set_board (board_subset); +omap_mux_init_dynamic (board_subset, superset, flags);With full tables for each package we won't need superset here.
Right, but the maintenance will be more of a pain because of the duplicate data. And we still need to copy the __initdata to the list for the configured entries.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-omap2/mux.c +8
-0+ + return 0; +} + +#endif + +/*----------------------------------------------------------------------------*/ +int __init omap2_mux_init (void ) {
Quoted 8 lines
arch/arm/mach-omap2/mux.h
Quoted 6 lines
arch/arm/mach-omap2/mux.c +0
-0u32 mux_pbase;arch/arm/mach-omap2/mux.h new file +0
-0Wouldn't
arch/arm/mach-omap2/include/mach/mux.hbe better?
Unless we want to limit the usage of the code to board-*.c files, and not allow using it elsewhere. But I'm OK either way.
Quoted 139 lines
Quoted 132 lines
arch/arm/mach-omap2/mux.h new file +125
-1@@ -0,0 +1,125 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ + +#define OMAP_MUX_TERMINATOR 0xffff + +/* 34xx mux mode options for each pin. See TRM for options */ +#define OMAP_MUX_MODE0 0 +#define OMAP_MUX_MODE1 1 +#define OMAP_MUX_MODE2 2 +#define OMAP_MUX_MODE3 3 +#define OMAP_MUX_MODE4 4 +#define OMAP_MUX_MODE5 5 +#define OMAP_MUX_MODE6 6 +#define OMAP_MUX_MODE7 7 + +/* 24xx/34xx mux bit defines */ +#define OMAP_PULL_ENA (1 << 3) +#define OMAP_PULL_UP (1 << 4) +#define OMAP_ALTELECTRICALSEL (1 << 5) + +/* 34xx specific mux bit defines */ +#define OMAP_INPUT_EN (1 << 8) +#define OMAP_OFF_EN (1 << 9) +#define OMAP_OFFOUT_EN (1 << 10) +#define OMAP_OFFOUT_VAL (1 << 11) +#define OMAP_OFF_PULL_EN (1 << 12) +#define OMAP_OFF_PULL_UP (1 << 13) +#define OMAP_WAKEUP_EN (1 << 14) + +/* Active pin states */ +#define OMAP_PIN_OUTPUT 0 +#define OMAP_PIN_INPUT OMAP_INPUT_EN +#define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \ + | OMAP_PULL_UP) +#define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN) + +/* Off mode states */ +#define OMAP_PIN_OFF_NONE 0 +#define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \ + | OMAP_OFFOUT_VAL) +#define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN) +#define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \ + | OMAP_OFF_PULL_UP) +#define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) +#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN + +/* Flags for struct omap_board_mux */ +#define OMAP_MUX_DYNAMIC (1 << 0)/* Keep mux in memory */ + +/* Flags for omap_mux_init */ +#define OMAP_MUX_ALL_DYNAMIC (1 << 16)/* Always in memory */ +#define OMAP_PACKAGE_MASK 0xffff +#define OMAP_PACKAGE_CUS 3/* 423-pin 0.65 */ +#define OMAP_PACKAGE_CBB 2/* 515-pin 0.40 0.50 */ +#define OMAP_PACKAGE_CBC 1/* 515-pin 0.50 0.65 */ + + +#define OMAP_MUX_NR_MODES 8/* Available modes */ +#define OMAP_MUX_NR_SIDES 2/* Bottom & top */ + +/** +* struct omap_mux - data for omap mux register offset and it's value +* @reg_offset: mux register offset from the mux base +* @gpio: GPIO number +* @muxnames: available signal modes for a ball +*/ +struct omap_mux { +u16 reg_offset; +u16 gpio; +#ifdef CONFIG_DEBUG_FS +char *muxnames[OMAP_MUX_NR_MODES ]; +char *balls[OMAP_MUX_NR_SIDES ]; +#endif +}; + +/** +* struct omap_ball - data for balls on omap package +* @reg_offset: mux register offset from the mux base +* @balls: available balls on the package +*/ +struct omap_ball { +u16 reg_offset; +char *balls[OMAP_MUX_NR_SIDES ]; +}; + +/** +* struct omap_board_mux - data for initializing mux registers +* @reg_offset: mux register offset from the mux base +* @mux_value: desired mux value to set +* @flags: extra flags +*/ +struct omap_board_mux { +u16 reg_offset; +u16 value; +u32 flags; +}; + +#if defined(CONFIG_OMAP_MUX ) && defined(CONFIG_ARCH_OMAP34XX ) + +int omap3_mux_init (struct omap_board_mux *board_mux_config,int flags); +int omap_mux_init (u32 mux_pbase,u32 mux_size, +struct omap_mux *superset, +struct omap_mux *package_subset, +struct omap_board_mux *board_subset, +struct omap_ball *package_balls, +int flags); +int omap_mux_set (u16 val,u16 mux_offset,int flags); + +#else + +static inline int omap3_mux_init (struct omap_board_mux *board_mux_config, +int flags) +{ +} +static inline int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +} + +#endif --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.htmlSignature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 2/5] omap: mux: Add new style pin multiplexing code for omap3
Quoted 47 lines · Tony Lindgren
Quoted 28 lines · Mike Rapoport
Quoted 25 lines · Tony Lindgren
Initially only for 34xx. Keep the old code working until the data has been converted to the new style format.
REVISIT: Add support for cmdline parsing
REVISIT: Add a function to get mux register by GPIO pin
REVISIT: Add a function to set an array of mux entriesSigned-off-by Tony Lindgren <[email protected]>---
arch/arm/mach-omap2/mux.c | 237 +++++++++++++++++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux.h| 125 ++++++++++++++++++++++++2 files changed, 362 insertions(+), 0 deletions(-)create mode 100644
arch/arm/mach-omap2/mux.harch/arm/mach-omap2/mux.c +1
-0@@ -27,12 +27,15 @@ #include <linux/init.h> #include <linux/io.h> #include <linux/spinlock.h> +#include <linux/list.h> Quoted 8 lines
arch/arm/mach-omap2/mux.c line 37
Quoted 6 lines
arch/arm/mach-omap2/mux.c +1
-0#include <asm/system.h> #include <plat/control.h> #include <plat/mux.h> +#include "mux.h" Wouldn't <
mach/mux.h> be better?Well I've been thinking that we should limit pin muxing to the board-*.c and
platform_datainit files under mach-omap2. Keeping themux.hheader file undermach-omap2/mux.hwould certainly flag any attempts to use it underdrivers/*for example.The reasons being that if we limit muxing to the files under mach-omap2, we can safely assume that the mux data and code is mostly
__initdataand__init.
Quoted 7 lines
And then we can safely do things like multiplex the pins with the real signal names without having to keep all the mux data wasting memory later on.
Comments? I'm OK doing keeping it under
mach/mux.h, but I'd like to establish a policy of doing the muxing only in platform init code under mach-omap2.
I have no strong prefernce for <mach/mux.h>. Keeping it under mach-omap2 will make the policy definition easier. I'm ok with "arch/arm/mach-omap2/mux.h".
Quoted 123 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-omap2/mux.c +0
-0#ifdef CONFIG_OMAP_MUX #define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */@@ -626,6 +629,11 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) #endifQuoted 9 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) · line 636
Quoted 6 lines
arch/arm/mach-omap2/mux.c +5
-0#ifdef CONFIG_ARCH_OMAP34XX + +/* +* NOTE: This function will disappear soon, please use the new +* omap_mux_set() instead +*/ I think it's worth adding more visible notice, e.g. marking the function deprecated or adding a WARN statement to its body.
Agreed. I was thinking about writing a little script to convert the old mux entries to the new ones, and drop all the old code and data for omap3 hopefully this week..
Quoted 94 lines
Quoted 81 lines
arch/arm/mach-omap2/mux.c +74
-0static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) { static DEFINE_SPINLOCK(mux_spin_lock);@@ -644,6 +652,235 @@ 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); + +/* +* REVISIT: See if pin is set dynamic, and add it to the list +*/ +int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ + omap_mux_write(val, mux_offset); + + return 0; +} + +struct omap_mux_entry { + struct omap_mux mux; + struct list_head node; +}; + +static struct omap_mux *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)); + +#ifdef CONFIG_DEBUG_FS + for (i = 0; i < OMAP_MUX_NR_MODES; i++) { + if (src->muxnames[i]) { + m->muxnames[i] = + kzalloc(strlen(src->muxnames[i]) + 1, + GFP_KERNEL); + if (!m->muxnames[i]) + goto free_names; + strcpy(m->muxnames[i], src->muxnames[i]); + } + } + for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { + if (src->balls[i]) { + m->balls[i] = + kzalloc(strlen(src->balls[i]) + 1, + GFP_KERNEL); + if (!m->balls[i]) + goto free_balls; + strcpy(m->balls[i], src->balls[i]); + } + } +#endif + + mutex_lock(&muxmode_mutex); + list_add(&entry->node, &muxmodes); + mutex_unlock(&muxmode_mutex); + + return m; + +#ifdef CONFIG_DEBUG_FS +free_balls: + for (i = 0; i < OMAP_MUX_NR_SIDES; i++) + if (m->balls[i]) + kfree(m->balls[i]); +free_names: + for (i = 0; i < OMAP_MUX_NR_MODES; i++) + if (m->muxnames[i]) + kfree(m->muxnames[i]);arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 738
Quoted 10 lines
arch/arm/mach-omap2/mux.c +10
-0+#endif + + kfree(entry); + + return NULL; +} + +static void __init omap_mux_apply_subset (struct omap_mux *p, + struct omap_mux *superset) +{I'm not sure it is required.
Quoted 3 lines
Is it for sure that CBC package will remain superset of all possible mux modes for all OMAP3 variants through entire OMAP3 lifespan? What about OMAP3630 and OMAP3517? Are their packages also subset of the CBC one?
Basically the mux registers are the same for all omap3, then the packaging determines which signal options are available for the package.
Quoted 5 lines
Looks like 3630 changes the mux name for few entries, and adds some new registers, so that should be easily covered too.
The superset may not always be named CBC, but we should have one omap3 superset still.
Agreed.
Quoted 200 lines
Quoted 4 lines
I'd rather keep the entire tables for different packages/CPU variants. They are anyway
__initdata, so they would be discarded later during boot. And, keeping the full tables rather than differences makesomap_mux_apply_subsetand unnecessary andomap_mux_apply_pinsmuch simpler.I agree it would make it a bit simpler. But then we need to patch multiple data tables if we found errors in the data.
And the signal data is mostly the same for all omap3.
Quoted 7 lines
If we keep the full tables instead of diffs we could do something like:
static struct
omap_mux*muxmodes;
static void__initomap_mux_apply_subset(struct omap_mux *p){
muxmodes = p;
}Right, that's the way I had it originally, but the amount of data duplicated three times so far looked ugly to me :)
Quoted 31 lines
Quoted 31 lines
arch/arm/mach-omap2/mux.c +31
-0+ 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_apply_pins (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];Quoted 8 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 773
Quoted 4 lines
arch/arm/mach-omap2/mux.c +4
-0+ s->balls[1] = b->balls[1]; + found++; + break; + }Again, if we keep the full tables instead of diffs we don't need the nested loop. Provided that balls table has pins in the same order as the mux table we could have only the assignments here.
The difference with the balls compared to signals is that they are different for each package. (Just to recap, the naming is a matrix of the pins where the coordinates are alphabets in one direction, and number in the other direction).
So the pin data is really separate data from the mux register and signal data.
Mux registers and signal names are mostly the same for each omap3, while the ball names are renamed for each package option.
Quoted 96 lines
Quoted 96 lines
arch/arm/mach-omap2/mux.c +96
-0+ 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_apply_pins (struct omap_ball *b, + struct omap_mux *superset) +{ +} + +#endif /* CONFIG_DEBUG_FS */ + +static void __init omap_mux_set_board (struct omap_board_mux *board) +{ + while (board->reg_offset != OMAP_MUX_TERMINATOR) { + omap_mux_write(board->value, board->reg_offset); + board++; + } +} + +static void __init omap_mux_init_dynamic (struct omap_board_mux *board_subset, + struct omap_mux *superset, + int flags) +{ + struct omap_mux *s = superset; + int always_dynamic = flags & OMAP_MUX_ALL_DYNAMIC; + + while (s->reg_offset != OMAP_MUX_TERMINATOR) { + struct omap_mux *entry; + + if (!always_dynamic) { + u16 mode; + + /* GPIO pins must be always dynamic for PM */ + mode = omap_mux_read(s->reg_offset) & 0x7; + if (mode != OMAP_MUX_MODE4) + continue; + } + + entry = omap_mux_list_add(s); + if (!entry) { + printk(KERN_ERR "mux: Could not add entry\n"); + return; + } + s++; + } + + if (always_dynamic) + return; + + /* Search for pins set as dynamic in the board-*.c file */ + while (board_subset->reg_offset != OMAP_MUX_TERMINATOR) { + + /* GPIO pins are always dynamic, and already handled */ + if ((board_subset->value & 0x7) == OMAP_MUX_MODE4) + continue; + + if (!(board_subset->flags & OMAP_MUX_DYNAMIC)) + continue; + + s = superset; + while (s->reg_offset != OMAP_MUX_TERMINATOR) { + if (s->reg_offset == board_subset->reg_offset) { + struct omap_mux *entry = omap_mux_list_add(s); + if (!entry) { + printk(KERN_ERR "mux: Could not add " + "board entry\n"); + return; + } + } + s++; + } + board_subset++; + } +} + +/* +* Do not call this from board-*.c files, use omap3_mux_init() instead +*/ +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_subset, + struct omap_ball *package_balls, + int flags) +{ + /* +* REVISIT: Do the ioremap with mux_pbase here once after the old +* code is gone +* REVISIT: Do not initialize again if already called Quoted 8 lines
arch/arm/mach-omap2/mux.c static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) · line 875
Quoted 6 lines
arch/arm/mach-omap2/mux.c +6
-0+*/ + + omap_mux_apply_subset(package_subset, superset); + omap_mux_apply_pins(package_balls, superset); + omap_mux_set_board(board_subset); + omap_mux_init_dynamic(board_subset, superset, flags);With full tables for each package we won't need superset here.
Right, but the maintenance will be more of a pain because of the duplicate data. And we still need to copy the
__initdatato the list for the configured entries.Quoted 10 lines
Quoted 10 lines
arch/arm/mach-omap2/mux.c +8
-0+ + return 0; +} + +#endif + +/*----------------------------------------------------------------------------*/ + int __init omap2_mux_init(void) {Quoted 8 lines
arch/arm/mach-omap2/mux.h
Quoted 6 lines
arch/arm/mach-omap2/mux.c +0
-0u32 mux_pbase;arch/arm/mach-omap2/mux.h new file +0
-0Wouldn't
arch/arm/mach-omap2/include/mach/mux.hbe better?
Quoted 2 lines
Unless we want to limit the usage of the code to board-*.c files, and not allow using it elsewhere. But I'm OK either way.
I think restricting mux usage to files under mach-omap2 is the right thing to do, so let's keep it "arch/arm/mach-omap2/mux.h"
Quoted 140 lines
Quoted 139 lines
Quoted 128 lines
arch/arm/mach-omap2/mux.h new file +125
-1@@ -0,0 +1,125 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ + +#define OMAP_MUX_TERMINATOR 0xffff + +/* 34xx mux mode options for each pin. See TRM for options */ +#define OMAP_MUX_MODE0 0 +#define OMAP_MUX_MODE1 1 +#define OMAP_MUX_MODE2 2 +#define OMAP_MUX_MODE3 3 +#define OMAP_MUX_MODE4 4 +#define OMAP_MUX_MODE5 5 +#define OMAP_MUX_MODE6 6 +#define OMAP_MUX_MODE7 7 + +/* 24xx/34xx mux bit defines */ +#define OMAP_PULL_ENA (1 << 3) +#define OMAP_PULL_UP (1 << 4) +#define OMAP_ALTELECTRICALSEL (1 << 5) + +/* 34xx specific mux bit defines */ +#define OMAP_INPUT_EN (1 << 8) +#define OMAP_OFF_EN (1 << 9) +#define OMAP_OFFOUT_EN (1 << 10) +#define OMAP_OFFOUT_VAL (1 << 11) +#define OMAP_OFF_PULL_EN (1 << 12) +#define OMAP_OFF_PULL_UP (1 << 13) +#define OMAP_WAKEUP_EN (1 << 14) + +/* Active pin states */ +#define OMAP_PIN_OUTPUT 0 +#define OMAP_PIN_INPUT OMAP_INPUT_EN +#define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \ + | OMAP_PULL_UP) +#define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN) + +/* Off mode states */ +#define OMAP_PIN_OFF_NONE 0 +#define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \ + | OMAP_OFFOUT_VAL) +#define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN) +#define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \ + | OMAP_OFF_PULL_UP) +#define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) +#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN + +/* Flags for struct omap_board_mux */ +#define OMAP_MUX_DYNAMIC (1 << 0)/* Keep mux in memory */ + +/* Flags for omap_mux_init */ +#define OMAP_MUX_ALL_DYNAMIC (1 << 16)/* Always in memory */ +#define OMAP_PACKAGE_MASK 0xffff +#define OMAP_PACKAGE_CUS 3/* 423-pin 0.65 */ +#define OMAP_PACKAGE_CBB 2/* 515-pin 0.40 0.50 */ +#define OMAP_PACKAGE_CBC 1/* 515-pin 0.50 0.65 */ + + +#define OMAP_MUX_NR_MODES 8/* Available modes */ +#define OMAP_MUX_NR_SIDES 2/* Bottom & top */ + +/** +* struct omap_mux - data for omap mux register offset and it's value +* @reg_offset: mux register offset from the mux base +* @gpio: GPIO number +* @muxnames: available signal modes for a ball +*/ +struct omap_mux { + u16 reg_offset; + u16 gpio; +#ifdef CONFIG_DEBUG_FS + char *muxnames[OMAP_MUX_NR_MODES]; + char *balls[OMAP_MUX_NR_SIDES]; +#endif +}; + +/** +* struct omap_ball - data for balls on omap package +* @reg_offset: mux register offset from the mux base +* @balls: available balls on the package +*/ +struct omap_ball { + u16 reg_offset; + char *balls[OMAP_MUX_NR_SIDES]; +}; + +/** +* struct omap_board_mux - data for initializing mux registers +* @reg_offset: mux register offset from the mux base +* @mux_value: desired mux value to set +* @flags: extra flags +*/ +struct omap_board_mux { + u16 reg_offset; + u16 value; + u32 flags; +}; + +#if defined(CONFIG_OMAP_MUX ) && defined(CONFIG_ARCH_OMAP34XX ) + +int omap3_mux_init (struct omap_board_mux *board_mux_config,int flags); +int omap_mux_init (u32 mux_pbase,u32 mux_size, + struct omap_mux *superset, + struct omap_mux *package_subset, + struct omap_board_mux *board_subset, + struct omap_ball *package_balls, + int flags); +int omap_mux_set (u16 val,u16 mux_offset,int flags); + +#else + +static inline int omap3_mux_init (struct omap_board_mux *board_mux_config, + int flags) +{ +} +static inline int omap_mux_set (u16 val,u16 mux_offset,int flags) +{ +} + +#endif --Quoted 4 lines
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--
Sincerely yours,
Mike.
Signature · 6 lines
Sincerely Yours, Mike. -- 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
Tony Lindgren
maintainerPATCH 3/5 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 if CONFIG_OMAP_MUX is not set. Also, the debug data gets optimized out if CONFIG_DEBUG_FS is not set.
--- arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/mux.h | 2 arch/arm/mach-omap2/mux34xx.c | 1552 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++++ 4 files changed, 1910 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 +1552 -0
1,552 lines not on this page · raw message
arch/arm/mach-omap2/mux34xx.h new file +352 -0
352 lines not on this page · raw message
Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Quoted 85 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/mux.h | 2 arch/arm/mach-omap2/mux34xx.c | 1552 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++++ 4 files changed, 1910 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux34xx.c create mode 100644 arch/arm/mach-omap2/mux34xx.harch/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.oarch/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 +33
-0@@ -0,0 +1,1552 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ + +#include <linux/module.h> +#include <linux/init.h> + +#include "mux.h" + +#ifdef CONFIG_DEBUG_FS + +#define _OMAP3_MUXENTRY (M0 , g, m0, m1, m2, m3, m4, m5, m6, m7) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .gpio = (g), \ + .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \ +} + +#else + +#define _OMAP3_MUXENTRY (M0 , g, m0, m1, m2, m3, m4, m5, m6, m7) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .gpio = (g), \ +} + +#endif +
arch/arm/mach-omap2/mux34xx.c line 43
Quoted 10 lines
arch/arm/mach-omap2/mux34xx.c new file +10
-0+#define _OMAP3_BALLENTRY (M0 , bb, bt) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .balls = { bb, bt }, \ +} + +/* +* Superset of all mux modes, same as the CBC package +*/ +static struct omap_mux __initdata omap3_muxmodes[] = {
Is the CBS package for sure will be superset of all possible OMAP3 variants/packages?
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.c new file +3
-0+_OMAP3_MUXENTRY (CAM_D0 ,99 , +"cam_d0" ,NULL ,NULL ,NULL , + "gpio_99", NULL, NULL, "safe_mode"),
[ snip ]
Quoted 22 lines
arch/arm/mach-omap2/mux34xx.c new file +22
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +/* +* Pins different on CBC package comapared to CBC package +*/ +struct omap_mux __initdata omap3_cbc_subset[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; + +/* +* Balls for CBC package +* 515-pin s-PBGA Package, 0.65mm Ball Pitch (Top), 0.50mm Ball Pitch (Bottom) +* +* FIXME: What's up with the outdated TI documentation? See: +* +* http://wiki.davincidsp.com/index.php/Datasheet_Errata_for_OMAP35x_CBC_Package +* http://community.ti.com/forums/t/10982.aspx +*/ +#ifdef CONFIG_DEBUG_FS +struct omap_ball __initdata omap3_cbc_ball[] = { + _OMAP3_BALLENTRY(CAM_D0, "ae16", NULL),
[ snip ]
arch/arm/mach-omap2/mux34xx.c line 869
Quoted 9 lines
arch/arm/mach-omap2/mux34xx.c new file +9
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; +#else +#define omap3_cbc_ball NULL +#endif + +/* +* Pins different on CUS package comapared to CBC package +*/
Maybe we'll just add the entire package rather than its difference to the CBC package?
Quoted 4 lines
arch/arm/mach-omap2/mux34xx.c new file +4
-0+struct omap_mux __initdata omap3_cus_subset[] = { +_OMAP3_MUXENTRY (CAM_D10 ,109 , +"cam_d10" ,NULL ,NULL ,NULL , +"gpio_109" ,NULL ,NULL ,"safe_mode" ),
[ snip ]
Quoted 10 lines
arch/arm/mach-omap2/mux34xx.c new file +10
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +/* +* Balls for CUS package +* 423-pin s-PBGA Package, 0.65mm Ball Pitch (Bottom) +*/ +#ifdef CONFIG_DEBUG_FS +struct omap_ball __initdata omap3_cus_ball[] = { + _OMAP3_BALLENTRY(CAM_D0, "ab18", NULL),
[ snip ]
arch/arm/mach-omap2/mux34xx.c line 1201
Quoted 9 lines
arch/arm/mach-omap2/mux34xx.c new file +9
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; +#else +#define omap3_cus_ball NULL +#endif + +/* +* Pins different on CBB package comapared to CBC package +*/
ditto
Quoted 4 lines
arch/arm/mach-omap2/mux34xx.c new file +4
-0+struct omap_mux __initdata omap3_cbb_subset[] = { +_OMAP3_MUXENTRY (CAM_D10 ,109 , +"cam_d10" ,NULL ,NULL ,NULL , +"gpio_109" ,NULL ,NULL ,"safe_mode" ),
[ snip ]
Quoted 10 lines
arch/arm/mach-omap2/mux34xx.c new file +10
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +/* +* Balls for CBB package +* 515-pin s-PBGA Package, 0.50mm Ball Pitch (Top), 0.40mm Ball Pitch (Bottom) +*/ +#ifdef CONFIG_DEBUG_FS +struct omap_ball __initdata omap3_cbb_ball[] = { + _OMAP3_BALLENTRY(CAM_D0, "ag17", NULL),
[ snip ]
Quoted 49 lines
arch/arm/mach-omap2/mux34xx.c new file +34
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; +#else +#define omap3_cbb_ball NULL +#endif + +int __init omap3_mux_init (struct omap_board_mux *board_subset,int flags) +{ +struct omap_mux *package_subset; +struct omap_ball *package_balls; + +switch (flags &OMAP_PACKAGE_MASK ) { +case (OMAP_PACKAGE_CBC ): + package_subset = omap3_cbc_subset; + package_balls = omap3_cbc_ball; +break ; +case (OMAP_PACKAGE_CBB ): + package_subset = omap3_cbb_subset; + package_balls = omap3_cbb_ball; +break ; +case (OMAP_PACKAGE_CUS ): + package_subset = omap3_cus_subset; + package_balls = omap3_cus_ball; +break ; +default : +printk (KERN_ERR "mux: Unknown omap package, mux disabled\n" ); +return -EINVAL ; + } + +return omap_mux_init (OMAP3_CONTROL_PADCONF_MUX_PBASE , +OMAP3_CONTROL_PADCONF_MUX_SIZE , + omap3_muxmodes, package_subset, board_subset, + package_balls, flags); +}arch/arm/mach-omap2/mux34xx.h new file +9
-0@@ -0,0 +1,352 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ +
[ snip ]
arch/arm/mach-omap2/mux34xx.h line 352
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.h new file +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)
What about adding defines for each possible mode configuration, except, perhaps, GPIO?
#define OMAP3_PIN_CAM_D0 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)
#define OMAP3_PIN_CAM_D0_CSI2_DX2 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE2 | \ OMAP_PIN_INPUT, 0)
And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
Quoted 6 lines
--
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
maintainerRe: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Quoted 93 lines · Mike Rapoport
Quoted 90 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/mux.h | 2 arch/arm/mach-omap2/mux34xx.c | 1552 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++++ 4 files changed, 1910 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux34xx.c create mode 100644 arch/arm/mach-omap2/mux34xx.harch/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.oarch/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 +38
-0@@ -0,0 +1,1552 @@ +/* +* Copyright (C) 2009 Nokia +* Copyright (C) 2009 Texas Instruments +* +* 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. +*/ + +#include <linux/module.h> +#include <linux/init.h> + +#include "mux.h" + +#ifdef CONFIG_DEBUG_FS + +#define _OMAP3_MUXENTRY (M0 , g, m0, m1, m2, m3, m4, m5, m6, m7) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .gpio = (g), \ + .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \ +} + +#else + +#define _OMAP3_MUXENTRY (M0 , g, m0, m1, m2, m3, m4, m5, m6, m7) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .gpio = (g), \ +} + +#endif + +#define _OMAP3_BALLENTRY (M0 , bb, bt) \ +{ \ + .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \ + .balls = { bb, bt }, \ +}
Quoted 8 lines
arch/arm/mach-omap2/mux34xx.c line 43
Quoted 5 lines
arch/arm/mach-omap2/mux34xx.c new file +5
-0+ +/* +* Superset of all mux modes, same as the CBC package +*/ +static struct omap_mux __initdata omap3_muxmodes[] = {Is the CBS package for sure will be superset of all possible OMAP3 variants/packages?
Not necessarily, but a single superset works for all omap3. I'll remove the CBC comment, as with 3630 it will be the superset.
Quoted 31 lines
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.c new file +3
-0+_OMAP3_MUXENTRY (CAM_D0 ,99 , +"cam_d0" ,NULL ,NULL ,NULL , + "gpio_99", NULL, NULL, "safe_mode"),[ snip ]
Quoted 22 lines
arch/arm/mach-omap2/mux34xx.c new file +22
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; + +/* +* Pins different on CBC package comapared to CBC package +*/ +struct omap_mux __initdata omap3_cbc_subset[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; + +/* +* Balls for CBC package +* 515-pin s-PBGA Package, 0.65mm Ball Pitch (Top), 0.50mm Ball Pitch (Bottom) +* +* FIXME: What's up with the outdated TI documentation? See: +* +* http://wiki.davincidsp.com/index.php/Datasheet_Errata_for_OMAP35x_CBC_Package +* http://community.ti.com/forums/t/10982.aspx +*/ +#ifdef CONFIG_DEBUG_FS +struct omap_ball __initdata omap3_cbc_ball[] = { + _OMAP3_BALLENTRY(CAM_D0, "ae16", NULL),[ snip ]
Quoted 12 lines
arch/arm/mach-omap2/mux34xx.c line 869
Quoted 9 lines
arch/arm/mach-omap2/mux34xx.c new file +9
-0+ { .reg_offset = OMAP_MUX_TERMINATOR }, +}; +#else +#define omap3_cbc_ball NULL +#endif + +/* +* Pins different on CUS package comapared to CBC package +*/ Maybe we'll just add the entire package rather than its difference to the CBC package?
IMHO it makes maintenance harder because of duplicating the data like I commented earlier. Currently the duplicate data would be for the 3 existing packages + whatever 36xx packages will be introduces.
<snip>
Quoted 6 lines
arch/arm/mach-omap2/mux34xx.c
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.c new file +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)What about adding defines for each possible mode configuration, except, perhaps, GPIO?
Yeah it would be nice to make it easy. How about someting like:
int __init omap_mux_init_by_name(char *name, int flags);
...
omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);
Quoted 5 lines
#define
OMAP3_PIN_CAM_D0OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)#define OMAP3_PIN_CAM_D0_CSI2_DX2 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE2 | \ OMAP_PIN_INPUT, 0)And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
And we could have also:
int __init omap_mux_init_by_gpio(int gpio, int flags);
...
omap_mux_init_by_gpio(99, OMAP_PIN_INPUT);
As the only thing we currently have for flags is the OMAP_MUX_DYNAMIC, we could mask that too into flags and make it int instead of u16.
Regards,
Tony
Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Mike Rapoport
Quoted 18 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>---
arch/arm/mach-omap2/Makefile | 4
arch/arm/mach-omap2/mux.h | 2arch/arm/mach-omap2/mux34xx.c| 1552 +++++++++++++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux34xx.h| 352 +++++++++4 files changed, 1910 insertions(+), 0 deletions(-)create mode 100644
arch/arm/mach-omap2/mux34xx.ccreate mode 100644arch/arm/mach-omap2/mux34xx.h
[ snip ]
Quoted 22 lines
Quoted 6 lines
arch/arm/mach-omap2/mux34xx.h line 352
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.h new file +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)What about adding defines for each possible mode configuration, except, perhaps, GPIO?
Yeah it would be nice to make it easy. How about someting like:
int
__initomap_mux_init_by_name(char *name, int flags);
...
omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);Quoted 5 lines
#define
OMAP3_PIN_CAM_D0OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)#defineOMAP3_PIN_CAM_D0_CSI2_DX2OMAP3_MUX(CAM_D0,OMAP_PIN_MODE2| \
OMAP_PIN_INPUT, 0)And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
And we could have also:
Quoted 7 lines
int
__initomap_mux_init_by_gpio(int gpio, int flags);
...
omap_mux_init_by_gpio(99, OMAP_PIN_INPUT);As the only thing we currently have for flags is the
OMAP_MUX_DYNAMIC, we could mask that too into flags and make it int instead of u16.
It seems we are thinking in really different directions :) You propose imporved and easy to use replacements of omap_cfg_reg while I'm aming nice tables descibing board pin configuration like, e.g, cm_x300_mfp_cfg in arch/arm/mach-pxa/cm-x300.c. Probably it's just too hard to me to break my PXA habbits, but I think such tables make the board code easier to write/maintain/understand.
Besides, having both simple aliases for OMAP3_MUX(mode0, mux_value, mux_flags) for dedicated pins does not contadict having omap_mux_init_by_{name,gpio} helpers.
Quoted 4 lines
Regards,
Tony
Signature · 6 lines
Sincerely Yours, Mike. -- 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
Tony Lindgren
maintainerRe: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Quoted 56 lines · Mike Rapoport
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Mike Rapoport
Quoted 18 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>---
arch/arm/mach-omap2/Makefile | 4
arch/arm/mach-omap2/mux.h | 2arch/arm/mach-omap2/mux34xx.c| 1552 +++++++++++++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux34xx.h| 352 +++++++++4 files changed, 1910 insertions(+), 0 deletions(-)create mode 100644
arch/arm/mach-omap2/mux34xx.ccreate mode 100644arch/arm/mach-omap2/mux34xx.h[ snip ]
Quoted 22 lines
Quoted 6 lines
arch/arm/mach-omap2/mux34xx.h line 352
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.h new file +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)What about adding defines for each possible mode configuration, except, perhaps, GPIO?
Yeah it would be nice to make it easy. How about someting like:
int
__initomap_mux_init_by_name(char *name, int flags);
...
omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);Quoted 5 lines
#define
OMAP3_PIN_CAM_D0OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)#defineOMAP3_PIN_CAM_D0_CSI2_DX2OMAP3_MUX(CAM_D0,OMAP_PIN_MODE2| \
OMAP_PIN_INPUT, 0)And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
And we could have also:
Quoted 7 lines
int
__initomap_mux_init_by_gpio(int gpio, int flags);
...
omap_mux_init_by_gpio(99, OMAP_PIN_INPUT);As the only thing we currently have for flags is the
OMAP_MUX_DYNAMIC, we could mask that too into flags and make it int instead of u16.
Quoted 9 lines
It seems we are thinking in really different directions :) You propose imporved and easy to use replacements of
omap_cfg_regwhile I'm aming nice tables descibing board pin configuration like, e.g,cm_x300_mfp_cfginarch/arm/mach-pxa/cm-x300.c. Probably it's just too hard to me to break my PXA habbits, but I think such tables make the board code easier to write/maintain/understand.
Besides, having both simple aliases forOMAP3_MUX(mode0, mux_value, mux_flags)for dedicated pins does not contadict having omap_mux_init_by_{name,gpio} helpers.
Agreed, we should make the pin muxing as easy as possible as it's probably the biggest hurdle to anybody to start making changes to a development board. And we should have easy to to read board specific pin configuration tables like you're suggesting.
In the long run, we should probably start using the real signal names as they seem to be more future proof across omaps than the register names.
We can easily do something like this if we add char *muxname to struct omap_board_mux (untested):
#define OMAP_MUX_SIGNAL(signal, mux_flags) \
{ \
.muxname = #signal, \
.flags = (mux_flags), \
}#define OMAP_MUX_GPIO(gpio, mux_flags) \
{ \
.muxname = gpio_##signal, \
.flags = (mux_flags), \
}#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
OMAP_MUX_SIGNAL(i2c1_scl, OMAP_PIN_INPUT),
OMAP_MUX_GPIO(98, OMAP_PIN_INPUT_PULLUP),
OMAP_MUX_GPIO(99, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_DYNAMIC),
{ .reg_offset = OMAP_MUX_TERMINATOR },
};#endif
Of course then we have to warn on potential duplicate signal names, but those can be specified using the register offset + mode as needed.
Is the above close enough to what you have in mind regarding the board specific mux tables, or do you have still something else in mind?
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
Tony Lindgren
maintainerPATCH 1/1 omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions (Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx)
Quoted 34 lines · Tony Lindgren
Quoted 33 lines · Mike Rapoport
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Mike Rapoport
Quoted 18 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>---
arch/arm/mach-omap2/Makefile | 4
arch/arm/mach-omap2/mux.h | 2arch/arm/mach-omap2/mux34xx.c| 1552 +++++++++++++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux34xx.h| 352 +++++++++4 files changed, 1910 insertions(+), 0 deletions(-)create mode 100644
arch/arm/mach-omap2/mux34xx.ccreate mode 100644arch/arm/mach-omap2/mux34xx.h[ snip ]
Quoted 7 lines
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)What about adding defines for each possible mode configuration, except, perhaps, GPIO?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Yeah it would be nice to make it easy. How about someting like:
int
__initomap_mux_init_by_name(char *name, int flags);
...
omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);
Here's an experimental patch to replace the omap_cfg_reg() calls for omap3. It at least seems to make the code more readable with the gpio numbers and signal names :)
The arch/arm/plat-omap/i2c.c muxing needs to be implemented under mach-omap2.
The functions are only stubs right now in the mux branch in the linux-omap tree, so that's only compile tested right now..
Will repost the whole series once things are working properly again.
Regards,
Tony
Quoted 1 line
From
763a5474f2c304e1cc8f3f8ce805c1bb84bafeceMon Sep 17 00:00:00 2001
From: Tony Lindgren <[email protected]>
Date: Tue, 3 Nov 2009 14:46:00 -0800
Subject: [PATCH] omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions
Replace omap_cfg_reg() with new style signal or gpio functions
arch/arm/mach-omap2/board-3430sdp.c +1 -1
@@ -482,7 +482,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
@@ -469,7 +469,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 );omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CUS ); }
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 ;
@@ -426,7 +426,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);
@@ -436,8 +436,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 );omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }
arch/arm/mach-omap2/board-omap3evm.c +2 -2
@@ -171,7 +171,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);
@@ -378,7 +378,7 @@ static void __init omap3_evm_init(void)#endif usb_musb_init ();/* Setup EHCI phy reset padconfig */ -omap_cfg_reg (AF4_34XX_GPIO135_OUT ); +omap_mux_init_gpio (135 ,OMAP_PIN_OUTPUT );usb_ehci_init (&ehci_pdata);ads7846_dev_init ();
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
@@ -420,8 +420,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 );omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }
arch/arm/mach-omap2/board-overo.c +2 -2
@@ -414,8 +414,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
@@ -31,6 +31,7 @@#include <plat/onenand.h> #include <plat/gpmc-smc91x.h> +#include "mux.h" #include "mmc-twl4030.h" #define SYSTEM_REV_B_USES_VAUX3 0x1699
@@ -521,9 +522,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
@@ -79,8 +79,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 );omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }
arch/arm/mach-omap2/devices.c +18 -16
@@ -27,6 +27,8 @@#include <mach/gpio.h> #include <plat/mmc.h> +#include "mux.h" +#if defined(CONFIG_VIDEO_OMAP2 ) || defined(CONFIG_VIDEO_OMAP2_MODULE ) static struct resource cam_resources[] = {
@@ -577,27 +579,27 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,if (cpu_is_omap3430 ()) {if (controller_nr ==0 ) { -omap_cfg_reg (N28_3430_MMC1_CLK ); -omap_cfg_reg (M27_3430_MMC1_CMD ); -omap_cfg_reg (N27_3430_MMC1_DAT0 ); +omap_mux_init_signal ("mmc1_clk" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_cmd" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat0" ,OMAP_PIN_INPUT_PULLUP );if (mmc_controller->slots[0 ].wires ==4 || mmc_controller->slots[0 ].wires ==8 ) { -omap_cfg_reg (N26_3430_MMC1_DAT1 ); -omap_cfg_reg (N25_3430_MMC1_DAT2 ); -omap_cfg_reg (P28_3430_MMC1_DAT3 ); +omap_mux_init_signal ("mmc1_dat1" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat2" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat3" ,OMAP_PIN_INPUT_PULLUP ); }if (mmc_controller->slots[0 ].wires ==8 ) { -omap_cfg_reg (P27_3430_MMC1_DAT4 ); -omap_cfg_reg (P26_3430_MMC1_DAT5 ); -omap_cfg_reg (R27_3430_MMC1_DAT6 ); -omap_cfg_reg (R25_3430_MMC1_DAT7 ); +omap_mux_init_signal ("mmc1_dat4" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat5" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat6" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc1_dat7" ,OMAP_PIN_INPUT_PULLUP ); } }if (controller_nr ==1 ) {/* MMC2 */ -omap_cfg_reg (AE2_3430_MMC2_CLK ); -omap_cfg_reg (AG5_3430_MMC2_CMD ); -omap_cfg_reg (AH5_3430_MMC2_DAT0 ); +omap_mux_init_signal ("mmc2_clk" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc2_cmd" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc2_dat0" ,OMAP_PIN_INPUT_PULLUP );/* * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
@@ -605,9 +607,9 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,*/ if (mmc_controller->slots[0 ].wires ==4 || mmc_controller->slots[0 ].wires ==8 ) { -omap_cfg_reg (AH4_3430_MMC2_DAT1 ); -omap_cfg_reg (AG4_3430_MMC2_DAT2 ); -omap_cfg_reg (AF4_3430_MMC2_DAT3 ); +omap_mux_init_signal ("mmc2_dat1" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc2_dat2" ,OMAP_PIN_INPUT_PULLUP ); +omap_mux_init_signal ("mmc2_dat3" ,OMAP_PIN_INPUT_PULLUP ); } }
arch/arm/mach-omap2/usb-ehci.c +62 -60
150 lines not on this page · raw message
Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
In reply to Tony LindgrenQuoted 94 lines · Tony Lindgren
Quoted 50 lines · Mike Rapoport
Quoted 21 lines · Tony Lindgren
Quoted 20 lines · Mike Rapoport
Quoted 18 lines · Tony Lindgren
Add 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 ifCONFIG_OMAP_MUXis not set. Also, the debug data gets optimized out ifCONFIG_DEBUG_FSis not set.Signed-off-by Tony Lindgren <[email protected]>--- arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/mux.h | 2 arch/arm/mach-omap2/mux34xx.c | 1552 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++++ 4 files changed, 1910 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/mux34xx.c create mode 100644 arch/arm/mach-omap2/mux34xx.h[ snip ]
Quoted 19 lines
Quoted 5 lines
arch/arm/mach-omap2/mux34xx.h line 352
Quoted 3 lines
arch/arm/mach-omap2/mux34xx.h new file +3
-0+ +#define OMAP3_CONTROL_PADCONF_MUX_SIZE \ + (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)What about adding defines for each possible mode configuration, except, perhaps, GPIO?
Yeah it would be nice to make it easy. How about someting like:
int
__initomap_mux_init_by_name(char *name, int flags);
...
omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);Quoted 5 lines
#define
OMAP3_PIN_CAM_D0OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)#define OMAP3_PIN_CAM_D0_CSI2_DX2 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE2 | \ OMAP_PIN_INPUT, 0)And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
And we could have also:
Quoted 7 lines
int
__initomap_mux_init_by_gpio(int gpio, int flags);
...
omap_mux_init_by_gpio(99, OMAP_PIN_INPUT);As the only thing we currently have for flags is the
OMAP_MUX_DYNAMIC, we could mask that too into flags and make it int instead of u16.Quoted 9 lines
It seems we are thinking in really different directions :) You propose imporved and easy to use replacements of
omap_cfg_regwhile I'm aming nice tables descibing board pin configuration like, e.g,cm_x300_mfp_cfginarch/arm/mach-pxa/cm-x300.c. Probably it's just too hard to me to break my PXA habbits, but I think such tables make the board code easier to write/maintain/understand.
Besides, having both simple aliases forOMAP3_MUX(mode0, mux_value, mux_flags)for dedicated pins does not contadict having omap_mux_init_by_{name,gpio} helpers.Agreed, we should make the pin muxing as easy as possible as it's probably the biggest hurdle to anybody to start making changes to a development board. And we should have easy to to read board specific pin configuration tables like you're suggesting.
In the long run, we should probably start using the real signal names as they seem to be more future proof across omaps than the register names.
We can easily do something like this if we add char *muxname to struct
omap_board_mux(untested):#define
OMAP_MUX_SIGNAL(signal, mux_flags)\{ \ .muxname = #signal, \ .flags = (mux_flags), \ }#define
OMAP_MUX_GPIO(gpio, mux_flags)\{ \ .muxname = gpio_##signal, \ .flags = (mux_flags), \ }#ifdef
CONFIG_OMAP_MUXstatic struct omap_board_mux board_mux[] __initdata = { OMAP_MUX_SIGNAL(i2c1_scl, OMAP_PIN_INPUT), OMAP_MUX_GPIO(98, OMAP_PIN_INPUT_PULLUP), OMAP_MUX_GPIO(99, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_DYNAMIC), { .reg_offset = OMAP_MUX_TERMINATOR }, };#endif
Quoted 7 lines
Of course then we have to warn on potential duplicate signal names, but those can be specified using the register offset + mode as needed.
Is the above close enough to what you have in mind regarding the board specific mux tables, or do you have still something else in mind?
It's closer :)
What I have in mind is a simple wrapper macro defining mux configuration for straightforward cases, just like a bunch of defines in arch/arm/mach-omap2/include/mach/mux34xx.h in my earlier patch [1]. And just use OMAP_MUX_SIGNAL, or OMAP3_MUX for more complicated cases where flags and/or OFF mode settings are required.
For instance, for making i2c1_scl to be actually routed to its pin you would have
static struct omap_board_mux board_mux[] __initdata = {
OMAP_MUX_I2C1_SCL,
... }
and for dss_pclk to became hw_dbg12 you have
static struct omap_board_mux board_mux[] __initdata = {
OMAP_MUX_PCLK_HW_DBG12,
...
}Another my point was, that each board-* file will have all the mux settings in one consolidated place. Indeed, currently there are no many uses of omap_cfg_reg in the board files, but think of crappy bootloaders that fail to configure half of the pins or cases when you delibarately want to setup mux configuration in kernel.
I agree, that having the macros I'm talking about is more or less "syntactic sugar" and I'm Ok to live without them :)
The most important that we don't need to add enumerated mux setting to arch/arm/*omap*/mux.[ch] for each pin that was not there and mux setup can completely defined by the board-* files.
[1] http://thread.gmane.org/gmane.linux.ports.arm.omap/25681
Quoted 5 lines
Regards,
Tony
Signature · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainerRe: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Hi,
Sorry for the delay, have not had a chance to work on this for a few days.
Quoted 8 lines · Mike Rapoport
Quoted 5 lines · Tony Lindgren
Quoted 4 lines · Mike Rapoport
Quoted 3 lines · Tony Lindgren
Quoted 2 lines · Mike Rapoport
Tony Lindgren wrote:
<snip snip>
Quoted 24 lines
Quoted 24 lines
We can easily do something like this if we add char *muxname to struct
omap_board_mux(untested):#define
OMAP_MUX_SIGNAL(signal, mux_flags)\{ \ .muxname = #signal, \ .flags = (mux_flags), \ }#define
OMAP_MUX_GPIO(gpio, mux_flags)\{ \ .muxname = gpio_##signal, \ .flags = (mux_flags), \ }#ifdef
CONFIG_OMAP_MUXstatic struct omap_board_mux board_mux[] __initdata = { OMAP_MUX_SIGNAL(i2c1_scl, OMAP_PIN_INPUT), OMAP_MUX_GPIO(98, OMAP_PIN_INPUT_PULLUP), OMAP_MUX_GPIO(99, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_DYNAMIC), { .reg_offset = OMAP_MUX_TERMINATOR }, };#endif
Quoted 3 lines
Quoted 3 lines
Of course then we have to warn on potential duplicate signal names, but those can be specified using the register offset + mode as needed.
Or use mode0_name.modeX_name for the full naming.
Quoted 5 lines
Quoted 3 lines
Is the above close enough to what you have in mind regarding the board specific mux tables, or do you have still something else in mind?
It's closer :)
OK, hopefully that means close to usable then :)
Quoted 12 lines
What I have in mind is a simple wrapper macro defining mux configuration for straightforward cases, just like a bunch of defines in
arch/arm/mach-omap2/include/mach/mux34xx.hin my earlier patch [1]. And just useOMAP_MUX_SIGNAL, orOMAP3_MUXfor more complicated cases where flags and/or OFF mode settings are required.
For instance, for makingi2c1_sclto be actually routed to its pin you would havestatic struct
omap_board_muxboard_mux[]__initdata= {
OMAP_MUX_I2C1_SCL,... }
Quoted 6 lines
and for
dss_pclkto becamehw_dbg12you havestatic struct omap_board_mux board_mux[] __initdata = { OMAP_MUX_PCLK_HW_DBG12, ... }
The more I've been thinking about it, I think we should move away from using the register offsets if we can use the signal names instead. A lot of the board init code can be done in a generic way then, and should work across various omaps better.
For example, see what setup_ehci_io_mux() becomes then:
switch (port_mode[0]) {
case EHCI_HCD_OMAP_MODE_PHY:
omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT);
omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT);
omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_nxt", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data0", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data1", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data2", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data3", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data4", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data5", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN);
omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN);
break;
...Of course, that does not mean that we should not allow muxing by using the register offsets especially for board specific custom devices. But it helps with the common platform init code for the integrated devices.
Quoted 5 lines
Another my point was, that each board-* file will have all the mux settings in one consolidated place. Indeed, currently there are no many uses of
omap_cfg_regin the board files, but think of crappy bootloaders that fail to configure half of the pins or cases when you delibarately want to setup mux configuration in kernel.
Agreed. We should do it in the board-*.c files because bootloaders do what they do. And for common integrated devices we can do it in the common platform init code based on the nr_lines like we do for MMC and USB already.
Quoted 2 lines
I agree, that having the macros I'm talking about is more or less "syntactic sugar" and I'm Ok to live without them :)
OK, let's see how it works once I get back to working on it..
Quoted 3 lines
The most important that we don't need to add enumerated mux setting to arch/arm/*omap*/mux.[ch] for each pin that was not there and mux setup can completely defined by the board-* files.
:)
Except we still have it for mach-omap1. The mux registers are scattered in multiple registers, so let's not mess with that right now.
Regards,
Tony
Quoted 3 lines
[1] http://thread.gmane.org/gmane.linux.ports.arm.omap/25681
Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Quoted 39 lines · Tony Lindgren
Hi,
Sorry for the delay, have not had a chance to work on this for a few days.
Quoted 6 lines · Mike Rapoport
Quoted 4 lines · Tony Lindgren
Quoted 3 lines · Mike Rapoport
Quoted 2 lines · Tony Lindgren
Quoted 1 line · Mike Rapoport
Tony Lindgren wrote:
<snip snip>
Quoted 24 lines
Quoted 24 lines
We can easily do something like this if we add char *muxname to struct
omap_board_mux(untested):#define
OMAP_MUX_SIGNAL(signal, mux_flags)\{ \ .muxname = #signal, \ .flags = (mux_flags), \ }#define
OMAP_MUX_GPIO(gpio, mux_flags)\{ \ .muxname = gpio_##signal, \ .flags = (mux_flags), \ }#ifdef
CONFIG_OMAP_MUXstatic struct omap_board_mux board_mux[] __initdata = { OMAP_MUX_SIGNAL(i2c1_scl, OMAP_PIN_INPUT), OMAP_MUX_GPIO(98, OMAP_PIN_INPUT_PULLUP), OMAP_MUX_GPIO(99, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_DYNAMIC), { .reg_offset = OMAP_MUX_TERMINATOR }, };#endif
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Of course then we have to warn on potential duplicate signal names, but those can be specified using the register offset + mode as needed.
Or use mode0_name.modeX_name for the full naming.
Agreed.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Is the above close enough to what you have in mind regarding the board specific mux tables, or do you have still something else in mind?
It's closer :)
OK, hopefully that means close to usable then :)
It became usable as soon as you don't have to patch common mux enumerations to add board specific mux settings :)
With mode0_name.modeX_name the mux setup code is slightly more complicated but once it's working adding new data both to SoC files and to the board files will be easy.
Quoted 62 lines
Quoted 12 lines
What I have in mind is a simple wrapper macro defining mux configuration for straightforward cases, just like a bunch of defines in
arch/arm/mach-omap2/include/mach/mux34xx.hin my earlier patch [1]. And just useOMAP_MUX_SIGNAL, orOMAP3_MUXfor more complicated cases where flags and/or OFF mode settings are required.
For instance, for makingi2c1_sclto be actually routed to its pin you would havestatic struct
omap_board_muxboard_mux[]__initdata= {
OMAP_MUX_I2C1_SCL,... }Quoted 6 lines
and for
dss_pclkto becamehw_dbg12you havestatic struct omap_board_mux board_mux[] __initdata = { OMAP_MUX_PCLK_HW_DBG12, ... }The more I've been thinking about it, I think we should move away from using the register offsets if we can use the signal names instead. A lot of the board init code can be done in a generic way then, and should work across various omaps better.
For example, see what
setup_ehci_io_mux()becomes then:switch (port_mode[0]) { case EHCI_HCD_OMAP_MODE_PHY: omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT); omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT); omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_nxt", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data0", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data1", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data2", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data3", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data4", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data5", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN); omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN); break; ...Of course, that does not mean that we should not allow muxing by using the register offsets especially for board specific custom devices. But it helps with the common platform init code for the integrated devices.
Quoted 5 lines
Another my point was, that each board-* file will have all the mux settings in one consolidated place. Indeed, currently there are no many uses of
omap_cfg_regin the board files, but think of crappy bootloaders that fail to configure half of the pins or cases when you delibarately want to setup mux configuration in kernel.Agreed. We should do it in the board-*.c files because bootloaders do what they do. And for common integrated devices we can do it in the common platform init code based on the
nr_lineslike we do for MMC and USB already.Quoted 2 lines
I agree, that having the macros I'm talking about is more or less "syntactic sugar" and I'm Ok to live without them :)
OK, let's see how it works once I get back to working on it..
Quoted 8 lines
Quoted 3 lines
The most important that we don't need to add enumerated mux setting to arch/arm/*omap*/mux.[ch] for each pin that was not there and mux setup can completely defined by the board-* files.
:)
Except we still have it for mach-omap1. The mux registers are scattered in multiple registers, so let's not mess with that right now.
I have nether HW nor docs for omap1 so I afraid I won't be much help here...
Quoted 7 lines
Regards,
Tony
Quoted 2 lines
[1] http://thread.gmane.org/gmane.linux.ports.arm.omap/25681
Signature · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainerPATCH 4/5 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
REVISIT: Check package type for each board CBB for now
REVISIT: Remove OMAP_MUX_ALL_DYNAMIC debug option
--- arch/arm/mach-omap2/board-3430sdp.c | 9 +++++++++ arch/arm/mach-omap2/board-cm-t35.c | 9 +++++++++ arch/arm/mach-omap2/board-ldp.c | 9 +++++++++ arch/arm/mach-omap2/board-omap3beagle.c | 9 +++++++++ arch/arm/mach-omap2/board-omap3evm.c | 9 +++++++++ arch/arm/mach-omap2/board-omap3pandora.c | 9 +++++++++ arch/arm/mach-omap2/board-overo.c | 8 ++++++++ arch/arm/mach-omap2/board-rx51.c | 10 ++++++++++ arch/arm/mach-omap2/board-zoom2.c | 8 ++++++++ 9 files changed, 80 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +9 -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"
@@ -496,6 +497,12 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap_3430sdp_init (void ) {omap3430_i2c_init ();
@@ -513,6 +520,8 @@ static void __init omap_3430sdp_init(void)board_smc91x_init ();enable_board_wakeup_source ();usb_ehci_init (&ehci_pdata); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap_3430sdp_map_io (void )
arch/arm/mach-omap2/board-cm-t35.c +9 -0
@@ -45,6 +45,7 @@#include <mach/hardware.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -451,6 +452,12 @@ static void __init cm_t35_map_io(void)omap2_map_common_io (); } +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init cm_t35_init (void ) {omap_serial_init ();
@@ -463,6 +470,8 @@ static void __init cm_t35_init(void)usb_musb_init ();omap_cfg_reg (AF26_34XX_SYS_NIRQ ); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }MACHINE_START (CM_T35 ,"Compulab CM-T35" )
arch/arm/mach-omap2/board-ldp.c +9 -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,6 +375,12 @@ static struct platform_device *ldp_devices[] __initdata = { &ldp_gpio_keys_device, }; +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap_ldp_init (void ) {omap_i2c_init ();
@@ -389,6 +396,8 @@ static void __init omap_ldp_init(void)twl4030_mmc_init (mmc);/* link regulators to MMC adapters */ ldp_vmmc1_supply.dev = mmc[0 ].dev; + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap_ldp_map_io (void )
arch/arm/mach-omap2/board-omap3beagle.c +9 -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
@@ -412,6 +413,12 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap3_beagle_init (void ) {omap3_beagle_i2c_init ();
@@ -431,6 +438,8 @@ static void __init omap3_beagle_init(void)/* Ensure SDRC pins are mux'd for self-refresh */ omap_cfg_reg (H16_34XX_SDRC_CKE0 );omap_cfg_reg (H17_34XX_SDRC_CKE1 ); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap3_beagle_map_io (void )
arch/arm/mach-omap2/board-omap3evm.c +9 -0
@@ -41,6 +41,7 @@#include <plat/common.h> #include <plat/mcspi.h> +#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "mmc-twl4030.h"
@@ -355,6 +356,12 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap3_evm_init (void ) {omap3_evm_i2c_init ();
@@ -374,6 +381,8 @@ static void __init omap3_evm_init(void)omap_cfg_reg (AF4_34XX_GPIO135_OUT );usb_ehci_init (&ehci_pdata);ads7846_dev_init (); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap3_evm_map_io (void )
arch/arm/mach-omap2/board-omap3pandora.c +9 -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"
@@ -399,6 +400,12 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap3pandora_init (void ) {omap3pandora_i2c_init ();
@@ -415,6 +422,8 @@ static void __init omap3pandora_init(void)/* Ensure SDRC pins are mux'd for self-refresh */ omap_cfg_reg (H16_34XX_SDRC_CKE0 );omap_cfg_reg (H17_34XX_SDRC_CKE1 ); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap3pandora_map_io (void )
arch/arm/mach-omap2/board-overo.c +8 -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"
@@ -395,6 +396,11 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif static void __init overo_init (void ) {
@@ -446,6 +452,8 @@ static void __init overo_init(void)else printk (KERN_ERR "could not obtain gpio for " "OVERO_GPIO_USBH_CPEN\n" ); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init overo_map_io (void )
arch/arm/mach-omap2/board-rx51.c +10 -0
@@ -30,6 +30,8 @@#include <plat/gpmc.h> #include <plat/usb.h> +#include "mux.h" +static struct omap_lcd_config rx51_lcd_config = { .ctrl_name ="internal" , };
@@ -64,6 +66,12 @@ 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[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init rx51_init (void ) {omap_serial_init ();
@@ -73,6 +81,8 @@ static void __init rx51_init(void)/* Ensure SDRC pins are mux'd for self-refresh */ omap_cfg_reg (H16_34XX_SDRC_CKE0 );omap_cfg_reg (H17_34XX_SDRC_CKE1 ); + +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init rx51_map_io (void )
arch/arm/mach-omap2/board-zoom2.c +8 -0
@@ -24,6 +24,7 @@#include <plat/common.h> #include <plat/usb.h> +#include "mux.h" #include "mmc-twl4030.h" #include "sdram-micron-mt46h32m32lf-6.h"
@@ -267,12 +268,19 @@ static int __init omap_i2c_init(void)extern int __init omap_zoom2_debugboard_init (void ); +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] = { + { .reg_offset =OMAP_MUX_TERMINATOR }, +}; +#endif +static void __init omap_zoom2_init (void ) {omap_i2c_init ();omap_serial_init ();omap_zoom2_debugboard_init ();usb_musb_init (); +omap3_mux_init (board_mux,OMAP_MUX_ALL_DYNAMIC |OMAP_PACKAGE_CBB ); }static void __init omap_zoom2_map_io (void )
Tony Lindgren
maintainerPATCH 5/5 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 | 143 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 143 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mux.c +143 -0
@@ -28,6 +28,9 @@#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 <asm/system.h>
@@ -780,6 +783,146 @@ static void __init omap_mux_apply_pins(struct omap_ball *b, } } +#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 ); + } + } + }else { + i++; + flags[i] ="OMAP_PIN_OFF_NONE" ; + } + +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 ); + } + } +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_show (struct seq_file *s,void *unused) +{ +struct omap_mux_entry *e; + +list_for_each_entry_reverse (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 &0x7 ; + +seq_printf (s,"OMAP%i_MUX(%s, " , +cpu_is_omap34xx () ?3 :0 , m0_def); +omap_mux_decode (s, val); +seq_printf (s,", 0),\n" ); + +seq_printf (s,"padconf: %s\tsignal: %s:\toffset: 0x%03x\t" +"value: 0x%04x\n" , + m->muxnames[0 ], m->muxnames[mode], m->reg_offset, val); +seq_printf (s,"m0: %-11s\tm1: %-10s\tm2: %-10s\tm3: %-10s\n" +"m4: %-10s\tm5: %-10s\tm6: %-10s\tm7: %-10s\n" , + m->muxnames[0 ] ? m->muxnames[0 ] :"" , + m->muxnames[1 ] ? m->muxnames[1 ] :"" , + m->muxnames[2 ] ? m->muxnames[2 ] :"" , + m->muxnames[3 ] ? m->muxnames[3 ] :"" , + m->muxnames[4 ] ? m->muxnames[4 ] :"" , + m->muxnames[5 ] ? m->muxnames[5 ] :"" , + m->muxnames[6 ] ? m->muxnames[6 ] :"" , + m->muxnames[7 ] ? m->muxnames[7 ] :"" ); +seq_printf (s,"phys: 0x%08lx\tball bottom: %s\t " +"ball top: %s\n\n" , +cpu_is_omap34xx () ? +OMAP3_CONTROL_PADCONF_MUX_PBASE + m->reg_offset :0 , + m->balls[0 ] ? m->balls[0 ] :"" , + m->balls[1 ] ? m->balls[1 ] :"" ); + } + +return 0 ; +} + +static int omap_mux_dbg_open (struct inode *inode,struct file *file) +{ +return single_open (file, omap_mux_dbg_show, &inode->i_private); +} + +static const struct file_operations omap_mux_dbg_fops = { + .open = omap_mux_dbg_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init omap_mux_dbg_init (void ) +{ + (void )debugfs_create_file ("omap_mux" ,S_IRUGO ,NULL ,NULL , + &omap_mux_dbg_fops); + +return 0 ; +} +late_initcall (omap_mux_dbg_init); +#else /* CONFIG_DEBUG_FS */ static inline void omap_mux_apply_pins(struct omap_ball *b,
Hi Tony,
Quoted 8 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.
Great work! I'm too sleepy now to make proper review, and I'm trying not to take work home, so I'll pull and test your patches only next week.
And, still, I'm missing PXA-style defines for particular pin configuration :) I really like
OMAP3_CAM_D0_GPIO_99,
more than
OMAP3_MUX(CAM_D0, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE |OMAP_MUX_MODE4, 0),
:)
Quoted 85 lines
To see the mux configuration on your board:
# mount -t debugfs debugfs /sys/kernel/debug # cat /sys/kernel/debug/omap_mux | less OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), padconf: cam_d0 signal: gpio_99: offset: 0x0e6 value: 0x4104 m0: cam_d0 m1: m2: m3: m4: gpio_99 m5: m6: m7: safe_mode phys: 0x48002116 ball bottom: ag17 ball top:
OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0),
padconf:cam_d10signal:safe_mode: offset:0x0favalue:0x0007
m0:cam_d10m1: m2: m3:
m4:gpio_109m5: m6: m7:safe_mode
phys:0x4800212aball bottom: b25 ball top:
...Then to produce a list of board mux entries from a working system, do:
# cat /sys/kernel/debug/omap_mux | grep OMAP3_MUX OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0), OMAP3_MUX(CAM_D11, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABL E | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D1, OMAP_PIN_INPUT | OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_NONE | O MAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), ...Currenly no write support to tweak the pins via debugfs, but I'll add that soon with command line support too.
I have not really verified the data yet, but it mostly looks right. Adding support for 3630 and omap4 should be easy after generating the data. It's currently implemented only for 34xx.
I guess the next step would be to convert all omap3 calls to
omap_cfg_reg()to useomap_mux_set()instead with the new data and make sure things work. Then we can remove the old data for 34xx.Comments welcome as always.
Regards,
Tony
---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (4):
omap: mux: Add debugfs support for new mux code
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style pin multiplexing code for omap3arch/arm/mach-omap2/Makefile | 4
arch/arm/mach-omap2/board-3430sdp.c | 9
arch/arm/mach-omap2/board-cm-t35.c | 9
arch/arm/mach-omap2/board-ldp.c | 9
arch/arm/mach-omap2/board-omap3beagle.c | 9
arch/arm/mach-omap2/board-omap3evm.c | 9
arch/arm/mach-omap2/board-omap3pandora.c | 9arch/arm/mach-omap2/board-overo.c | 8 arch/arm/mach-omap2/board-rx51.c | 10 arch/arm/mach-omap2/board-zoom2.c | 8arch/arm/mach-omap2/mux.c | 424 ++++++++
arch/arm/mach-omap2/mux.h| 127 ++arch/arm/mach-omap2/mux34xx.c| 1552 ++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux34xx.h| 352 +++++++14 files changed, 2533 insertions(+), 6 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.h--
Signature
Signature · 6 lines
Sincerely Yours, Mike. -- 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
Tony Lindgren
maintainerQuoted 8 lines · Mike Rapoport
Hi Tony,
Quoted 5 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
Quoted 7 lines
Quoted 3 lines
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.Great work! I'm too sleepy now to make proper review, and I'm trying not to take work home, so I'll pull and test your patches only next week.
OK, I guess what we now need to figure out if can we just convert all omap_cfg_reg() straight to omap_mux_set().
Quoted 7 lines
And, still, I'm missing PXA-style defines for particular pin configuration :) I really like
OMAP3_CAM_D0_GPIO_99,more than
OMAP3_MUX(CAM_D0,OMAP_PIN_OUTPUT|OMAP_PIN_OFF_NONE|OMAP_MUX_MODE4, 0),
:)
Yeah too many options.. Maybe we could have some macro like OMAP_MUX_GPIO_OUT(99)? We should be able to find it now with the gpio number during init, don't know if we want to keep all the gpio to mux mappings in memory except for active gpio pins.
Regards,
Tony
Quoted 83 lines
Quoted 83 lines
To see the mux configuration on your board:
# mount -t debugfs debugfs /sys/kernel/debug # cat /sys/kernel/debug/omap_mux | less OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), padconf: cam_d0 signal: gpio_99: offset: 0x0e6 value: 0x4104 m0: cam_d0 m1: m2: m3: m4: gpio_99 m5: m6: m7: safe_mode phys: 0x48002116 ball bottom: ag17 ball top:
OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0),
padconf:cam_d10signal:safe_mode: offset:0x0favalue:0x0007
m0:cam_d10m1: m2: m3:
m4:gpio_109m5: m6: m7:safe_mode
phys:0x4800212aball bottom: b25 ball top:
...Then to produce a list of board mux entries from a working system, do:
# cat /sys/kernel/debug/omap_mux | grep OMAP3_MUX OMAP3_MUX(CAM_D0, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D10, OMAP_PIN_OUTPUT | OMAP_PIN_OFF_NONE | OMAP_MUX_MODE7, 0), OMAP3_MUX(CAM_D11, OMAP_PIN_INPUT | OMAP_PIN_OFF_NONE | OMAP_PIN_OFF_WAKEUPENABL E | OMAP_MUX_MODE4, 0), OMAP3_MUX(CAM_D1, OMAP_PIN_INPUT | OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_NONE | O MAP_PIN_OFF_WAKEUPENABLE | OMAP_MUX_MODE4, 0), ...Currenly no write support to tweak the pins via debugfs, but I'll add that soon with command line support too.
I have not really verified the data yet, but it mostly looks right. Adding support for 3630 and omap4 should be easy after generating the data. It's currently implemented only for 34xx.
I guess the next step would be to convert all omap3 calls to
omap_cfg_reg()to useomap_mux_set()instead with the new data and make sure things work. Then we can remove the old data for 34xx.Comments welcome as always.
Regards,
Tony
---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (4):
omap: mux: Add debugfs support for new mux code
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style pin multiplexing code for omap3arch/arm/mach-omap2/Makefile | 4
arch/arm/mach-omap2/board-3430sdp.c | 9
arch/arm/mach-omap2/board-cm-t35.c | 9
arch/arm/mach-omap2/board-ldp.c | 9
arch/arm/mach-omap2/board-omap3beagle.c | 9
arch/arm/mach-omap2/board-omap3evm.c | 9
arch/arm/mach-omap2/board-omap3pandora.c | 9arch/arm/mach-omap2/board-overo.c | 8 arch/arm/mach-omap2/board-rx51.c | 10 arch/arm/mach-omap2/board-zoom2.c | 8arch/arm/mach-omap2/mux.c | 424 ++++++++
arch/arm/mach-omap2/mux.h| 127 ++arch/arm/mach-omap2/mux34xx.c| 1552 ++++++++++++++++++++++++++++++arch/arm/mach-omap2/mux34xx.h| 352 +++++++14 files changed, 2533 insertions(+), 6 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.h
Quoted 9 lines
Quoted 3 lines
--
SignatureSignature · 2 lines
Sincerely Yours, Mike.
--
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
Hi Tony,
Quoted 4 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
I've tried your patches, they seem to work just fine on CM-T35.
Quoted 3 lines
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.
[ snip ]
Quoted 2 lines
Comments welcome as always.
There are some comments on patches 2 (Add new style pin multiplexing code for omap3) and 3 (Add new style pin multiplexing data for 34xx). No nitpicking for now, but checkpatch.pl is unhappy with the patchset :)
Quoted 36 lines
Regards,
Tony
---
Mike Rapoport (1):
omap2: mux: intoduce omap_mux_{read,write}Tony Lindgren (4):
omap: mux: Add debugfs support for new mux code
omap: mux: Add new style init functions to omap3 board-*.c files
omap: mux: Add new style pin multiplexing data for 34xx
omap: mux: Add new style pin multiplexing code for omap3arch/arm/mach-omap2/Makefile | 4 arch/arm/mach-omap2/board-3430sdp.c | 9 arch/arm/mach-omap2/board-cm-t35.c | 9 arch/arm/mach-omap2/board-ldp.c | 9 arch/arm/mach-omap2/board-omap3beagle.c | 9 arch/arm/mach-omap2/board-omap3evm.c | 9 arch/arm/mach-omap2/board-omap3pandora.c | 9 arch/arm/mach-omap2/board-overo.c | 8 arch/arm/mach-omap2/board-rx51.c | 10 arch/arm/mach-omap2/board-zoom2.c | 8 arch/arm/mach-omap2/mux.c | 424 ++++++++ arch/arm/mach-omap2/mux.h | 127 ++ arch/arm/mach-omap2/mux34xx.c | 1552 ++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux34xx.h | 352 +++++++ 14 files changed, 2533 insertions(+), 6 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 · 2 lines
Sincerely yours, Mike.
Tony Lindgren
maintainerQuoted 9 lines · Mike Rapoport
Hi Tony,
Quoted 4 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
I've tried your patches, they seem to work just fine on CM-T35.
OK cool.
Quoted 4 lines
Quoted 3 lines
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.
Quoted 8 lines
[ snip ]
Quoted 2 lines
Comments welcome as always.
There are some comments on patches 2 (Add new style pin multiplexing code for omap3) and 3 (Add new style pin multiplexing data for 34xx). No nitpicking for now, but checkpatch.pl is unhappy with the patchset :)
OK, will run checkpatch.pl --strict on them. Thanks for the comments!
Regards,
Tony
Quoted 20 lines · Tony Lindgren
Quoted 9 lines · Mike Rapoport
Hi Tony,
Quoted 4 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
I've tried your patches, they seem to work just fine on CM-T35.
OK cool.
Quoted 7 lines
Quoted 3 lines
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.[ snip ]
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Comments welcome as always.
There are some comments on patches 2 (Add new style pin multiplexing code for omap3) and 3 (Add new style pin multiplexing data for 34xx). No nitpicking for now, but checkpatch.pl is unhappy with the patchset :)
OK, will run checkpatch.pl --strict on them. Thanks for the comments!
While on it, can you please update board-cm-t35.c to use CUS package?
Quoted 4 lines
Regards,
Tony
Signature · 2 lines
Sincerely Yours, Mike.
Tony Lindgren
maintainerQuoted 23 lines · Mike Rapoport
Quoted 22 lines · Tony Lindgren
Quoted 9 lines · Mike Rapoport
Hi Tony,
Quoted 4 lines · Tony Lindgren
Hi all,
Here's an initial version of the new mux code to play with. Big thanks to Paul & Benoit for the 34xx mux data!
I've tried your patches, they seem to work just fine on CM-T35.
OK cool.
Quoted 9 lines
Quoted 3 lines
To try out the new code, compile a kernel with
CONFIG_OMAP_MUXandCONFIG_DEBUG_FSand these patches. The series is also availabe in the l-o git in mux branch.[ snip ]
Quoted 2 lines
Comments welcome as always.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
There are some comments on patches 2 (Add new style pin multiplexing code for omap3) and 3 (Add new style pin multiplexing data for 34xx). No nitpicking for now, but checkpatch.pl is unhappy with the patchset :)
OK, will run checkpatch.pl --strict on them. Thanks for the comments!
While on it, can you please update
board-cm-t35.cto use CUS package?
OK, will do.
FYI, currently working on converting the old style omap_cfg_reg() calls so we can remove the old code for 34xx. It will be probably few days before I get around posting updated patches because of some meetings over next few days.
Regards,
Tony