Commit ef754d635820102ec7719486d40ede3c94ba44c8
Committed by
Sascha Hauer
1 parent
35c82da0bf
Exists in
master
and in
39 other branches
mx31: remove gpio_request calls from iomux code
Since iomux code is not directly related to gpio on mx31, the calls to gpio_request are removed from iomux.c file. These calls have to be done in platform initialization files. The name of the singe pin call for iomux is also changed to mxc_iomux_alloc_pin. Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Showing 2 changed files with 7 additions and 20 deletions Side-by-side Diff
arch/arm/mach-mx3/iomux.c
... | ... | @@ -21,7 +21,6 @@ |
21 | 21 | #include <linux/module.h> |
22 | 22 | #include <linux/spinlock.h> |
23 | 23 | #include <linux/io.h> |
24 | -#include <linux/gpio.h> | |
25 | 24 | #include <linux/kernel.h> |
26 | 25 | #include <mach/hardware.h> |
27 | 26 | #include <mach/gpio.h> |
28 | 27 | |
29 | 28 | |
30 | 29 | |
... | ... | @@ -94,15 +93,13 @@ |
94 | 93 | EXPORT_SYMBOL(mxc_iomux_set_pad); |
95 | 94 | |
96 | 95 | /* |
97 | - * setups a single pin: | |
96 | + * allocs a single pin: | |
98 | 97 | * - reserves the pin so that it is not claimed by another driver |
99 | 98 | * - setups the iomux according to the configuration |
100 | - * - if the pin is configured as a GPIO, we claim it through kernel gpiolib | |
101 | 99 | */ |
102 | -int mxc_iomux_setup_pin(const unsigned int pin, const char *label) | |
100 | +int mxc_iomux_alloc_pin(const unsigned int pin, const char *label) | |
103 | 101 | { |
104 | 102 | unsigned pad = pin & IOMUX_PADNUM_MASK; |
105 | - unsigned gpio; | |
106 | 103 | |
107 | 104 | if (pad >= (PIN_MAX + 1)) { |
108 | 105 | printk(KERN_ERR "mxc_iomux: Attempt to request nonexistant pin %u for \"%s\"\n", |
109 | 106 | |
110 | 107 | |
... | ... | @@ -113,19 +110,13 @@ |
113 | 110 | if (test_and_set_bit(pad, mxc_pin_alloc_map)) { |
114 | 111 | printk(KERN_ERR "mxc_iomux: pin %u already used. Allocation for \"%s\" failed\n", |
115 | 112 | pad, label ? label : "?"); |
116 | - return -EINVAL; | |
113 | + return -EBUSY; | |
117 | 114 | } |
118 | 115 | mxc_iomux_mode(pin); |
119 | 116 | |
120 | - /* if we have a gpio, we can allocate it */ | |
121 | - gpio = (pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT; | |
122 | - if (gpio < (GPIO_PORT_MAX + 1) * 32) | |
123 | - if (gpio_request(gpio, label)) | |
124 | - return -EINVAL; | |
125 | - | |
126 | 117 | return 0; |
127 | 118 | } |
128 | -EXPORT_SYMBOL(mxc_iomux_setup_pin); | |
119 | +EXPORT_SYMBOL(mxc_iomux_alloc_pin); | |
129 | 120 | |
130 | 121 | int mxc_iomux_setup_multiple_pins(unsigned int *pin_list, unsigned count, |
131 | 122 | const char *label) |
... | ... | @@ -135,7 +126,8 @@ |
135 | 126 | int ret = -EINVAL; |
136 | 127 | |
137 | 128 | for (i = 0; i < count; i++) { |
138 | - if (mxc_iomux_setup_pin(*p, label)) | |
129 | + ret = mxc_iomux_alloc_pin(*p, label); | |
130 | + if (ret) | |
139 | 131 | goto setup_error; |
140 | 132 | p++; |
141 | 133 | } |
142 | 134 | |
... | ... | @@ -150,14 +142,9 @@ |
150 | 142 | void mxc_iomux_release_pin(const unsigned int pin) |
151 | 143 | { |
152 | 144 | unsigned pad = pin & IOMUX_PADNUM_MASK; |
153 | - unsigned gpio; | |
154 | 145 | |
155 | 146 | if (pad < (PIN_MAX + 1)) |
156 | 147 | clear_bit(pad, mxc_pin_alloc_map); |
157 | - | |
158 | - gpio = (pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT; | |
159 | - if (gpio < (GPIO_PORT_MAX + 1) * 32) | |
160 | - gpio_free(gpio); | |
161 | 148 | } |
162 | 149 | EXPORT_SYMBOL(mxc_iomux_release_pin); |
163 | 150 |
arch/arm/plat-mxc/include/mach/iomux-mx3.h
... | ... | @@ -114,7 +114,7 @@ |
114 | 114 | * - setups the iomux according to the configuration |
115 | 115 | * - if the pin is configured as a GPIO, we claim it throug kernel gpiolib |
116 | 116 | */ |
117 | -int mxc_iomux_setup_pin(const unsigned int pin, const char *label); | |
117 | +int mxc_iomux_alloc_pin(const unsigned int pin, const char *label); | |
118 | 118 | /* |
119 | 119 | * setups mutliple pins |
120 | 120 | * convenient way to call the above function with tables |