21 #include <linux/module.h>
24 #include <linux/kernel.h>
25 #include <mach/hardware.h>
31 #define IOMUX_BASE MX31_IO_ADDRESS(MX31_IOMUXC_BASE_ADDR)
32 #define IOMUXINT_OBS1 (IOMUX_BASE + 0x000)
33 #define IOMUXINT_OBS2 (IOMUX_BASE + 0x004)
34 #define IOMUXGPR (IOMUX_BASE + 0x008)
35 #define IOMUXSW_MUX_CTL (IOMUX_BASE + 0x00C)
36 #define IOMUXSW_PAD_CTL (IOMUX_BASE + 0x154)
40 #define IOMUX_REG_MASK (IOMUX_PADNUM_MASK & ~0x3)
52 field = pin_mode & 0x3;
55 spin_lock(&gpio_mux_lock);
58 l &= ~(0xff << (field * 8));
59 l |= mode << (field * 8);
62 spin_unlock(&gpio_mux_lock);
78 field = (pin + 2) % 3;
80 pr_debug(
"%s: reg offset = 0x%x, field = %d\n",
81 __func__, (pin + 2) / 3, field);
83 spin_lock(&gpio_mux_lock);
86 l &= ~(0x1ff << (field * 10));
87 l |= config << (field * 10);
90 spin_unlock(&gpio_mux_lock);
104 printk(
KERN_ERR "mxc_iomux: Attempt to request nonexistant pin %u for \"%s\"\n",
105 pad, label ? label :
"?");
110 printk(
KERN_ERR "mxc_iomux: pin %u already used. Allocation for \"%s\" failed\n",
111 pad, label ? label :
"?");
123 const unsigned int *
p = pin_list;
127 for (i = 0; i <
count; i++) {
152 const unsigned int *
p = pin_list;
155 for (i = 0; i <
count; i++) {
170 spin_lock(&gpio_mux_lock);
178 spin_unlock(&gpio_mux_lock);