aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-01-19 18:15:24 -0500
committerTony Lindgren <tony@atomide.com>2010-01-19 21:17:35 -0500
commitd4bb72e50a0c4b6790dec127a38fd06d06e561cc (patch)
tree6c25baeb406cfdab554aa7c826f952004d801287 /arch/arm/mach-omap2
parent2cb0c54f3a696351b81e6670f8419120c94b5e0b (diff)
omap: Fix functions for dynamic remuxing of pins
Make the omap_mux_read and write available for board code, and rename omap_mux_set_board_signals into omap_mux_write_array. Also add the related prototypes and comments into mux.h. In some cases we want to change the signals dynamically, mostly for power management. Note that we cannot use the signal names as they are set __init to save memory. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/mux.c22
-rw-r--r--arch/arm/mach-omap2/mux.h24
2 files changed, 35 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 40ea9fd4211d..3f59bd12cbbf 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -51,7 +51,7 @@ struct omap_mux_entry {
51static unsigned long mux_phys; 51static unsigned long mux_phys;
52static void __iomem *mux_base; 52static void __iomem *mux_base;
53 53
54static inline u16 omap_mux_read(u16 reg) 54u16 omap_mux_read(u16 reg)
55{ 55{
56 if (cpu_is_omap24xx()) 56 if (cpu_is_omap24xx())
57 return __raw_readb(mux_base + reg); 57 return __raw_readb(mux_base + reg);
@@ -59,7 +59,7 @@ static inline u16 omap_mux_read(u16 reg)
59 return __raw_readw(mux_base + reg); 59 return __raw_readw(mux_base + reg);
60} 60}
61 61
62static inline void omap_mux_write(u16 val, u16 reg) 62void omap_mux_write(u16 val, u16 reg)
63{ 63{
64 if (cpu_is_omap24xx()) 64 if (cpu_is_omap24xx())
65 __raw_writeb(val, mux_base + reg); 65 __raw_writeb(val, mux_base + reg);
@@ -67,6 +67,14 @@ static inline void omap_mux_write(u16 val, u16 reg)
67 __raw_writew(val, mux_base + reg); 67 __raw_writew(val, mux_base + reg);
68} 68}
69 69
70void omap_mux_write_array(struct omap_board_mux *board_mux)
71{
72 while (board_mux->reg_offset != OMAP_MUX_TERMINATOR) {
73 omap_mux_write(board_mux->value, board_mux->reg_offset);
74 board_mux++;
75 }
76}
77
70#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_OMAP_MUX) 78#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_OMAP_MUX)
71 79
72static struct omap_mux_cfg arch_mux_cfg; 80static struct omap_mux_cfg arch_mux_cfg;
@@ -833,14 +841,6 @@ static void __init omap_mux_set_cmdline_signals(void)
833 kfree(options); 841 kfree(options);
834} 842}
835 843
836static void __init omap_mux_set_board_signals(struct omap_board_mux *board_mux)
837{
838 while (board_mux->reg_offset != OMAP_MUX_TERMINATOR) {
839 omap_mux_write(board_mux->value, board_mux->reg_offset);
840 board_mux++;
841 }
842}
843
844static int __init omap_mux_copy_names(struct omap_mux *src, 844static int __init omap_mux_copy_names(struct omap_mux *src,
845 struct omap_mux *dst) 845 struct omap_mux *dst)
846{ 846{
@@ -1004,7 +1004,7 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size,
1004 1004
1005#ifdef CONFIG_OMAP_MUX 1005#ifdef CONFIG_OMAP_MUX
1006 omap_mux_set_cmdline_signals(); 1006 omap_mux_set_cmdline_signals();
1007 omap_mux_set_board_signals(board_mux); 1007 omap_mux_write_array(board_mux);
1008#endif 1008#endif
1009 1009
1010 return 0; 1010 return 0;
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index d8b4d5ad2278..f8c2e7a8f063 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -147,6 +147,30 @@ u16 omap_mux_get_gpio(int gpio);
147void omap_mux_set_gpio(u16 val, int gpio); 147void omap_mux_set_gpio(u16 val, int gpio);
148 148
149/** 149/**
150 * omap_mux_read() - read mux register
151 * @mux_offset: Offset of the mux register
152 *
153 */
154u16 omap_mux_read(u16 mux_offset);
155
156/**
157 * omap_mux_write() - write mux register
158 * @val: New mux register value
159 * @mux_offset: Offset of the mux register
160 *
161 * This should be only needed for dynamic remuxing of non-gpio signals.
162 */
163void omap_mux_write(u16 val, u16 mux_offset);
164
165/**
166 * omap_mux_write_array() - write an array of mux registers
167 * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR
168 *
169 * This should be only needed for dynamic remuxing of non-gpio signals.
170 */
171void omap_mux_write_array(struct omap_board_mux *board_mux);
172
173/**
150 * omap3_mux_init() - initialize mux system with board specific set 174 * omap3_mux_init() - initialize mux system with board specific set
151 * @board_mux: Board specific mux table 175 * @board_mux: Board specific mux table
152 * @flags: OMAP package type used for the board 176 * @flags: OMAP package type used for the board