diff options
author | Tony Lindgren <tony@atomide.com> | 2008-01-25 03:42:48 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-04-14 12:57:11 -0400 |
commit | 7d7f665d5dac8d19f2fcb56baea09c59a3f861be (patch) | |
tree | 2fdfd5e07f0a258b64bb5921b982dbc8b1025444 /arch/arm/plat-omap | |
parent | 672e302e3c04e40e7c236cb09159f593f24f5def (diff) |
ARM: OMAP: Allow registering pin mux function
This patch changes pin multiplexing init to allow registering
custom function. The omap_cfg_reg() func will be split into
omap processor specific functions in later patch.
This is done to make adding omap3 pin multiplexing easier.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/mux.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c index 75211f20ccb3..d881379111e1 100644 --- a/arch/arm/plat-omap/mux.c +++ b/arch/arm/plat-omap/mux.c | |||
@@ -36,17 +36,17 @@ | |||
36 | #define OMAP24XX_PULL_ENA (1 << 3) | 36 | #define OMAP24XX_PULL_ENA (1 << 3) |
37 | #define OMAP24XX_PULL_UP (1 << 4) | 37 | #define OMAP24XX_PULL_UP (1 << 4) |
38 | 38 | ||
39 | static struct pin_config * pin_table; | 39 | static struct omap_mux_cfg *mux_cfg; |
40 | static unsigned long pin_table_sz; | ||
41 | 40 | ||
42 | extern struct pin_config * omap730_pins; | 41 | int __init omap_mux_register(struct omap_mux_cfg *arch_mux_cfg) |
43 | extern struct pin_config * omap1xxx_pins; | ||
44 | extern struct pin_config * omap24xx_pins; | ||
45 | |||
46 | int __init omap_mux_register(struct pin_config * pins, unsigned long size) | ||
47 | { | 42 | { |
48 | pin_table = pins; | 43 | if (!arch_mux_cfg || !arch_mux_cfg->pins || arch_mux_cfg->size == 0 |
49 | pin_table_sz = size; | 44 | || !arch_mux_cfg->cfg_reg) { |
45 | printk(KERN_ERR "Invalid pin table\n"); | ||
46 | return -EINVAL; | ||
47 | } | ||
48 | |||
49 | mux_cfg = arch_mux_cfg; | ||
50 | 50 | ||
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
@@ -64,17 +64,19 @@ int __init_or_module omap_cfg_reg(const unsigned long index) | |||
64 | pull_orig = 0, pull = 0; | 64 | pull_orig = 0, pull = 0; |
65 | unsigned int mask, warn = 0; | 65 | unsigned int mask, warn = 0; |
66 | 66 | ||
67 | if (!pin_table) | 67 | if (mux_cfg == NULL) { |
68 | BUG(); | 68 | printk(KERN_ERR "Pin mux table not initialized\n"); |
69 | return -ENODEV; | ||
70 | } | ||
69 | 71 | ||
70 | if (index >= pin_table_sz) { | 72 | if (index >= mux_cfg->size) { |
71 | printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n", | 73 | printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n", |
72 | index, pin_table_sz); | 74 | index, mux_cfg->size); |
73 | dump_stack(); | 75 | dump_stack(); |
74 | return -ENODEV; | 76 | return -ENODEV; |
75 | } | 77 | } |
76 | 78 | ||
77 | cfg = (struct pin_config *)&pin_table[index]; | 79 | cfg = (struct pin_config *)&mux_cfg->pins[index]; |
78 | if (cpu_is_omap24xx()) { | 80 | if (cpu_is_omap24xx()) { |
79 | u8 reg = 0; | 81 | u8 reg = 0; |
80 | 82 | ||