2 * linux/arch/arm/plat-omap/mux.c
4 * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h
6 * Copyright (C) 2003 - 2008 Nokia Corporation
8 * Written by Tony Lindgren
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/module.h>
26 #include <linux/init.h>
27 #include <linux/kernel.h>
29 #include <asm/system.h>
30 #include <linux/spinlock.h>
33 #ifdef CONFIG_OMAP_MUX
35 static struct omap_mux_cfg
*mux_cfg
;
37 int __init
omap_mux_register(struct omap_mux_cfg
*arch_mux_cfg
)
39 if (!arch_mux_cfg
|| !arch_mux_cfg
->pins
|| arch_mux_cfg
->size
== 0
40 || !arch_mux_cfg
->cfg_reg
) {
41 printk(KERN_ERR
"Invalid pin table\n");
45 mux_cfg
= arch_mux_cfg
;
51 * Sets the Omap MUX and PULL_DWN registers based on the table
53 int __init_or_module
omap_cfg_reg(const unsigned long index
)
55 struct pin_config
*reg
;
57 if (cpu_is_omap44xx())
60 if (mux_cfg
== NULL
) {
61 printk(KERN_ERR
"Pin mux table not initialized\n");
65 if (index
>= mux_cfg
->size
) {
66 printk(KERN_ERR
"Invalid pin mux index: %lu (%lu)\n",
67 index
, mux_cfg
->size
);
72 reg
= (struct pin_config
*)&mux_cfg
->pins
[index
];
74 if (!mux_cfg
->cfg_reg
)
77 return mux_cfg
->cfg_reg(reg
);
79 EXPORT_SYMBOL(omap_cfg_reg
);
81 #define omap_mux_init() do {} while(0)
82 #define omap_cfg_reg(x) do {} while(0)
83 #endif /* CONFIG_OMAP_MUX */