aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/mux.c21
-rw-r--r--arch/arm/mach-omap2/mux.c21
-rw-r--r--arch/arm/plat-omap/mux.c30
-rw-r--r--include/asm-arm/arch-omap/mux.h8
4 files changed, 60 insertions, 20 deletions
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 52c70e5fcf65..d74f6798d081 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -32,6 +32,8 @@
32 32
33#ifdef CONFIG_OMAP_MUX 33#ifdef CONFIG_OMAP_MUX
34 34
35static struct omap_mux_cfg arch_mux_cfg;
36
35#ifdef CONFIG_ARCH_OMAP730 37#ifdef CONFIG_ARCH_OMAP730
36struct pin_config __initdata_or_module omap730_pins[] = { 38struct pin_config __initdata_or_module omap730_pins[] = {
37MUX_CFG_730("E2_730_KBR0", 12, 21, 0, 20, 1, 0) 39MUX_CFG_730("E2_730_KBR0", 12, 21, 0, 20, 1, 0)
@@ -310,18 +312,31 @@ MUX_CFG("Y14_1610_CCP_DATAM", 9, 21, 6, 2, 3, 1, 2, 0, 0)
310}; 312};
311#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */ 313#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */
312 314
315int __init_or_module omap1_cfg_reg(const struct pin_config *cfg)
316{
317 return 0;
318}
319
313int __init omap1_mux_init(void) 320int __init omap1_mux_init(void)
314{ 321{
315 322
316#ifdef CONFIG_ARCH_OMAP730 323#ifdef CONFIG_ARCH_OMAP730
317 omap_mux_register(omap730_pins, ARRAY_SIZE(omap730_pins)); 324 if (cpu_is_omap730()) {
325 arch_mux_cfg.pins = omap730_pins;
326 arch_mux_cfg.size = ARRAY_SIZE(omap730_pins);
327 arch_mux_cfg.cfg_reg = omap1_cfg_reg;
328 }
318#endif 329#endif
319 330
320#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) 331#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
321 omap_mux_register(omap1xxx_pins, ARRAY_SIZE(omap1xxx_pins)); 332 if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
333 arch_mux_cfg.pins = omap1xxx_pins;
334 arch_mux_cfg.size = ARRAY_SIZE(omap1xxx_pins);
335 arch_mux_cfg.cfg_reg = omap1_cfg_reg;
336 }
322#endif 337#endif
323 338
324 return 0; 339 return omap_mux_register(&arch_mux_cfg);
325} 340}
326 341
327#endif 342#endif
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 05750975d746..351baab0503a 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -32,6 +32,8 @@
32 32
33#ifdef CONFIG_OMAP_MUX 33#ifdef CONFIG_OMAP_MUX
34 34
35static struct omap_mux_cfg arch_mux_cfg;
36
35/* NOTE: See mux.h for the enumeration */ 37/* NOTE: See mux.h for the enumeration */
36 38
37struct pin_config __initdata_or_module omap24xx_pins[] = { 39struct pin_config __initdata_or_module omap24xx_pins[] = {
@@ -169,10 +171,25 @@ MUX_CFG_24XX("B13_24XX_KBC6", 0x110, 3, 0, 0, 1)
169 171
170}; 172};
171 173
172int __init omap2_mux_init(void) 174#ifdef CONFIG_ARCH_OMAP24XX
175int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)
173{ 176{
174 omap_mux_register(omap24xx_pins, ARRAY_SIZE(omap24xx_pins));
175 return 0; 177 return 0;
176} 178}
179#endif
180
181int __init omap2_mux_init(void)
182{
183
184#ifdef CONFIG_ARCH_OMAP24XX
185 if (cpu_is_omap24xx()) {
186 arch_mux_cfg.pins = omap24xx_pins;
187 arch_mux_cfg.size = ARRAY_SIZE(omap24xx_pins);
188 arch_mux_cfg.cfg_reg = omap24xx_cfg_reg;
189 }
190#endif
191
192 return omap_mux_register(&arch_mux_cfg);
193}
177 194
178#endif 195#endif
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
39static struct pin_config * pin_table; 39static struct omap_mux_cfg *mux_cfg;
40static unsigned long pin_table_sz;
41 40
42extern struct pin_config * omap730_pins; 41int __init omap_mux_register(struct omap_mux_cfg *arch_mux_cfg)
43extern struct pin_config * omap1xxx_pins;
44extern struct pin_config * omap24xx_pins;
45
46int __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
diff --git a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
index b8fff50e6a87..0edc6ce91b33 100644
--- a/include/asm-arm/arch-omap/mux.h
+++ b/include/asm-arm/arch-omap/mux.h
@@ -559,11 +559,17 @@ enum omap24xx_index {
559 B13_24XX_KBC6, 559 B13_24XX_KBC6,
560}; 560};
561 561
562struct omap_mux_cfg {
563 struct pin_config *pins;
564 unsigned long size;
565 int (*cfg_reg)(const struct pin_config *cfg);
566};
567
562#ifdef CONFIG_OMAP_MUX 568#ifdef CONFIG_OMAP_MUX
563/* setup pin muxing in Linux */ 569/* setup pin muxing in Linux */
564extern int omap1_mux_init(void); 570extern int omap1_mux_init(void);
565extern int omap2_mux_init(void); 571extern int omap2_mux_init(void);
566extern int omap_mux_register(struct pin_config * pins, unsigned long size); 572extern int omap_mux_register(struct omap_mux_cfg *);
567extern int omap_cfg_reg(unsigned long reg_cfg); 573extern int omap_cfg_reg(unsigned long reg_cfg);
568#else 574#else
569/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */ 575/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */