diff options
Diffstat (limited to 'arch/arm/mach-omap2/mux.c')
-rw-r--r-- | arch/arm/mach-omap2/mux.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 459ef23ab8a8..5fedc50c58e4 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -51,7 +51,7 @@ struct omap_mux_entry { | |||
51 | static unsigned long mux_phys; | 51 | static unsigned long mux_phys; |
52 | static void __iomem *mux_base; | 52 | static void __iomem *mux_base; |
53 | 53 | ||
54 | static inline u16 omap_mux_read(u16 reg) | 54 | u16 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 | ||
62 | static inline void omap_mux_write(u16 val, u16 reg) | 62 | void 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 | ||
70 | void 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 | ||
72 | static struct omap_mux_cfg arch_mux_cfg; | 80 | static struct omap_mux_cfg arch_mux_cfg; |
@@ -478,7 +486,7 @@ int __init omap_mux_init_signal(char *muxname, int val) | |||
478 | static inline void omap_mux_decode(struct seq_file *s, u16 val) | 486 | static inline void omap_mux_decode(struct seq_file *s, u16 val) |
479 | { | 487 | { |
480 | char *flags[OMAP_MUX_MAX_NR_FLAGS]; | 488 | char *flags[OMAP_MUX_MAX_NR_FLAGS]; |
481 | char mode[14]; | 489 | char mode[sizeof("OMAP_MUX_MODE") + 1]; |
482 | int i = -1; | 490 | int i = -1; |
483 | 491 | ||
484 | sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7); | 492 | sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7); |
@@ -545,6 +553,7 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused) | |||
545 | if (!m0_name) | 553 | if (!m0_name) |
546 | continue; | 554 | continue; |
547 | 555 | ||
556 | /* REVISIT: Needs to be updated if mode0 names get longer */ | ||
548 | for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) { | 557 | for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) { |
549 | if (m0_name[i] == '\0') { | 558 | if (m0_name[i] == '\0') { |
550 | m0_def[i] = m0_name[i]; | 559 | m0_def[i] = m0_name[i]; |
@@ -833,14 +842,6 @@ static void __init omap_mux_set_cmdline_signals(void) | |||
833 | kfree(options); | 842 | kfree(options); |
834 | } | 843 | } |
835 | 844 | ||
836 | static 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 | |||
844 | static int __init omap_mux_copy_names(struct omap_mux *src, | 845 | static int __init omap_mux_copy_names(struct omap_mux *src, |
845 | struct omap_mux *dst) | 846 | struct omap_mux *dst) |
846 | { | 847 | { |
@@ -968,6 +969,13 @@ static void __init omap_mux_init_list(struct omap_mux *superset) | |||
968 | } | 969 | } |
969 | #endif | 970 | #endif |
970 | 971 | ||
972 | #if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) | ||
973 | if (!superset->muxnames || !superset->muxnames[0]) { | ||
974 | superset++; | ||
975 | continue; | ||
976 | } | ||
977 | #endif | ||
978 | |||
971 | entry = omap_mux_list_add(superset); | 979 | entry = omap_mux_list_add(superset); |
972 | if (!entry) { | 980 | if (!entry) { |
973 | printk(KERN_ERR "mux: Could not add entry\n"); | 981 | printk(KERN_ERR "mux: Could not add entry\n"); |
@@ -998,12 +1006,15 @@ int __init omap_mux_init(u32 mux_pbase, u32 mux_size, | |||
998 | omap_mux_package_fixup(package_subset, superset); | 1006 | omap_mux_package_fixup(package_subset, superset); |
999 | if (package_balls) | 1007 | if (package_balls) |
1000 | omap_mux_package_init_balls(package_balls, superset); | 1008 | omap_mux_package_init_balls(package_balls, superset); |
1001 | omap_mux_set_cmdline_signals(); | ||
1002 | omap_mux_set_board_signals(board_mux); | ||
1003 | #endif | 1009 | #endif |
1004 | 1010 | ||
1005 | omap_mux_init_list(superset); | 1011 | omap_mux_init_list(superset); |
1006 | 1012 | ||
1013 | #ifdef CONFIG_OMAP_MUX | ||
1014 | omap_mux_set_cmdline_signals(); | ||
1015 | omap_mux_write_array(board_mux); | ||
1016 | #endif | ||
1017 | |||
1007 | return 0; | 1018 | return 0; |
1008 | } | 1019 | } |
1009 | 1020 | ||