diff options
27 files changed, 398 insertions, 701 deletions
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index a8810f83a573..d54969be0a54 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -226,8 +226,6 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
226 | 226 | ||
227 | static void __init omap_2430sdp_init(void) | 227 | static void __init omap_2430sdp_init(void) |
228 | { | 228 | { |
229 | int ret; | ||
230 | |||
231 | omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC); | 229 | omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC); |
232 | 230 | ||
233 | omap_board_config = sdp2430_config; | 231 | omap_board_config = sdp2430_config; |
@@ -246,9 +244,8 @@ static void __init omap_2430sdp_init(void) | |||
246 | board_smc91x_init(); | 244 | board_smc91x_init(); |
247 | 245 | ||
248 | /* Turn off secondary LCD backlight */ | 246 | /* Turn off secondary LCD backlight */ |
249 | ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight"); | 247 | gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW, |
250 | if (ret == 0) | 248 | "Secondary LCD backlight"); |
251 | gpio_direction_output(SECONDARY_LCD_GPIO, 0); | ||
252 | } | 249 | } |
253 | 250 | ||
254 | static void __init omap_2430sdp_map_io(void) | 251 | static void __init omap_2430sdp_map_io(void) |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 951e5857ad31..99218a5299ca 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -126,8 +126,11 @@ static struct twl4030_keypad_data sdp3430_kp_data = { | |||
126 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 | 126 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 |
127 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 | 127 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 |
128 | 128 | ||
129 | static unsigned backlight_gpio; | 129 | static struct gpio sdp3430_dss_gpios[] __initdata = { |
130 | static unsigned enable_gpio; | 130 | {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" }, |
131 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, | ||
132 | }; | ||
133 | |||
131 | static int lcd_enabled; | 134 | static int lcd_enabled; |
132 | static int dvi_enabled; | 135 | static int dvi_enabled; |
133 | 136 | ||
@@ -135,29 +138,11 @@ static void __init sdp3430_display_init(void) | |||
135 | { | 138 | { |
136 | int r; | 139 | int r; |
137 | 140 | ||
138 | enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; | 141 | r = gpio_request_array(sdp3430_dss_gpios, |
139 | backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; | 142 | ARRAY_SIZE(sdp3430_dss_gpios)); |
140 | 143 | if (r) | |
141 | r = gpio_request(enable_gpio, "LCD reset"); | 144 | printk(KERN_ERR "failed to get LCD control GPIOs\n"); |
142 | if (r) { | ||
143 | printk(KERN_ERR "failed to get LCD reset GPIO\n"); | ||
144 | goto err0; | ||
145 | } | ||
146 | |||
147 | r = gpio_request(backlight_gpio, "LCD Backlight"); | ||
148 | if (r) { | ||
149 | printk(KERN_ERR "failed to get LCD backlight GPIO\n"); | ||
150 | goto err1; | ||
151 | } | ||
152 | |||
153 | gpio_direction_output(enable_gpio, 0); | ||
154 | gpio_direction_output(backlight_gpio, 0); | ||
155 | 145 | ||
156 | return; | ||
157 | err1: | ||
158 | gpio_free(enable_gpio); | ||
159 | err0: | ||
160 | return; | ||
161 | } | 146 | } |
162 | 147 | ||
163 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | 148 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) |
@@ -167,8 +152,8 @@ static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | |||
167 | return -EINVAL; | 152 | return -EINVAL; |
168 | } | 153 | } |
169 | 154 | ||
170 | gpio_direction_output(enable_gpio, 1); | 155 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); |
171 | gpio_direction_output(backlight_gpio, 1); | 156 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); |
172 | 157 | ||
173 | lcd_enabled = 1; | 158 | lcd_enabled = 1; |
174 | 159 | ||
@@ -179,8 +164,8 @@ static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
179 | { | 164 | { |
180 | lcd_enabled = 0; | 165 | lcd_enabled = 0; |
181 | 166 | ||
182 | gpio_direction_output(enable_gpio, 0); | 167 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); |
183 | gpio_direction_output(backlight_gpio, 0); | 168 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); |
184 | } | 169 | } |
185 | 170 | ||
186 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) | 171 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -308,12 +293,10 @@ static int sdp3430_twl_gpio_setup(struct device *dev, | |||
308 | omap2_hsmmc_init(mmc); | 293 | omap2_hsmmc_init(mmc); |
309 | 294 | ||
310 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ | 295 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ |
311 | gpio_request(gpio + 7, "sub_lcd_en_bkl"); | 296 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl"); |
312 | gpio_direction_output(gpio + 7, 0); | ||
313 | 297 | ||
314 | /* gpio + 15 is "sub_lcd_nRST" (output) */ | 298 | /* gpio + 15 is "sub_lcd_nRST" (output) */ |
315 | gpio_request(gpio + 15, "sub_lcd_nRST"); | 299 | gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST"); |
316 | gpio_direction_output(gpio + 15, 0); | ||
317 | 300 | ||
318 | return 0; | 301 | return 0; |
319 | } | 302 | } |
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 707354222d4c..ae3153c5396d 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -252,58 +252,22 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = { | |||
252 | }, | 252 | }, |
253 | }; | 253 | }; |
254 | 254 | ||
255 | static struct gpio sdp4430_eth_gpios[] __initdata = { | ||
256 | { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" }, | ||
257 | { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" }, | ||
258 | { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" }, | ||
259 | }; | ||
260 | |||
255 | static int omap_ethernet_init(void) | 261 | static int omap_ethernet_init(void) |
256 | { | 262 | { |
257 | int status; | 263 | int status; |
258 | 264 | ||
259 | /* Request of GPIO lines */ | 265 | /* Request of GPIO lines */ |
266 | status = gpio_request_array(sdp4430_eth_gpios, | ||
267 | ARRAY_SIZE(sdp4430_eth_gpios)); | ||
268 | if (status) | ||
269 | pr_err("Cannot request ETH GPIOs\n"); | ||
260 | 270 | ||
261 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); | ||
262 | if (status) { | ||
263 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); | ||
264 | return status; | ||
265 | } | ||
266 | |||
267 | status = gpio_request(ETH_KS8851_QUART, "quart"); | ||
268 | if (status) { | ||
269 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); | ||
270 | goto error1; | ||
271 | } | ||
272 | |||
273 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); | ||
274 | if (status) { | ||
275 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); | ||
276 | goto error2; | ||
277 | } | ||
278 | |||
279 | /* Configuration of requested GPIO lines */ | ||
280 | |||
281 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); | ||
282 | if (status) { | ||
283 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); | ||
284 | goto error3; | ||
285 | } | ||
286 | |||
287 | status = gpio_direction_output(ETH_KS8851_QUART, 1); | ||
288 | if (status) { | ||
289 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); | ||
290 | goto error3; | ||
291 | } | ||
292 | |||
293 | status = gpio_direction_input(ETH_KS8851_IRQ); | ||
294 | if (status) { | ||
295 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); | ||
296 | goto error3; | ||
297 | } | ||
298 | |||
299 | return 0; | ||
300 | |||
301 | error3: | ||
302 | gpio_free(ETH_KS8851_IRQ); | ||
303 | error2: | ||
304 | gpio_free(ETH_KS8851_QUART); | ||
305 | error1: | ||
306 | gpio_free(ETH_KS8851_POWER_ON); | ||
307 | return status; | 271 | return status; |
308 | } | 272 | } |
309 | 273 | ||
@@ -602,21 +566,13 @@ static int __init omap4_i2c_init(void) | |||
602 | 566 | ||
603 | static void __init omap_sfh7741prox_init(void) | 567 | static void __init omap_sfh7741prox_init(void) |
604 | { | 568 | { |
605 | int error; | 569 | int error; |
606 | 570 | ||
607 | error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); | 571 | error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO, |
608 | if (error < 0) { | 572 | GPIOF_OUT_INIT_LOW, "sfh7741"); |
573 | if (error < 0) | ||
609 | pr_err("%s:failed to request GPIO %d, error %d\n", | 574 | pr_err("%s:failed to request GPIO %d, error %d\n", |
610 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | 575 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); |
611 | return; | ||
612 | } | ||
613 | |||
614 | error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); | ||
615 | if (error < 0) { | ||
616 | pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n", | ||
617 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); | ||
618 | gpio_free(OMAP4_SFH7741_ENABLE_GPIO); | ||
619 | } | ||
620 | } | 576 | } |
621 | 577 | ||
622 | static void sdp4430_hdmi_mux_init(void) | 578 | static void sdp4430_hdmi_mux_init(void) |
@@ -633,27 +589,19 @@ static void sdp4430_hdmi_mux_init(void) | |||
633 | OMAP_PIN_INPUT_PULLUP); | 589 | OMAP_PIN_INPUT_PULLUP); |
634 | } | 590 | } |
635 | 591 | ||
592 | static struct gpio sdp4430_hdmi_gpios[] = { | ||
593 | { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, | ||
594 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, | ||
595 | }; | ||
596 | |||
636 | static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) | 597 | static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) |
637 | { | 598 | { |
638 | int status; | 599 | int status; |
639 | 600 | ||
640 | status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, | 601 | status = gpio_request_array(sdp4430_hdmi_gpios, |
641 | "hdmi_gpio_hpd"); | 602 | ARRAY_SIZE(sdp4430_hdmi_gpios)); |
642 | if (status) { | 603 | if (status) |
643 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); | 604 | pr_err("%s: Cannot request HDMI GPIOs\n", __func__); |
644 | return status; | ||
645 | } | ||
646 | status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, | ||
647 | "hdmi_gpio_ls_oe"); | ||
648 | if (status) { | ||
649 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); | ||
650 | goto error1; | ||
651 | } | ||
652 | |||
653 | return 0; | ||
654 | |||
655 | error1: | ||
656 | gpio_free(HDMI_GPIO_HPD); | ||
657 | 605 | ||
658 | return status; | 606 | return status; |
659 | } | 607 | } |
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c index a890d244fec6..5e438a77cd72 100644 --- a/arch/arm/mach-omap2/board-am3517crane.c +++ b/arch/arm/mach-omap2/board-am3517crane.c | |||
@@ -89,19 +89,13 @@ static void __init am3517_crane_init(void) | |||
89 | return; | 89 | return; |
90 | } | 90 | } |
91 | 91 | ||
92 | ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable"); | 92 | ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, |
93 | "usb_ehci_enable"); | ||
93 | if (ret < 0) { | 94 | if (ret < 0) { |
94 | pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); | 95 | pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); |
95 | return; | 96 | return; |
96 | } | 97 | } |
97 | 98 | ||
98 | ret = gpio_direction_output(GPIO_USB_POWER, 1); | ||
99 | if (ret < 0) { | ||
100 | gpio_free(GPIO_USB_POWER); | ||
101 | pr_err("Unable to initialize EHCI power\n"); | ||
102 | return; | ||
103 | } | ||
104 | |||
105 | usbhs_init(&usbhs_bdata); | 99 | usbhs_init(&usbhs_bdata); |
106 | } | 100 | } |
107 | 101 | ||
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index ce7d5e6e4150..6c4706038808 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -174,19 +174,14 @@ static void __init am3517_evm_rtc_init(void) | |||
174 | int r; | 174 | int r; |
175 | 175 | ||
176 | omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); | 176 | omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); |
177 | r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq"); | 177 | |
178 | r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq"); | ||
178 | if (r < 0) { | 179 | if (r < 0) { |
179 | printk(KERN_WARNING "failed to request GPIO#%d\n", | 180 | printk(KERN_WARNING "failed to request GPIO#%d\n", |
180 | GPIO_RTCS35390A_IRQ); | 181 | GPIO_RTCS35390A_IRQ); |
181 | return; | 182 | return; |
182 | } | 183 | } |
183 | r = gpio_direction_input(GPIO_RTCS35390A_IRQ); | 184 | |
184 | if (r < 0) { | ||
185 | printk(KERN_WARNING "GPIO#%d cannot be configured as input\n", | ||
186 | GPIO_RTCS35390A_IRQ); | ||
187 | gpio_free(GPIO_RTCS35390A_IRQ); | ||
188 | return; | ||
189 | } | ||
190 | am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); | 185 | am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); |
191 | } | 186 | } |
192 | 187 | ||
@@ -242,6 +237,15 @@ static int dvi_enabled; | |||
242 | 237 | ||
243 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | 238 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ |
244 | defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) | 239 | defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) |
240 | static struct gpio am3517_evm_dss_gpios[] __initdata = { | ||
241 | /* GPIO 182 = LCD Backlight Power */ | ||
242 | { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" }, | ||
243 | /* GPIO 181 = LCD Panel PWM */ | ||
244 | { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, | ||
245 | /* GPIO 176 = LCD Panel Power enable pin */ | ||
246 | { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" }, | ||
247 | }; | ||
248 | |||
245 | static void __init am3517_evm_display_init(void) | 249 | static void __init am3517_evm_display_init(void) |
246 | { | 250 | { |
247 | int r; | 251 | int r; |
@@ -249,41 +253,15 @@ static void __init am3517_evm_display_init(void) | |||
249 | omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); | 253 | omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); |
250 | omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); | 254 | omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); |
251 | omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); | 255 | omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); |
252 | /* | 256 | |
253 | * Enable GPIO 182 = LCD Backlight Power | 257 | r = gpio_request_array(am3517_evm_dss_gpios, |
254 | */ | 258 | ARRAY_SIZE(am3517_evm_dss_gpios)); |
255 | r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr"); | ||
256 | if (r) { | 259 | if (r) { |
257 | printk(KERN_ERR "failed to get lcd_backlight_pwr\n"); | 260 | printk(KERN_ERR "failed to get DSS panel control GPIOs\n"); |
258 | return; | 261 | return; |
259 | } | 262 | } |
260 | gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1); | ||
261 | /* | ||
262 | * Enable GPIO 181 = LCD Panel PWM | ||
263 | */ | ||
264 | r = gpio_request(LCD_PANEL_PWM, "lcd_pwm"); | ||
265 | if (r) { | ||
266 | printk(KERN_ERR "failed to get lcd_pwm\n"); | ||
267 | goto err_1; | ||
268 | } | ||
269 | gpio_direction_output(LCD_PANEL_PWM, 1); | ||
270 | /* | ||
271 | * Enable GPIO 176 = LCD Panel Power enable pin | ||
272 | */ | ||
273 | r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr"); | ||
274 | if (r) { | ||
275 | printk(KERN_ERR "failed to get lcd_panel_pwr\n"); | ||
276 | goto err_2; | ||
277 | } | ||
278 | gpio_direction_output(LCD_PANEL_PWR, 1); | ||
279 | 263 | ||
280 | printk(KERN_INFO "Display initialized successfully\n"); | 264 | printk(KERN_INFO "Display initialized successfully\n"); |
281 | return; | ||
282 | |||
283 | err_2: | ||
284 | gpio_free(LCD_PANEL_PWM); | ||
285 | err_1: | ||
286 | gpio_free(LCD_PANEL_BKLIGHT_PWR); | ||
287 | } | 265 | } |
288 | #else | 266 | #else |
289 | static void __init am3517_evm_display_init(void) {} | 267 | static void __init am3517_evm_display_init(void) {} |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index f4f8374a0298..f3beb8eeef77 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -202,6 +202,7 @@ static inline void __init apollon_init_smc91x(void) | |||
202 | unsigned int rate; | 202 | unsigned int rate; |
203 | struct clk *gpmc_fck; | 203 | struct clk *gpmc_fck; |
204 | int eth_cs; | 204 | int eth_cs; |
205 | int err; | ||
205 | 206 | ||
206 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | 207 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ |
207 | if (IS_ERR(gpmc_fck)) { | 208 | if (IS_ERR(gpmc_fck)) { |
@@ -245,15 +246,13 @@ static inline void __init apollon_init_smc91x(void) | |||
245 | apollon_smc91x_resources[0].end = base + 0x30f; | 246 | apollon_smc91x_resources[0].end = base + 0x30f; |
246 | udelay(100); | 247 | udelay(100); |
247 | 248 | ||
248 | omap_mux_init_gpio(74, 0); | 249 | omap_mux_init_gpio(APOLLON_ETHR_GPIO_IRQ, 0); |
249 | if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) { | 250 | err = gpio_request_one(APOLLON_ETHR_GPIO_IRQ, GPIOF_IN, "SMC91x irq"); |
251 | if (err) { | ||
250 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 252 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
251 | APOLLON_ETHR_GPIO_IRQ); | 253 | APOLLON_ETHR_GPIO_IRQ); |
252 | gpmc_cs_free(APOLLON_ETH_CS); | 254 | gpmc_cs_free(APOLLON_ETH_CS); |
253 | goto out; | ||
254 | } | 255 | } |
255 | gpio_direction_input(APOLLON_ETHR_GPIO_IRQ); | ||
256 | |||
257 | out: | 256 | out: |
258 | clk_disable(gpmc_fck); | 257 | clk_disable(gpmc_fck); |
259 | clk_put(gpmc_fck); | 258 | clk_put(gpmc_fck); |
@@ -280,20 +279,19 @@ static void __init omap_apollon_init_early(void) | |||
280 | omap2_init_common_devices(NULL, NULL); | 279 | omap2_init_common_devices(NULL, NULL); |
281 | } | 280 | } |
282 | 281 | ||
282 | static struct gpio apollon_gpio_leds[] __initdata = { | ||
283 | { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */ | ||
284 | { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6 */ | ||
285 | { LED2_GPIO15, GPIOF_OUT_INIT_LOW, "LED2" }, /* LED2 - AA4 */ | ||
286 | }; | ||
287 | |||
283 | static void __init apollon_led_init(void) | 288 | static void __init apollon_led_init(void) |
284 | { | 289 | { |
285 | /* LED0 - AA10 */ | ||
286 | omap_mux_init_signal("vlynq_clk.gpio_13", 0); | 290 | omap_mux_init_signal("vlynq_clk.gpio_13", 0); |
287 | gpio_request(LED0_GPIO13, "LED0"); | ||
288 | gpio_direction_output(LED0_GPIO13, 0); | ||
289 | /* LED1 - AA6 */ | ||
290 | omap_mux_init_signal("vlynq_rx1.gpio_14", 0); | 291 | omap_mux_init_signal("vlynq_rx1.gpio_14", 0); |
291 | gpio_request(LED1_GPIO14, "LED1"); | ||
292 | gpio_direction_output(LED1_GPIO14, 0); | ||
293 | /* LED2 - AA4 */ | ||
294 | omap_mux_init_signal("vlynq_rx0.gpio_15", 0); | 292 | omap_mux_init_signal("vlynq_rx0.gpio_15", 0); |
295 | gpio_request(LED2_GPIO15, "LED2"); | 293 | |
296 | gpio_direction_output(LED2_GPIO15, 0); | 294 | gpio_request_array(apollon_gpio_leds, ARRAY_SIZE(apollon_gpio_leds)); |
297 | } | 295 | } |
298 | 296 | ||
299 | static void __init apollon_usb_init(void) | 297 | static void __init apollon_usb_init(void) |
@@ -301,8 +299,7 @@ static void __init apollon_usb_init(void) | |||
301 | /* USB device */ | 299 | /* USB device */ |
302 | /* DEVICE_SUSPEND */ | 300 | /* DEVICE_SUSPEND */ |
303 | omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); | 301 | omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); |
304 | gpio_request(12, "USB suspend"); | 302 | gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend"); |
305 | gpio_direction_output(12, 0); | ||
306 | omap2_usbfs_init(&apollon_usb_config); | 303 | omap2_usbfs_init(&apollon_usb_config); |
307 | } | 304 | } |
308 | 305 | ||
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index e0e2d4838003..6063be82b563 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -182,10 +182,6 @@ static inline void cm_t35_init_nand(void) {} | |||
182 | #define CM_T35_LCD_BL_GPIO 58 | 182 | #define CM_T35_LCD_BL_GPIO 58 |
183 | #define CM_T35_DVI_EN_GPIO 54 | 183 | #define CM_T35_DVI_EN_GPIO 54 |
184 | 184 | ||
185 | static int lcd_bl_gpio; | ||
186 | static int lcd_en_gpio; | ||
187 | static int dvi_en_gpio; | ||
188 | |||
189 | static int lcd_enabled; | 185 | static int lcd_enabled; |
190 | static int dvi_enabled; | 186 | static int dvi_enabled; |
191 | 187 | ||
@@ -196,8 +192,8 @@ static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev) | |||
196 | return -EINVAL; | 192 | return -EINVAL; |
197 | } | 193 | } |
198 | 194 | ||
199 | gpio_set_value(lcd_en_gpio, 1); | 195 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
200 | gpio_set_value(lcd_bl_gpio, 1); | 196 | gpio_set_value(CM_T35_LCD_BL_GPIO, 1); |
201 | 197 | ||
202 | lcd_enabled = 1; | 198 | lcd_enabled = 1; |
203 | 199 | ||
@@ -208,8 +204,8 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev) | |||
208 | { | 204 | { |
209 | lcd_enabled = 0; | 205 | lcd_enabled = 0; |
210 | 206 | ||
211 | gpio_set_value(lcd_bl_gpio, 0); | 207 | gpio_set_value(CM_T35_LCD_BL_GPIO, 0); |
212 | gpio_set_value(lcd_en_gpio, 0); | 208 | gpio_set_value(CM_T35_LCD_EN_GPIO, 0); |
213 | } | 209 | } |
214 | 210 | ||
215 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | 211 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -219,7 +215,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | |||
219 | return -EINVAL; | 215 | return -EINVAL; |
220 | } | 216 | } |
221 | 217 | ||
222 | gpio_set_value(dvi_en_gpio, 0); | 218 | gpio_set_value(CM_T35_DVI_EN_GPIO, 0); |
223 | dvi_enabled = 1; | 219 | dvi_enabled = 1; |
224 | 220 | ||
225 | return 0; | 221 | return 0; |
@@ -227,7 +223,7 @@ static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | |||
227 | 223 | ||
228 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) | 224 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) |
229 | { | 225 | { |
230 | gpio_set_value(dvi_en_gpio, 1); | 226 | gpio_set_value(CM_T35_DVI_EN_GPIO, 1); |
231 | dvi_enabled = 0; | 227 | dvi_enabled = 0; |
232 | } | 228 | } |
233 | 229 | ||
@@ -309,62 +305,38 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = { | |||
309 | }, | 305 | }, |
310 | }; | 306 | }; |
311 | 307 | ||
308 | static struct gpio cm_t35_dss_gpios[] __initdata = { | ||
309 | { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, | ||
310 | { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, | ||
311 | { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" }, | ||
312 | }; | ||
313 | |||
312 | static void __init cm_t35_init_display(void) | 314 | static void __init cm_t35_init_display(void) |
313 | { | 315 | { |
314 | int err; | 316 | int err; |
315 | 317 | ||
316 | lcd_en_gpio = CM_T35_LCD_EN_GPIO; | ||
317 | lcd_bl_gpio = CM_T35_LCD_BL_GPIO; | ||
318 | dvi_en_gpio = CM_T35_DVI_EN_GPIO; | ||
319 | |||
320 | spi_register_board_info(cm_t35_lcd_spi_board_info, | 318 | spi_register_board_info(cm_t35_lcd_spi_board_info, |
321 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); | 319 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); |
322 | 320 | ||
323 | err = gpio_request(lcd_en_gpio, "LCD RST"); | 321 | err = gpio_request_array(cm_t35_dss_gpios, |
324 | if (err) { | 322 | ARRAY_SIZE(cm_t35_dss_gpios)); |
325 | pr_err("CM-T35: failed to get LCD reset GPIO\n"); | ||
326 | goto out; | ||
327 | } | ||
328 | |||
329 | err = gpio_request(lcd_bl_gpio, "LCD BL"); | ||
330 | if (err) { | 323 | if (err) { |
331 | pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); | 324 | pr_err("CM-T35: failed to request DSS control GPIOs\n"); |
332 | goto err_lcd_bl; | 325 | return; |
333 | } | 326 | } |
334 | 327 | ||
335 | err = gpio_request(dvi_en_gpio, "DVI EN"); | 328 | gpio_export(CM_T35_LCD_EN_GPIO, 0); |
336 | if (err) { | 329 | gpio_export(CM_T35_LCD_BL_GPIO, 0); |
337 | pr_err("CM-T35: failed to get DVI reset GPIO\n"); | 330 | gpio_export(CM_T35_DVI_EN_GPIO, 0); |
338 | goto err_dvi_en; | ||
339 | } | ||
340 | |||
341 | gpio_export(lcd_en_gpio, 0); | ||
342 | gpio_export(lcd_bl_gpio, 0); | ||
343 | gpio_export(dvi_en_gpio, 0); | ||
344 | gpio_direction_output(lcd_en_gpio, 0); | ||
345 | gpio_direction_output(lcd_bl_gpio, 0); | ||
346 | gpio_direction_output(dvi_en_gpio, 1); | ||
347 | 331 | ||
348 | msleep(50); | 332 | msleep(50); |
349 | gpio_set_value(lcd_en_gpio, 1); | 333 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
350 | 334 | ||
351 | err = omap_display_init(&cm_t35_dss_data); | 335 | err = omap_display_init(&cm_t35_dss_data); |
352 | if (err) { | 336 | if (err) { |
353 | pr_err("CM-T35: failed to register DSS device\n"); | 337 | pr_err("CM-T35: failed to register DSS device\n"); |
354 | goto err_dev_reg; | 338 | gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios)); |
355 | } | 339 | } |
356 | |||
357 | return; | ||
358 | |||
359 | err_dev_reg: | ||
360 | gpio_free(dvi_en_gpio); | ||
361 | err_dvi_en: | ||
362 | gpio_free(lcd_bl_gpio); | ||
363 | err_lcd_bl: | ||
364 | gpio_free(lcd_en_gpio); | ||
365 | out: | ||
366 | |||
367 | return; | ||
368 | } | 340 | } |
369 | 341 | ||
370 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { | 342 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { |
@@ -497,10 +469,8 @@ static int cm_t35_twl_gpio_setup(struct device *dev, unsigned gpio, | |||
497 | { | 469 | { |
498 | int wlan_rst = gpio + 2; | 470 | int wlan_rst = gpio + 2; |
499 | 471 | ||
500 | if ((gpio_request(wlan_rst, "WLAN RST") == 0) && | 472 | if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) { |
501 | (gpio_direction_output(wlan_rst, 1) == 0)) { | ||
502 | gpio_export(wlan_rst, 0); | 473 | gpio_export(wlan_rst, 0); |
503 | |||
504 | udelay(10); | 474 | udelay(10); |
505 | gpio_set_value(wlan_rst, 0); | 475 | gpio_set_value(wlan_rst, 0); |
506 | udelay(10); | 476 | udelay(10); |
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c index a27e3eee8292..08f08e812492 100644 --- a/arch/arm/mach-omap2/board-cm-t3517.c +++ b/arch/arm/mach-omap2/board-cm-t3517.c | |||
@@ -148,14 +148,13 @@ static void __init cm_t3517_init_rtc(void) | |||
148 | { | 148 | { |
149 | int err; | 149 | int err; |
150 | 150 | ||
151 | err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en"); | 151 | err = gpio_request_one(RTC_CS_EN_GPIO, GPIOF_OUT_INIT_HIGH, |
152 | "rtc cs en"); | ||
152 | if (err) { | 153 | if (err) { |
153 | pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err); | 154 | pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err); |
154 | return; | 155 | return; |
155 | } | 156 | } |
156 | 157 | ||
157 | gpio_direction_output(RTC_CS_EN_GPIO, 1); | ||
158 | |||
159 | platform_device_register(&cm_t3517_rtc_device); | 158 | platform_device_register(&cm_t3517_rtc_device); |
160 | } | 159 | } |
161 | #else | 160 | #else |
@@ -182,11 +181,11 @@ static int cm_t3517_init_usbh(void) | |||
182 | { | 181 | { |
183 | int err; | 182 | int err; |
184 | 183 | ||
185 | err = gpio_request(USB_HUB_RESET_GPIO, "usb hub rst"); | 184 | err = gpio_request_one(USB_HUB_RESET_GPIO, GPIOF_OUT_INIT_LOW, |
185 | "usb hub rst"); | ||
186 | if (err) { | 186 | if (err) { |
187 | pr_err("CM-T3517: usb hub rst gpio request failed: %d\n", err); | 187 | pr_err("CM-T3517: usb hub rst gpio request failed: %d\n", err); |
188 | } else { | 188 | } else { |
189 | gpio_direction_output(USB_HUB_RESET_GPIO, 0); | ||
190 | udelay(10); | 189 | udelay(10); |
191 | gpio_set_value(USB_HUB_RESET_GPIO, 1); | 190 | gpio_set_value(USB_HUB_RESET_GPIO, 1); |
192 | msleep(1); | 191 | msleep(1); |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 405542af6caa..3bd344a527e2 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -242,7 +242,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
242 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ | 242 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ |
243 | devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; | 243 | devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; |
244 | ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, | 244 | ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, |
245 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); | 245 | GPIOF_OUT_INIT_LOW, "LCD_PWREN"); |
246 | if (ret < 0) { | 246 | if (ret < 0) { |
247 | devkit8000_lcd_device.reset_gpio = -EINVAL; | 247 | devkit8000_lcd_device.reset_gpio = -EINVAL; |
248 | printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); | 248 | printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); |
@@ -251,7 +251,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
251 | /* gpio + 7 is "DVI_PD" (out, active low) */ | 251 | /* gpio + 7 is "DVI_PD" (out, active low) */ |
252 | devkit8000_dvi_device.reset_gpio = gpio + 7; | 252 | devkit8000_dvi_device.reset_gpio = gpio + 7; |
253 | ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, | 253 | ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, |
254 | GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); | 254 | GPIOF_OUT_INIT_LOW, "DVI PowerDown"); |
255 | if (ret < 0) { | 255 | if (ret < 0) { |
256 | devkit8000_dvi_device.reset_gpio = -EINVAL; | 256 | devkit8000_dvi_device.reset_gpio = -EINVAL; |
257 | printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); | 257 | printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); |
@@ -483,14 +483,14 @@ static void __init omap_dm9000_init(void) | |||
483 | { | 483 | { |
484 | unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; | 484 | unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; |
485 | struct omap_die_id odi; | 485 | struct omap_die_id odi; |
486 | int ret; | ||
486 | 487 | ||
487 | if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { | 488 | ret = gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq"); |
489 | if (ret < 0) { | ||
488 | printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", | 490 | printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", |
489 | OMAP_DM9000_GPIO_IRQ); | 491 | OMAP_DM9000_GPIO_IRQ); |
490 | return; | 492 | return; |
491 | } | 493 | } |
492 | |||
493 | gpio_direction_input(OMAP_DM9000_GPIO_IRQ); | ||
494 | 494 | ||
495 | /* init the mac address using DIE id */ | 495 | /* init the mac address using DIE id */ |
496 | omap_get_die_id(&odi); | 496 | omap_get_die_id(&odi); |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 2c9a9197d2b2..c62c297e0a3d 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -78,22 +78,22 @@ static void __init igep2_get_revision(void) | |||
78 | 78 | ||
79 | omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); | 79 | omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); |
80 | 80 | ||
81 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && | 81 | if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) { |
82 | (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) { | ||
83 | ret = gpio_get_value(IGEP2_GPIO_LED1_RED); | ||
84 | if (ret == 0) { | ||
85 | pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); | ||
86 | hwrev = IGEP2_BOARD_HWREV_C; | ||
87 | } else if (ret == 1) { | ||
88 | pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); | ||
89 | hwrev = IGEP2_BOARD_HWREV_B; | ||
90 | } else { | ||
91 | pr_err("IGEP2: Unknown Hardware Revision\n"); | ||
92 | hwrev = -1; | ||
93 | } | ||
94 | } else { | ||
95 | pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); | 82 | pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); |
96 | pr_err("IGEP2: Unknown Hardware Revision\n"); | 83 | pr_err("IGEP2: Unknown Hardware Revision\n"); |
84 | return; | ||
85 | } | ||
86 | |||
87 | ret = gpio_get_value(IGEP2_GPIO_LED1_RED); | ||
88 | if (ret == 0) { | ||
89 | pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); | ||
90 | hwrev = IGEP2_BOARD_HWREV_C; | ||
91 | } else if (ret == 1) { | ||
92 | pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); | ||
93 | hwrev = IGEP2_BOARD_HWREV_B; | ||
94 | } else { | ||
95 | pr_err("IGEP2: Unknown Hardware Revision\n"); | ||
96 | hwrev = -1; | ||
97 | } | 97 | } |
98 | 98 | ||
99 | gpio_free(IGEP2_GPIO_LED1_RED); | 99 | gpio_free(IGEP2_GPIO_LED1_RED); |
@@ -339,32 +339,35 @@ static void __init igep2_leds_init(void) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | #else | 341 | #else |
342 | static struct gpio igep2_gpio_leds[] __initdata = { | ||
343 | { IGEP2_GPIO_LED0_RED, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" }, | ||
344 | { IGEP2_GPIO_LED0_GREEN, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" }, | ||
345 | { IGEP2_GPIO_LED1_RED, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" }, | ||
346 | }; | ||
347 | |||
342 | static inline void igep2_leds_init(void) | 348 | static inline void igep2_leds_init(void) |
343 | { | 349 | { |
344 | if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && | 350 | if (gpio_request_array(igep2_gpio_leds, ARRAY_SIZE(igep2_gpio_leds))) { |
345 | (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0)) | 351 | pr_warning("IGEP v2: Could not obtain leds gpios\n"); |
346 | gpio_export(IGEP2_GPIO_LED0_RED, 0); | 352 | return; |
347 | else | 353 | } |
348 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); | ||
349 | |||
350 | if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && | ||
351 | (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0)) | ||
352 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); | ||
353 | else | ||
354 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); | ||
355 | |||
356 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && | ||
357 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0)) | ||
358 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | ||
359 | else | ||
360 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); | ||
361 | 354 | ||
355 | gpio_export(IGEP2_GPIO_LED0_RED, 0); | ||
356 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); | ||
357 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | ||
362 | } | 358 | } |
363 | #endif | 359 | #endif |
364 | 360 | ||
361 | static struct gpio igep2_twl_gpios[] = { | ||
362 | { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" }, | ||
363 | { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" }, | ||
364 | }; | ||
365 | |||
365 | static int igep2_twl_gpio_setup(struct device *dev, | 366 | static int igep2_twl_gpio_setup(struct device *dev, |
366 | unsigned gpio, unsigned ngpio) | 367 | unsigned gpio, unsigned ngpio) |
367 | { | 368 | { |
369 | int ret; | ||
370 | |||
368 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 371 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
369 | mmc[0].gpio_cd = gpio + 0; | 372 | mmc[0].gpio_cd = gpio + 0; |
370 | omap2_hsmmc_init(mmc); | 373 | omap2_hsmmc_init(mmc); |
@@ -373,22 +376,20 @@ static int igep2_twl_gpio_setup(struct device *dev, | |||
373 | * REVISIT: need ehci-omap hooks for external VBUS | 376 | * REVISIT: need ehci-omap hooks for external VBUS |
374 | * power switch and overcurrent detect | 377 | * power switch and overcurrent detect |
375 | */ | 378 | */ |
376 | if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) || | 379 | igep2_twl_gpios[0].gpio = gpio + 1; |
377 | (gpio_direction_input(gpio + 1) < 0)) | ||
378 | pr_err("IGEP2: Could not obtain gpio for EHCI NOC"); | ||
379 | 380 | ||
380 | /* | 381 | /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */ |
381 | * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN | 382 | igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX; |
382 | * (out, active low) | 383 | |
383 | */ | 384 | ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios)); |
384 | if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) || | 385 | if (ret < 0) |
385 | (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) | ||
386 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); | 386 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); |
387 | 387 | ||
388 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | 388 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
389 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | 389 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) |
390 | if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) | 390 | ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, |
391 | && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) | 391 | "gpio-led:green:d1"); |
392 | if (ret == 0) | ||
392 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | 393 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); |
393 | else | 394 | else |
394 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); | 395 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); |
@@ -469,8 +470,9 @@ static struct regulator_init_data igep2_vpll2 = { | |||
469 | 470 | ||
470 | static void __init igep2_display_init(void) | 471 | static void __init igep2_display_init(void) |
471 | { | 472 | { |
472 | if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && | 473 | int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH, |
473 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) | 474 | "GPIO_DVI_PUP"); |
475 | if (err) | ||
474 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); | 476 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); |
475 | } | 477 | } |
476 | 478 | ||
@@ -577,44 +579,43 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
577 | #endif | 579 | #endif |
578 | 580 | ||
579 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) | 581 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) |
582 | static struct gpio igep2_wlan_bt_gpios[] __initdata = { | ||
583 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" }, | ||
584 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" }, | ||
585 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" }, | ||
586 | }; | ||
580 | 587 | ||
581 | static void __init igep2_wlan_bt_init(void) | 588 | static void __init igep2_wlan_bt_init(void) |
582 | { | 589 | { |
583 | unsigned npd, wreset, btreset; | 590 | int err; |
584 | 591 | ||
585 | /* GPIO's for WLAN-BT combo depends on hardware revision */ | 592 | /* GPIO's for WLAN-BT combo depends on hardware revision */ |
586 | if (hwrev == IGEP2_BOARD_HWREV_B) { | 593 | if (hwrev == IGEP2_BOARD_HWREV_B) { |
587 | npd = IGEP2_RB_GPIO_WIFI_NPD; | 594 | igep2_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD; |
588 | wreset = IGEP2_RB_GPIO_WIFI_NRESET; | 595 | igep2_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET; |
589 | btreset = IGEP2_RB_GPIO_BT_NRESET; | 596 | igep2_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET; |
590 | } else if (hwrev == IGEP2_BOARD_HWREV_C) { | 597 | } else if (hwrev == IGEP2_BOARD_HWREV_C) { |
591 | npd = IGEP2_RC_GPIO_WIFI_NPD; | 598 | igep2_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD; |
592 | wreset = IGEP2_RC_GPIO_WIFI_NRESET; | 599 | igep2_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET; |
593 | btreset = IGEP2_RC_GPIO_BT_NRESET; | 600 | igep2_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET; |
594 | } else | 601 | } else |
595 | return; | 602 | return; |
596 | 603 | ||
597 | /* Set GPIO's for WLAN-BT combo module */ | 604 | err = gpio_request_array(igep2_wlan_bt_gpios, |
598 | if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) && | 605 | ARRAY_SIZE(igep2_wlan_bt_gpios)); |
599 | (gpio_direction_output(npd, 1) == 0)) { | 606 | if (err) { |
600 | gpio_export(npd, 0); | 607 | pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n"); |
601 | } else | 608 | return; |
602 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n"); | 609 | } |
603 | 610 | ||
604 | if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) && | 611 | gpio_export(igep2_wlan_bt_gpios[0].gpio, 0); |
605 | (gpio_direction_output(wreset, 1) == 0)) { | 612 | gpio_export(igep2_wlan_bt_gpios[1].gpio, 0); |
606 | gpio_export(wreset, 0); | 613 | gpio_export(igep2_wlan_bt_gpios[2].gpio, 0); |
607 | gpio_set_value(wreset, 0); | 614 | |
608 | udelay(10); | 615 | gpio_set_value(igep2_wlan_bt_gpios[1].gpio, 0); |
609 | gpio_set_value(wreset, 1); | 616 | udelay(10); |
610 | } else | 617 | gpio_set_value(igep2_wlan_bt_gpios[1].gpio, 1); |
611 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n"); | ||
612 | 618 | ||
613 | if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) && | ||
614 | (gpio_direction_output(btreset, 1) == 0)) { | ||
615 | gpio_export(btreset, 0); | ||
616 | } else | ||
617 | pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n"); | ||
618 | } | 619 | } |
619 | #else | 620 | #else |
620 | static inline void __init igep2_wlan_bt_init(void) { } | 621 | static inline void __init igep2_wlan_bt_init(void) { } |
diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach-omap2/board-igep0030.c index 512a7eb9c2da..83f6be2a0dea 100644 --- a/arch/arm/mach-omap2/board-igep0030.c +++ b/arch/arm/mach-omap2/board-igep0030.c | |||
@@ -269,49 +269,43 @@ static void __init igep3_leds_init(void) | |||
269 | } | 269 | } |
270 | 270 | ||
271 | #else | 271 | #else |
272 | static struct gpio igep3_gpio_leds[] __initdata = { | ||
273 | { IGEP3_GPIO_LED0_RED, GPIOF_OUT_INIT_HIGH, "gpio-led:red:d0" }, | ||
274 | { IGEP3_GPIO_LED0_GREEN, GPIOF_OUT_INIT_HIGH, "gpio-led:green:d0" }, | ||
275 | { IGEP3_GPIO_LED1_RED, GPIOF_OUT_INIT_HIGH, "gpio-led:red:d1" }, | ||
276 | }; | ||
277 | |||
272 | static inline void igep3_leds_init(void) | 278 | static inline void igep3_leds_init(void) |
273 | { | 279 | { |
274 | if ((gpio_request(IGEP3_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && | 280 | if (gpio_request_array(igep3_gpio_leds, ARRAY_SIZE(igep3_gpio_leds))) { |
275 | (gpio_direction_output(IGEP3_GPIO_LED0_RED, 1) == 0)) { | 281 | pr_warning("IGEP3: Could not obtain leds gpios\n"); |
276 | gpio_export(IGEP3_GPIO_LED0_RED, 0); | 282 | return; |
277 | gpio_set_value(IGEP3_GPIO_LED0_RED, 1); | 283 | } |
278 | } else | 284 | gpio_export(IGEP3_GPIO_LED0_RED, 0); |
279 | pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_RED\n"); | 285 | gpio_export(IGEP3_GPIO_LED0_GREEN, 0); |
280 | 286 | gpio_export(IGEP3_GPIO_LED1_RED, 0); | |
281 | if ((gpio_request(IGEP3_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && | ||
282 | (gpio_direction_output(IGEP3_GPIO_LED0_GREEN, 1) == 0)) { | ||
283 | gpio_export(IGEP3_GPIO_LED0_GREEN, 0); | ||
284 | gpio_set_value(IGEP3_GPIO_LED0_GREEN, 1); | ||
285 | } else | ||
286 | pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_GREEN\n"); | ||
287 | |||
288 | if ((gpio_request(IGEP3_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && | ||
289 | (gpio_direction_output(IGEP3_GPIO_LED1_RED, 1) == 0)) { | ||
290 | gpio_export(IGEP3_GPIO_LED1_RED, 0); | ||
291 | gpio_set_value(IGEP3_GPIO_LED1_RED, 1); | ||
292 | } else | ||
293 | pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_RED\n"); | ||
294 | } | 287 | } |
295 | #endif | 288 | #endif |
296 | 289 | ||
297 | static int igep3_twl4030_gpio_setup(struct device *dev, | 290 | static int igep3_twl4030_gpio_setup(struct device *dev, |
298 | unsigned gpio, unsigned ngpio) | 291 | unsigned gpio, unsigned ngpio) |
299 | { | 292 | { |
300 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 293 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) |
301 | mmc[0].gpio_cd = gpio + 0; | 294 | int ret; |
302 | omap2_hsmmc_init(mmc); | ||
303 | 295 | ||
304 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | 296 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
305 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | 297 | ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, |
306 | if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) | 298 | "gpio-led:green:d1"); |
307 | && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) { | 299 | if (ret) |
308 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | ||
309 | gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0); | ||
310 | } else | ||
311 | pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_GREEN\n"); | 300 | pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_GREEN\n"); |
301 | else | ||
302 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | ||
312 | #else | 303 | #else |
313 | igep3_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; | 304 | igep3_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; |
314 | #endif | 305 | #endif |
306 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | ||
307 | mmc[0].gpio_cd = gpio + 0; | ||
308 | omap2_hsmmc_init(mmc); | ||
315 | 309 | ||
316 | return 0; | 310 | return 0; |
317 | }; | 311 | }; |
@@ -358,35 +352,36 @@ static int __init igep3_i2c_init(void) | |||
358 | } | 352 | } |
359 | 353 | ||
360 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) | 354 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) |
355 | static struct gpio igep3_wlan_bt_gpios[] __initdata = { | ||
356 | { IGEP3_GPIO_WIFI_NPD, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" }, | ||
357 | { IGEP3_GPIO_WIFI_NRESET, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" }, | ||
358 | { IGEP3_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" }, | ||
359 | }; | ||
361 | 360 | ||
362 | static void __init igep3_wifi_bt_init(void) | 361 | static void __init igep3_wifi_bt_init(void) |
363 | { | 362 | { |
363 | int err; | ||
364 | |||
364 | /* Configure MUX values for W-LAN + Bluetooth GPIO's */ | 365 | /* Configure MUX values for W-LAN + Bluetooth GPIO's */ |
365 | omap_mux_init_gpio(IGEP3_GPIO_WIFI_NPD, OMAP_PIN_OUTPUT); | 366 | omap_mux_init_gpio(IGEP3_GPIO_WIFI_NPD, OMAP_PIN_OUTPUT); |
366 | omap_mux_init_gpio(IGEP3_GPIO_WIFI_NRESET, OMAP_PIN_OUTPUT); | 367 | omap_mux_init_gpio(IGEP3_GPIO_WIFI_NRESET, OMAP_PIN_OUTPUT); |
367 | omap_mux_init_gpio(IGEP3_GPIO_BT_NRESET, OMAP_PIN_OUTPUT); | 368 | omap_mux_init_gpio(IGEP3_GPIO_BT_NRESET, OMAP_PIN_OUTPUT); |
368 | 369 | ||
369 | /* Set GPIO's for W-LAN + Bluetooth combo module */ | 370 | /* Set GPIO's for W-LAN + Bluetooth combo module */ |
370 | if ((gpio_request(IGEP3_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && | 371 | err = gpio_request_array(igep3_wlan_bt_gpios, |
371 | (gpio_direction_output(IGEP3_GPIO_WIFI_NPD, 1) == 0)) { | 372 | ARRAY_SIZE(igep3_wlan_bt_gpios)); |
372 | gpio_export(IGEP3_GPIO_WIFI_NPD, 0); | 373 | if (err) { |
373 | } else | 374 | pr_warning("IGEP3: Could not obtain WIFI/BT gpios\n"); |
374 | pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NPD\n"); | 375 | return; |
375 | 376 | } | |
376 | if ((gpio_request(IGEP3_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) && | 377 | |
377 | (gpio_direction_output(IGEP3_GPIO_WIFI_NRESET, 1) == 0)) { | 378 | gpio_export(IGEP3_GPIO_WIFI_NPD, 0); |
378 | gpio_export(IGEP3_GPIO_WIFI_NRESET, 0); | 379 | gpio_export(IGEP3_GPIO_WIFI_NRESET, 0); |
379 | gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 0); | 380 | gpio_export(IGEP3_GPIO_BT_NRESET, 0); |
380 | udelay(10); | 381 | |
381 | gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 1); | 382 | gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 0); |
382 | } else | 383 | udelay(10); |
383 | pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NRESET\n"); | 384 | gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 1); |
384 | |||
385 | if ((gpio_request(IGEP3_GPIO_BT_NRESET, "GPIO_BT_NRESET") == 0) && | ||
386 | (gpio_direction_output(IGEP3_GPIO_BT_NRESET, 1) == 0)) { | ||
387 | gpio_export(IGEP3_GPIO_BT_NRESET, 0); | ||
388 | } else | ||
389 | pr_warning("IGEP3: Could not obtain gpio GPIO_BT_NRESET\n"); | ||
390 | } | 385 | } |
391 | #else | 386 | #else |
392 | void __init igep3_wifi_bt_init(void) {} | 387 | void __init igep3_wifi_bt_init(void) {} |
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index e710cd9e079b..8d74318ed495 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -106,14 +106,13 @@ static void __init n8x0_usb_init(void) | |||
106 | static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; | 106 | static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; |
107 | 107 | ||
108 | /* PM companion chip power control pin */ | 108 | /* PM companion chip power control pin */ |
109 | ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); | 109 | ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW, |
110 | "TUSB6010 enable"); | ||
110 | if (ret != 0) { | 111 | if (ret != 0) { |
111 | printk(KERN_ERR "Could not get TUSB power GPIO%i\n", | 112 | printk(KERN_ERR "Could not get TUSB power GPIO%i\n", |
112 | TUSB6010_GPIO_ENABLE); | 113 | TUSB6010_GPIO_ENABLE); |
113 | return; | 114 | return; |
114 | } | 115 | } |
115 | gpio_direction_output(TUSB6010_GPIO_ENABLE, 0); | ||
116 | |||
117 | tusb_set_power(0); | 116 | tusb_set_power(0); |
118 | 117 | ||
119 | ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, | 118 | ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, |
@@ -494,8 +493,12 @@ static struct omap_mmc_platform_data mmc1_data = { | |||
494 | 493 | ||
495 | static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; | 494 | static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; |
496 | 495 | ||
497 | static void __init n8x0_mmc_init(void) | 496 | static struct gpio n810_emmc_gpios[] __initdata = { |
497 | { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" }, | ||
498 | { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" }, | ||
499 | }; | ||
498 | 500 | ||
501 | static void __init n8x0_mmc_init(void) | ||
499 | { | 502 | { |
500 | int err; | 503 | int err; |
501 | 504 | ||
@@ -512,27 +515,18 @@ static void __init n8x0_mmc_init(void) | |||
512 | mmc1_data.slots[1].ban_openended = 1; | 515 | mmc1_data.slots[1].ban_openended = 1; |
513 | } | 516 | } |
514 | 517 | ||
515 | err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); | 518 | err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW, |
519 | "MMC slot switch"); | ||
516 | if (err) | 520 | if (err) |
517 | return; | 521 | return; |
518 | 522 | ||
519 | gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0); | ||
520 | |||
521 | if (machine_is_nokia_n810()) { | 523 | if (machine_is_nokia_n810()) { |
522 | err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); | 524 | err = gpio_request_array(n810_emmc_gpios, |
523 | if (err) { | 525 | ARRAY_SIZE(n810_emmc_gpios)); |
524 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | ||
525 | return; | ||
526 | } | ||
527 | gpio_direction_output(N810_EMMC_VSD_GPIO, 0); | ||
528 | |||
529 | err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd"); | ||
530 | if (err) { | 526 | if (err) { |
531 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | 527 | gpio_free(N8X0_SLOT_SWITCH_GPIO); |
532 | gpio_free(N810_EMMC_VSD_GPIO); | ||
533 | return; | 528 | return; |
534 | } | 529 | } |
535 | gpio_direction_output(N810_EMMC_VIO_GPIO, 0); | ||
536 | } | 530 | } |
537 | 531 | ||
538 | mmc_data[0] = &mmc1_data; | 532 | mmc_data[0] = &mmc1_data; |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index bc30ab092d1e..3ff3a2c4b86e 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -80,6 +80,12 @@ static u8 omap3_beagle_get_rev(void) | |||
80 | return omap3_beagle_version; | 80 | return omap3_beagle_version; |
81 | } | 81 | } |
82 | 82 | ||
83 | static struct gpio omap3_beagle_rev_gpios[] __initdata = { | ||
84 | { 171, GPIOF_IN, "rev_id_0" }, | ||
85 | { 172, GPIOF_IN, "rev_id_1" }, | ||
86 | { 173, GPIOF_IN, "rev_id_2" }, | ||
87 | }; | ||
88 | |||
83 | static void __init omap3_beagle_init_rev(void) | 89 | static void __init omap3_beagle_init_rev(void) |
84 | { | 90 | { |
85 | int ret; | 91 | int ret; |
@@ -89,21 +95,13 @@ static void __init omap3_beagle_init_rev(void) | |||
89 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); | 95 | omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); |
90 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); | 96 | omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); |
91 | 97 | ||
92 | ret = gpio_request(171, "rev_id_0"); | 98 | ret = gpio_request_array(omap3_beagle_rev_gpios, |
93 | if (ret < 0) | 99 | ARRAY_SIZE(omap3_beagle_rev_gpios)); |
94 | goto fail0; | 100 | if (ret < 0) { |
95 | 101 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | |
96 | ret = gpio_request(172, "rev_id_1"); | 102 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; |
97 | if (ret < 0) | 103 | return; |
98 | goto fail1; | 104 | } |
99 | |||
100 | ret = gpio_request(173, "rev_id_2"); | ||
101 | if (ret < 0) | ||
102 | goto fail2; | ||
103 | |||
104 | gpio_direction_input(171); | ||
105 | gpio_direction_input(172); | ||
106 | gpio_direction_input(173); | ||
107 | 105 | ||
108 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | 106 | beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) |
109 | | (gpio_get_value(173) << 2); | 107 | | (gpio_get_value(173) << 2); |
@@ -129,18 +127,6 @@ static void __init omap3_beagle_init_rev(void) | |||
129 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); | 127 | printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); |
130 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | 128 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; |
131 | } | 129 | } |
132 | |||
133 | return; | ||
134 | |||
135 | fail2: | ||
136 | gpio_free(172); | ||
137 | fail1: | ||
138 | gpio_free(171); | ||
139 | fail0: | ||
140 | printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); | ||
141 | omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; | ||
142 | |||
143 | return; | ||
144 | } | 130 | } |
145 | 131 | ||
146 | static struct mtd_partition omap3beagle_nand_partitions[] = { | 132 | static struct mtd_partition omap3beagle_nand_partitions[] = { |
@@ -235,13 +221,10 @@ static void __init beagle_display_init(void) | |||
235 | { | 221 | { |
236 | int r; | 222 | int r; |
237 | 223 | ||
238 | r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); | 224 | r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW, |
239 | if (r < 0) { | 225 | "DVI reset"); |
226 | if (r < 0) | ||
240 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | 227 | printk(KERN_ERR "Unable to get DVI reset GPIO\n"); |
241 | return; | ||
242 | } | ||
243 | |||
244 | gpio_direction_output(beagle_dvi_device.reset_gpio, 0); | ||
245 | } | 228 | } |
246 | 229 | ||
247 | #include "sdram-micron-mt46h32m32lf-6.h" | 230 | #include "sdram-micron-mt46h32m32lf-6.h" |
@@ -268,7 +251,7 @@ static struct gpio_led gpio_leds[]; | |||
268 | static int beagle_twl_gpio_setup(struct device *dev, | 251 | static int beagle_twl_gpio_setup(struct device *dev, |
269 | unsigned gpio, unsigned ngpio) | 252 | unsigned gpio, unsigned ngpio) |
270 | { | 253 | { |
271 | int r; | 254 | int r, usb_pwr_level; |
272 | 255 | ||
273 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 256 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
274 | mmc[0].gpio_wp = -EINVAL; | 257 | mmc[0].gpio_wp = -EINVAL; |
@@ -287,66 +270,46 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
287 | beagle_vmmc1_supply.dev = mmc[0].dev; | 270 | beagle_vmmc1_supply.dev = mmc[0].dev; |
288 | beagle_vsim_supply.dev = mmc[0].dev; | 271 | beagle_vsim_supply.dev = mmc[0].dev; |
289 | 272 | ||
290 | /* REVISIT: need ehci-omap hooks for external VBUS | ||
291 | * power switch and overcurrent detect | ||
292 | */ | ||
293 | if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) { | ||
294 | r = gpio_request(gpio + 1, "EHCI_nOC"); | ||
295 | if (!r) { | ||
296 | r = gpio_direction_input(gpio + 1); | ||
297 | if (r) | ||
298 | gpio_free(gpio + 1); | ||
299 | } | ||
300 | if (r) | ||
301 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | ||
302 | } | ||
303 | |||
304 | /* | 273 | /* |
305 | * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active | 274 | * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active |
306 | * high / others active low) | 275 | * high / others active low) |
307 | */ | 276 | * DVI reset GPIO is different between beagle revisions |
308 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | ||
309 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) | ||
310 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); | ||
311 | else | ||
312 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | ||
313 | |||
314 | /* DVI reset GPIO is different between beagle revisions */ | ||
315 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) | ||
316 | beagle_dvi_device.reset_gpio = 129; | ||
317 | else | ||
318 | beagle_dvi_device.reset_gpio = 170; | ||
319 | |||
320 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
321 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
322 | |||
323 | /* | ||
324 | * gpio + 1 on Xm controls the TFP410's enable line (active low) | ||
325 | * gpio + 2 control varies depending on the board rev as follows: | ||
326 | * P7/P8 revisions(prototype): Camera EN | ||
327 | * A2+ revisions (production): LDO (supplies DVI, serial, led blocks) | ||
328 | */ | 277 | */ |
329 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { | 278 | if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { |
330 | r = gpio_request(gpio + 1, "nDVI_PWR_EN"); | 279 | usb_pwr_level = GPIOF_OUT_INIT_HIGH; |
331 | if (!r) { | 280 | beagle_dvi_device.reset_gpio = 129; |
332 | r = gpio_direction_output(gpio + 1, 0); | 281 | /* |
333 | if (r) | 282 | * gpio + 1 on Xm controls the TFP410's enable line (active low) |
334 | gpio_free(gpio + 1); | 283 | * gpio + 2 control varies depending on the board rev as below: |
335 | } | 284 | * P7/P8 revisions(prototype): Camera EN |
285 | * A2+ revisions (production): LDO (DVI, serial, led blocks) | ||
286 | */ | ||
287 | r = gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW, | ||
288 | "nDVI_PWR_EN"); | ||
336 | if (r) | 289 | if (r) |
337 | pr_err("%s: unable to configure nDVI_PWR_EN\n", | 290 | pr_err("%s: unable to configure nDVI_PWR_EN\n", |
338 | __func__); | 291 | __func__); |
339 | r = gpio_request(gpio + 2, "DVI_LDO_EN"); | 292 | r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, |
340 | if (!r) { | 293 | "DVI_LDO_EN"); |
341 | r = gpio_direction_output(gpio + 2, 1); | ||
342 | if (r) | ||
343 | gpio_free(gpio + 2); | ||
344 | } | ||
345 | if (r) | 294 | if (r) |
346 | pr_err("%s: unable to configure DVI_LDO_EN\n", | 295 | pr_err("%s: unable to configure DVI_LDO_EN\n", |
347 | __func__); | 296 | __func__); |
297 | } else { | ||
298 | usb_pwr_level = GPIOF_OUT_INIT_LOW; | ||
299 | beagle_dvi_device.reset_gpio = 170; | ||
300 | /* | ||
301 | * REVISIT: need ehci-omap hooks for external VBUS | ||
302 | * power switch and overcurrent detect | ||
303 | */ | ||
304 | if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) | ||
305 | pr_err("%s: unable to configure EHCI_nOC\n", __func__); | ||
348 | } | 306 | } |
349 | 307 | ||
308 | gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR"); | ||
309 | |||
310 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | ||
311 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | ||
312 | |||
350 | return 0; | 313 | return 0; |
351 | } | 314 | } |
352 | 315 | ||
@@ -608,9 +571,8 @@ static void __init omap3_beagle_init(void) | |||
608 | omap_serial_init(); | 571 | omap_serial_init(); |
609 | 572 | ||
610 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); | 573 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
611 | gpio_request(170, "DVI_nPD"); | ||
612 | /* REVISIT leave DVI powered down until it's needed ... */ | 574 | /* REVISIT leave DVI powered down until it's needed ... */ |
613 | gpio_direction_output(170, true); | 575 | gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); |
614 | 576 | ||
615 | usb_musb_init(NULL); | 577 | usb_musb_init(NULL); |
616 | usbhs_init(&usbhs_bdata); | 578 | usbhs_init(&usbhs_bdata); |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 5066b0bbf63d..02e1ad29e1e8 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -149,6 +149,15 @@ static inline void __init omap3evm_init_smsc911x(void) { return; } | |||
149 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 | 149 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 |
150 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 | 150 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 |
151 | 151 | ||
152 | static struct gpio omap3_evm_dss_gpios[] __initdata = { | ||
153 | { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" }, | ||
154 | { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" }, | ||
155 | { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" }, | ||
156 | { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" }, | ||
157 | { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" }, | ||
158 | { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" }, | ||
159 | }; | ||
160 | |||
152 | static int lcd_enabled; | 161 | static int lcd_enabled; |
153 | static int dvi_enabled; | 162 | static int dvi_enabled; |
154 | 163 | ||
@@ -156,61 +165,10 @@ static void __init omap3_evm_display_init(void) | |||
156 | { | 165 | { |
157 | int r; | 166 | int r; |
158 | 167 | ||
159 | r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); | 168 | r = gpio_request_array(omap3_evm_dss_gpios, |
160 | if (r) { | 169 | ARRAY_SIZE(omap3_evm_dss_gpios)); |
161 | printk(KERN_ERR "failed to get lcd_panel_resb\n"); | 170 | if (r) |
162 | return; | 171 | printk(KERN_ERR "failed to get lcd_panel_* gpios\n"); |
163 | } | ||
164 | gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1); | ||
165 | |||
166 | r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini"); | ||
167 | if (r) { | ||
168 | printk(KERN_ERR "failed to get lcd_panel_ini\n"); | ||
169 | goto err_1; | ||
170 | } | ||
171 | gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1); | ||
172 | |||
173 | r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga"); | ||
174 | if (r) { | ||
175 | printk(KERN_ERR "failed to get lcd_panel_qvga\n"); | ||
176 | goto err_2; | ||
177 | } | ||
178 | gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0); | ||
179 | |||
180 | r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr"); | ||
181 | if (r) { | ||
182 | printk(KERN_ERR "failed to get lcd_panel_lr\n"); | ||
183 | goto err_3; | ||
184 | } | ||
185 | gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1); | ||
186 | |||
187 | r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud"); | ||
188 | if (r) { | ||
189 | printk(KERN_ERR "failed to get lcd_panel_ud\n"); | ||
190 | goto err_4; | ||
191 | } | ||
192 | gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1); | ||
193 | |||
194 | r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd"); | ||
195 | if (r) { | ||
196 | printk(KERN_ERR "failed to get lcd_panel_envdd\n"); | ||
197 | goto err_5; | ||
198 | } | ||
199 | gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0); | ||
200 | |||
201 | return; | ||
202 | |||
203 | err_5: | ||
204 | gpio_free(OMAP3EVM_LCD_PANEL_UD); | ||
205 | err_4: | ||
206 | gpio_free(OMAP3EVM_LCD_PANEL_LR); | ||
207 | err_3: | ||
208 | gpio_free(OMAP3EVM_LCD_PANEL_QVGA); | ||
209 | err_2: | ||
210 | gpio_free(OMAP3EVM_LCD_PANEL_INI); | ||
211 | err_1: | ||
212 | gpio_free(OMAP3EVM_LCD_PANEL_RESB); | ||
213 | |||
214 | } | 172 | } |
215 | 173 | ||
216 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) | 174 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) |
@@ -400,7 +358,7 @@ static struct platform_device leds_gpio = { | |||
400 | static int omap3evm_twl_gpio_setup(struct device *dev, | 358 | static int omap3evm_twl_gpio_setup(struct device *dev, |
401 | unsigned gpio, unsigned ngpio) | 359 | unsigned gpio, unsigned ngpio) |
402 | { | 360 | { |
403 | int r; | 361 | int r, lcd_bl_en; |
404 | 362 | ||
405 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 363 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
406 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); | 364 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); |
@@ -417,16 +375,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev, | |||
417 | */ | 375 | */ |
418 | 376 | ||
419 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ | 377 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
420 | r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); | 378 | lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ? |
421 | if (!r) | 379 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; |
422 | r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, | 380 | r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL"); |
423 | (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0); | ||
424 | if (r) | 381 | if (r) |
425 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); | 382 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); |
426 | 383 | ||
427 | /* gpio + 7 == DVI Enable */ | 384 | /* gpio + 7 == DVI Enable */ |
428 | gpio_request(gpio + 7, "EN_DVI"); | 385 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); |
429 | gpio_direction_output(gpio + 7, 0); | ||
430 | 386 | ||
431 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | 387 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
432 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 388 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
@@ -717,6 +673,11 @@ static struct omap_musb_board_data musb_board_data = { | |||
717 | .power = 100, | 673 | .power = 100, |
718 | }; | 674 | }; |
719 | 675 | ||
676 | static struct gpio omap3_evm_ehci_gpios[] __initdata = { | ||
677 | { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" }, | ||
678 | { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" }, | ||
679 | }; | ||
680 | |||
720 | static void __init omap3_evm_init(void) | 681 | static void __init omap3_evm_init(void) |
721 | { | 682 | { |
722 | omap3_evm_get_revision(); | 683 | omap3_evm_get_revision(); |
@@ -740,16 +701,12 @@ static void __init omap3_evm_init(void) | |||
740 | 701 | ||
741 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { | 702 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
742 | /* enable EHCI VBUS using GPIO22 */ | 703 | /* enable EHCI VBUS using GPIO22 */ |
743 | omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); | 704 | omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP); |
744 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); | ||
745 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); | ||
746 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); | ||
747 | |||
748 | /* Select EHCI port on main board */ | 705 | /* Select EHCI port on main board */ |
749 | omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); | 706 | omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT, |
750 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); | 707 | OMAP_PIN_INPUT_PULLUP); |
751 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); | 708 | gpio_request_array(omap3_evm_ehci_gpios, |
752 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); | 709 | ARRAY_SIZE(omap3_evm_ehci_gpios)); |
753 | 710 | ||
754 | /* setup EHCI phy reset config */ | 711 | /* setup EHCI phy reset config */ |
755 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); | 712 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 6c22d3f238eb..78dd2a7fe6e6 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -305,24 +305,13 @@ static int omap3pandora_twl_gpio_setup(struct device *dev, | |||
305 | 305 | ||
306 | /* gpio + 13 drives 32kHz buffer for wifi module */ | 306 | /* gpio + 13 drives 32kHz buffer for wifi module */ |
307 | gpio_32khz = gpio + 13; | 307 | gpio_32khz = gpio + 13; |
308 | ret = gpio_request(gpio_32khz, "wifi 32kHz"); | 308 | ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz"); |
309 | if (ret < 0) { | 309 | if (ret < 0) { |
310 | pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret); | 310 | pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret); |
311 | goto fail; | 311 | return -ENODEV; |
312 | } | ||
313 | |||
314 | ret = gpio_direction_output(gpio_32khz, 1); | ||
315 | if (ret < 0) { | ||
316 | pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret); | ||
317 | goto fail_direction; | ||
318 | } | 312 | } |
319 | 313 | ||
320 | return 0; | 314 | return 0; |
321 | |||
322 | fail_direction: | ||
323 | gpio_free(gpio_32khz); | ||
324 | fail: | ||
325 | return -ENODEV; | ||
326 | } | 315 | } |
327 | 316 | ||
328 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { | 317 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { |
@@ -584,14 +573,10 @@ static void __init pandora_wl1251_init(void) | |||
584 | 573 | ||
585 | memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); | 574 | memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); |
586 | 575 | ||
587 | ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); | 576 | ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq"); |
588 | if (ret < 0) | 577 | if (ret < 0) |
589 | goto fail; | 578 | goto fail; |
590 | 579 | ||
591 | ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO); | ||
592 | if (ret < 0) | ||
593 | goto fail_irq; | ||
594 | |||
595 | pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); | 580 | pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); |
596 | if (pandora_wl1251_pdata.irq < 0) | 581 | if (pandora_wl1251_pdata.irq < 0) |
597 | goto fail_irq; | 582 | goto fail_irq; |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 9981d06b7269..085c60a7c47c 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -331,12 +331,11 @@ omap3stalker_twl_gpio_setup(struct device *dev, | |||
331 | */ | 331 | */ |
332 | 332 | ||
333 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ | 333 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
334 | gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); | 334 | gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, |
335 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | 335 | "EN_LCD_BKL"); |
336 | 336 | ||
337 | /* gpio + 7 == DVI Enable */ | 337 | /* gpio + 7 == DVI Enable */ |
338 | gpio_request(gpio + 7, "EN_DVI"); | 338 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); |
339 | gpio_direction_output(gpio + 7, 0); | ||
340 | 339 | ||
341 | /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ | 340 | /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ |
342 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 341 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index 392278d9a882..82872d7d313b 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -146,13 +146,11 @@ static int touchbook_twl_gpio_setup(struct device *dev, | |||
146 | /* REVISIT: need ehci-omap hooks for external VBUS | 146 | /* REVISIT: need ehci-omap hooks for external VBUS |
147 | * power switch and overcurrent detect | 147 | * power switch and overcurrent detect |
148 | */ | 148 | */ |
149 | 149 | gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"); | |
150 | gpio_request(gpio + 1, "EHCI_nOC"); | ||
151 | gpio_direction_input(gpio + 1); | ||
152 | 150 | ||
153 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ | 151 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ |
154 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | 152 | gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, |
155 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | 153 | "nEN_USB_PWR"); |
156 | 154 | ||
157 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | 155 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
158 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 156 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
@@ -401,15 +399,10 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | |||
401 | 399 | ||
402 | static void omap3_touchbook_poweroff(void) | 400 | static void omap3_touchbook_poweroff(void) |
403 | { | 401 | { |
404 | int r; | 402 | int pwr_off = TB_KILL_POWER_GPIO; |
405 | 403 | ||
406 | r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset"); | 404 | if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0) |
407 | if (r < 0) { | ||
408 | printk(KERN_ERR "Unable to get kill power GPIO\n"); | 405 | printk(KERN_ERR "Unable to get kill power GPIO\n"); |
409 | return; | ||
410 | } | ||
411 | |||
412 | gpio_direction_output(TB_KILL_POWER_GPIO, 0); | ||
413 | } | 406 | } |
414 | 407 | ||
415 | static int __init early_touchbook_revision(char *p) | 408 | static int __init early_touchbook_revision(char *p) |
@@ -435,9 +428,8 @@ static void __init omap3_touchbook_init(void) | |||
435 | omap_serial_init(); | 428 | omap_serial_init(); |
436 | 429 | ||
437 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); | 430 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
438 | gpio_request(176, "DVI_nPD"); | ||
439 | /* REVISIT leave DVI powered down until it's needed ... */ | 431 | /* REVISIT leave DVI powered down until it's needed ... */ |
440 | gpio_direction_output(176, true); | 432 | gpio_request_one(176, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); |
441 | 433 | ||
442 | /* Touchscreen and accelerometer */ | 434 | /* Touchscreen and accelerometer */ |
443 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); | 435 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 7eaad629c4c2..5d7c0a313dc7 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -112,6 +112,11 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | |||
112 | .reset_gpio_port[2] = -EINVAL | 112 | .reset_gpio_port[2] = -EINVAL |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static struct gpio panda_ehci_gpios[] __initdata = { | ||
116 | { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, | ||
117 | { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, | ||
118 | }; | ||
119 | |||
115 | static void __init omap4_ehci_init(void) | 120 | static void __init omap4_ehci_init(void) |
116 | { | 121 | { |
117 | int ret; | 122 | int ret; |
@@ -121,44 +126,27 @@ static void __init omap4_ehci_init(void) | |||
121 | phy_ref_clk = clk_get(NULL, "auxclk3_ck"); | 126 | phy_ref_clk = clk_get(NULL, "auxclk3_ck"); |
122 | if (IS_ERR(phy_ref_clk)) { | 127 | if (IS_ERR(phy_ref_clk)) { |
123 | pr_err("Cannot request auxclk3\n"); | 128 | pr_err("Cannot request auxclk3\n"); |
124 | goto error1; | 129 | return; |
125 | } | 130 | } |
126 | clk_set_rate(phy_ref_clk, 19200000); | 131 | clk_set_rate(phy_ref_clk, 19200000); |
127 | clk_enable(phy_ref_clk); | 132 | clk_enable(phy_ref_clk); |
128 | 133 | ||
129 | /* disable the power to the usb hub prior to init */ | 134 | /* disable the power to the usb hub prior to init and reset phy+hub */ |
130 | ret = gpio_request(GPIO_HUB_POWER, "hub_power"); | 135 | ret = gpio_request_array(panda_ehci_gpios, |
136 | ARRAY_SIZE(panda_ehci_gpios)); | ||
131 | if (ret) { | 137 | if (ret) { |
132 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER); | 138 | pr_err("Unable to initialize EHCI power/reset\n"); |
133 | goto error1; | 139 | return; |
134 | } | 140 | } |
135 | gpio_export(GPIO_HUB_POWER, 0); | ||
136 | gpio_direction_output(GPIO_HUB_POWER, 0); | ||
137 | gpio_set_value(GPIO_HUB_POWER, 0); | ||
138 | 141 | ||
139 | /* reset phy+hub */ | 142 | gpio_export(GPIO_HUB_POWER, 0); |
140 | ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset"); | ||
141 | if (ret) { | ||
142 | pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET); | ||
143 | goto error2; | ||
144 | } | ||
145 | gpio_export(GPIO_HUB_NRESET, 0); | 143 | gpio_export(GPIO_HUB_NRESET, 0); |
146 | gpio_direction_output(GPIO_HUB_NRESET, 0); | ||
147 | gpio_set_value(GPIO_HUB_NRESET, 0); | ||
148 | gpio_set_value(GPIO_HUB_NRESET, 1); | 144 | gpio_set_value(GPIO_HUB_NRESET, 1); |
149 | 145 | ||
150 | usbhs_init(&usbhs_bdata); | 146 | usbhs_init(&usbhs_bdata); |
151 | 147 | ||
152 | /* enable power to hub */ | 148 | /* enable power to hub */ |
153 | gpio_set_value(GPIO_HUB_POWER, 1); | 149 | gpio_set_value(GPIO_HUB_POWER, 1); |
154 | return; | ||
155 | |||
156 | error2: | ||
157 | gpio_free(GPIO_HUB_POWER); | ||
158 | error1: | ||
159 | pr_err("Unable to initialize EHCI power/reset\n"); | ||
160 | return; | ||
161 | |||
162 | } | 150 | } |
163 | 151 | ||
164 | static struct omap_musb_board_data musb_board_data = { | 152 | static struct omap_musb_board_data musb_board_data = { |
@@ -638,27 +626,19 @@ static void omap4_panda_hdmi_mux_init(void) | |||
638 | OMAP_PIN_INPUT_PULLUP); | 626 | OMAP_PIN_INPUT_PULLUP); |
639 | } | 627 | } |
640 | 628 | ||
629 | static struct gpio panda_hdmi_gpios[] = { | ||
630 | { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, | ||
631 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, | ||
632 | }; | ||
633 | |||
641 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) | 634 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) |
642 | { | 635 | { |
643 | int status; | 636 | int status; |
644 | 637 | ||
645 | status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, | 638 | status = gpio_request_array(panda_hdmi_gpios, |
646 | "hdmi_gpio_hpd"); | 639 | ARRAY_SIZE(panda_hdmi_gpios)); |
647 | if (status) { | 640 | if (status) |
648 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); | 641 | pr_err("Cannot request HDMI GPIOs\n"); |
649 | return status; | ||
650 | } | ||
651 | status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, | ||
652 | "hdmi_gpio_ls_oe"); | ||
653 | if (status) { | ||
654 | pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); | ||
655 | goto error1; | ||
656 | } | ||
657 | |||
658 | return 0; | ||
659 | |||
660 | error1: | ||
661 | gpio_free(HDMI_GPIO_HPD); | ||
662 | 642 | ||
663 | return status; | 643 | return status; |
664 | } | 644 | } |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index e152c13ded75..c03f92b14f9c 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -151,21 +151,20 @@ static int dvi_enabled; | |||
151 | #define OVERO_GPIO_LCD_EN 144 | 151 | #define OVERO_GPIO_LCD_EN 144 |
152 | #define OVERO_GPIO_LCD_BL 145 | 152 | #define OVERO_GPIO_LCD_BL 145 |
153 | 153 | ||
154 | static struct gpio overo_dss_gpios[] __initdata = { | ||
155 | { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" }, | ||
156 | { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" }, | ||
157 | }; | ||
158 | |||
154 | static void __init overo_display_init(void) | 159 | static void __init overo_display_init(void) |
155 | { | 160 | { |
156 | if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && | 161 | if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) { |
157 | (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) | 162 | printk(KERN_ERR "could not obtain DSS control GPIOs\n"); |
158 | gpio_export(OVERO_GPIO_LCD_EN, 0); | 163 | return; |
159 | else | 164 | } |
160 | printk(KERN_ERR "could not obtain gpio for " | ||
161 | "OVERO_GPIO_LCD_EN\n"); | ||
162 | 165 | ||
163 | if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && | 166 | gpio_export(OVERO_GPIO_LCD_EN, 0); |
164 | (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) | 167 | gpio_export(OVERO_GPIO_LCD_BL, 0); |
165 | gpio_export(OVERO_GPIO_LCD_BL, 0); | ||
166 | else | ||
167 | printk(KERN_ERR "could not obtain gpio for " | ||
168 | "OVERO_GPIO_LCD_BL\n"); | ||
169 | } | 168 | } |
170 | 169 | ||
171 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) | 170 | static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) |
@@ -553,8 +552,15 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
553 | }; | 552 | }; |
554 | #endif | 553 | #endif |
555 | 554 | ||
555 | static struct gpio overo_bt_gpios[] __initdata = { | ||
556 | { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" }, | ||
557 | { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, | ||
558 | }; | ||
559 | |||
556 | static void __init overo_init(void) | 560 | static void __init overo_init(void) |
557 | { | 561 | { |
562 | int ret; | ||
563 | |||
558 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 564 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
559 | overo_i2c_init(); | 565 | overo_i2c_init(); |
560 | omap_display_init(&overo_dss_data); | 566 | omap_display_init(&overo_dss_data); |
@@ -574,9 +580,9 @@ static void __init overo_init(void) | |||
574 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 580 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
575 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 581 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
576 | 582 | ||
577 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, | 583 | ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH, |
578 | "OVERO_GPIO_W2W_NRESET") == 0) && | 584 | "OVERO_GPIO_W2W_NRESET"); |
579 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { | 585 | if (ret == 0) { |
580 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); | 586 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); |
581 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); | 587 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); |
582 | udelay(10); | 588 | udelay(10); |
@@ -586,25 +592,20 @@ static void __init overo_init(void) | |||
586 | "OVERO_GPIO_W2W_NRESET\n"); | 592 | "OVERO_GPIO_W2W_NRESET\n"); |
587 | } | 593 | } |
588 | 594 | ||
589 | if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && | 595 | ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios)); |
590 | (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) | 596 | if (ret) { |
597 | pr_err("%s: could not obtain BT gpios\n", __func__); | ||
598 | } else { | ||
591 | gpio_export(OVERO_GPIO_BT_XGATE, 0); | 599 | gpio_export(OVERO_GPIO_BT_XGATE, 0); |
592 | else | ||
593 | printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); | ||
594 | |||
595 | if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && | ||
596 | (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { | ||
597 | gpio_export(OVERO_GPIO_BT_NRESET, 0); | 600 | gpio_export(OVERO_GPIO_BT_NRESET, 0); |
598 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); | 601 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); |
599 | mdelay(6); | 602 | mdelay(6); |
600 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); | 603 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); |
601 | } else { | ||
602 | printk(KERN_ERR "could not obtain gpio for " | ||
603 | "OVERO_GPIO_BT_NRESET\n"); | ||
604 | } | 604 | } |
605 | 605 | ||
606 | if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && | 606 | ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH, |
607 | (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) | 607 | "OVERO_GPIO_USBH_CPEN"); |
608 | if (ret == 0) | ||
608 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); | 609 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); |
609 | else | 610 | else |
610 | printk(KERN_ERR "could not obtain gpio for " | 611 | printk(KERN_ERR "could not obtain gpio for " |
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index a5bf5e92eae8..2e509f9149e2 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -558,10 +558,8 @@ static __init void rx51_init_si4713(void) | |||
558 | static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) | 558 | static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) |
559 | { | 559 | { |
560 | /* FIXME this gpio setup is just a placeholder for now */ | 560 | /* FIXME this gpio setup is just a placeholder for now */ |
561 | gpio_request(gpio + 6, "backlight_pwm"); | 561 | gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm"); |
562 | gpio_direction_output(gpio + 6, 0); | 562 | gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en"); |
563 | gpio_request(gpio + 7, "speaker_en"); | ||
564 | gpio_direction_output(gpio + 7, 1); | ||
565 | 563 | ||
566 | return 0; | 564 | return 0; |
567 | } | 565 | } |
@@ -912,26 +910,20 @@ static void rx51_wl1251_set_power(bool enable) | |||
912 | gpio_set_value(RX51_WL1251_POWER_GPIO, enable); | 910 | gpio_set_value(RX51_WL1251_POWER_GPIO, enable); |
913 | } | 911 | } |
914 | 912 | ||
913 | static struct gpio rx51_wl1251_gpios[] __initdata = { | ||
914 | { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" }, | ||
915 | { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" }, | ||
916 | }; | ||
917 | |||
915 | static void __init rx51_init_wl1251(void) | 918 | static void __init rx51_init_wl1251(void) |
916 | { | 919 | { |
917 | int irq, ret; | 920 | int irq, ret; |
918 | 921 | ||
919 | ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); | 922 | ret = gpio_request_array(rx51_wl1251_gpios, |
923 | ARRAY_SIZE(rx51_wl1251_gpios)); | ||
920 | if (ret < 0) | 924 | if (ret < 0) |
921 | goto error; | 925 | goto error; |
922 | 926 | ||
923 | ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0); | ||
924 | if (ret < 0) | ||
925 | goto err_power; | ||
926 | |||
927 | ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq"); | ||
928 | if (ret < 0) | ||
929 | goto err_power; | ||
930 | |||
931 | ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO); | ||
932 | if (ret < 0) | ||
933 | goto err_irq; | ||
934 | |||
935 | irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); | 927 | irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); |
936 | if (irq < 0) | 928 | if (irq < 0) |
937 | goto err_irq; | 929 | goto err_irq; |
@@ -943,10 +935,7 @@ static void __init rx51_init_wl1251(void) | |||
943 | 935 | ||
944 | err_irq: | 936 | err_irq: |
945 | gpio_free(RX51_WL1251_IRQ_GPIO); | 937 | gpio_free(RX51_WL1251_IRQ_GPIO); |
946 | |||
947 | err_power: | ||
948 | gpio_free(RX51_WL1251_POWER_GPIO); | 938 | gpio_free(RX51_WL1251_POWER_GPIO); |
949 | |||
950 | error: | 939 | error: |
951 | printk(KERN_ERR "wl1251 board initialisation failed\n"); | 940 | printk(KERN_ERR "wl1251 board initialisation failed\n"); |
952 | wl1251_pdata.set_power = NULL; | 941 | wl1251_pdata.set_power = NULL; |
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c index 89a66db8b77d..19777333aef8 100644 --- a/arch/arm/mach-omap2/board-rx51-video.c +++ b/arch/arm/mach-omap2/board-rx51-video.c | |||
@@ -76,13 +76,12 @@ static int __init rx51_video_init(void) | |||
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) { | 79 | if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH, |
80 | "LCD ACX565AKM reset")) { | ||
80 | pr_err("%s failed to get LCD Reset GPIO\n", __func__); | 81 | pr_err("%s failed to get LCD Reset GPIO\n", __func__); |
81 | return 0; | 82 | return 0; |
82 | } | 83 | } |
83 | 84 | ||
84 | gpio_direction_output(RX51_LCD_RESET_GPIO, 1); | ||
85 | |||
86 | omap_display_init(&rx51_dss_board_info); | 85 | omap_display_init(&rx51_dss_board_info); |
87 | return 0; | 86 | return 0; |
88 | } | 87 | } |
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c index 2ee9ab92e0c1..6402e781c458 100644 --- a/arch/arm/mach-omap2/board-zoom-debugboard.c +++ b/arch/arm/mach-omap2/board-zoom-debugboard.c | |||
@@ -77,12 +77,9 @@ static inline void __init zoom_init_quaduart(void) | |||
77 | 77 | ||
78 | quart_gpio = ZOOM_QUADUART_GPIO; | 78 | quart_gpio = ZOOM_QUADUART_GPIO; |
79 | 79 | ||
80 | if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) { | 80 | if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) |
81 | printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", | 81 | printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", |
82 | quart_gpio); | 82 | quart_gpio); |
83 | return; | ||
84 | } | ||
85 | gpio_direction_input(quart_gpio); | ||
86 | } | 83 | } |
87 | 84 | ||
88 | static inline int omap_zoom_debugboard_detect(void) | 85 | static inline int omap_zoom_debugboard_detect(void) |
@@ -92,12 +89,12 @@ static inline int omap_zoom_debugboard_detect(void) | |||
92 | 89 | ||
93 | debug_board_detect = ZOOM_SMSC911X_GPIO; | 90 | debug_board_detect = ZOOM_SMSC911X_GPIO; |
94 | 91 | ||
95 | if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) { | 92 | if (gpio_request_one(debug_board_detect, GPIOF_IN, |
93 | "Zoom debug board detect") < 0) { | ||
96 | printk(KERN_ERR "Failed to request GPIO%d for Zoom debug" | 94 | printk(KERN_ERR "Failed to request GPIO%d for Zoom debug" |
97 | "board detect\n", debug_board_detect); | 95 | "board detect\n", debug_board_detect); |
98 | return 0; | 96 | return 0; |
99 | } | 97 | } |
100 | gpio_direction_input(debug_board_detect); | ||
101 | 98 | ||
102 | if (!gpio_get_value(debug_board_detect)) { | 99 | if (!gpio_get_value(debug_board_detect)) { |
103 | ret = 0; | 100 | ret = 0; |
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c index 37b84c2b850f..ce53e82ba136 100644 --- a/arch/arm/mach-omap2/board-zoom-display.c +++ b/arch/arm/mach-omap2/board-zoom-display.c | |||
@@ -21,34 +21,19 @@ | |||
21 | #define LCD_PANEL_RESET_GPIO_PILOT 55 | 21 | #define LCD_PANEL_RESET_GPIO_PILOT 55 |
22 | #define LCD_PANEL_QVGA_GPIO 56 | 22 | #define LCD_PANEL_QVGA_GPIO 56 |
23 | 23 | ||
24 | static struct gpio zoom_lcd_gpios[] __initdata = { | ||
25 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" }, | ||
26 | { LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "lcd qvga" }, | ||
27 | }; | ||
28 | |||
24 | static void zoom_lcd_panel_init(void) | 29 | static void zoom_lcd_panel_init(void) |
25 | { | 30 | { |
26 | int ret; | 31 | zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? |
27 | unsigned char lcd_panel_reset_gpio; | ||
28 | |||
29 | lcd_panel_reset_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? | ||
30 | LCD_PANEL_RESET_GPIO_PROD : | 32 | LCD_PANEL_RESET_GPIO_PROD : |
31 | LCD_PANEL_RESET_GPIO_PILOT; | 33 | LCD_PANEL_RESET_GPIO_PILOT; |
32 | 34 | ||
33 | ret = gpio_request(lcd_panel_reset_gpio, "lcd reset"); | 35 | if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios))) |
34 | if (ret) { | 36 | pr_err("%s: Failed to get LCD GPIOs.\n", __func__); |
35 | pr_err("Failed to get LCD reset GPIO (gpio%d).\n", | ||
36 | lcd_panel_reset_gpio); | ||
37 | return; | ||
38 | } | ||
39 | gpio_direction_output(lcd_panel_reset_gpio, 1); | ||
40 | |||
41 | ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga"); | ||
42 | if (ret) { | ||
43 | pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n", | ||
44 | LCD_PANEL_QVGA_GPIO); | ||
45 | goto err0; | ||
46 | } | ||
47 | gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1); | ||
48 | |||
49 | return; | ||
50 | err0: | ||
51 | gpio_free(lcd_panel_reset_gpio); | ||
52 | } | 37 | } |
53 | 38 | ||
54 | static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev) | 39 | static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev) |
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 489294a715ce..118c6f53c5eb 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -277,13 +277,11 @@ static int zoom_twl_gpio_setup(struct device *dev, | |||
277 | zoom_vsim_supply.dev = mmc[0].dev; | 277 | zoom_vsim_supply.dev = mmc[0].dev; |
278 | zoom_vmmc2_supply.dev = mmc[1].dev; | 278 | zoom_vmmc2_supply.dev = mmc[1].dev; |
279 | 279 | ||
280 | ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable"); | 280 | ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, |
281 | if (ret) { | 281 | "lcd enable"); |
282 | if (ret) | ||
282 | pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", | 283 | pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", |
283 | LCD_PANEL_ENABLE_GPIO); | 284 | LCD_PANEL_ENABLE_GPIO); |
284 | return ret; | ||
285 | } | ||
286 | gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0); | ||
287 | 285 | ||
288 | return ret; | 286 | return ret; |
289 | } | 287 | } |
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c index 877c6f5807b7..ba10c24f3d8d 100644 --- a/arch/arm/mach-omap2/gpmc-smc91x.c +++ b/arch/arm/mach-omap2/gpmc-smc91x.c | |||
@@ -147,25 +147,24 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) | |||
147 | goto free1; | 147 | goto free1; |
148 | } | 148 | } |
149 | 149 | ||
150 | if (gpio_request(gpmc_cfg->gpio_irq, "SMC91X irq") < 0) | 150 | if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0) |
151 | goto free1; | 151 | goto free1; |
152 | 152 | ||
153 | gpio_direction_input(gpmc_cfg->gpio_irq); | ||
154 | gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); | 153 | gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); |
155 | 154 | ||
156 | if (gpmc_cfg->gpio_pwrdwn) { | 155 | if (gpmc_cfg->gpio_pwrdwn) { |
157 | ret = gpio_request(gpmc_cfg->gpio_pwrdwn, "SMC91X powerdown"); | 156 | ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn, |
157 | GPIOF_OUT_INIT_LOW, "SMC91X powerdown"); | ||
158 | if (ret) | 158 | if (ret) |
159 | goto free2; | 159 | goto free2; |
160 | gpio_direction_output(gpmc_cfg->gpio_pwrdwn, 0); | ||
161 | } | 160 | } |
162 | 161 | ||
163 | if (gpmc_cfg->gpio_reset) { | 162 | if (gpmc_cfg->gpio_reset) { |
164 | ret = gpio_request(gpmc_cfg->gpio_reset, "SMC91X reset"); | 163 | ret = gpio_request_one(gpmc_cfg->gpio_reset, |
164 | GPIOF_OUT_INIT_LOW, "SMC91X reset"); | ||
165 | if (ret) | 165 | if (ret) |
166 | goto free3; | 166 | goto free3; |
167 | 167 | ||
168 | gpio_direction_output(gpmc_cfg->gpio_reset, 0); | ||
169 | gpio_set_value(gpmc_cfg->gpio_reset, 1); | 168 | gpio_set_value(gpmc_cfg->gpio_reset, 1); |
170 | msleep(100); | 169 | msleep(100); |
171 | gpio_set_value(gpmc_cfg->gpio_reset, 0); | 170 | gpio_set_value(gpmc_cfg->gpio_reset, 0); |
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c index e09374a48dd8..997033129d26 100644 --- a/arch/arm/mach-omap2/gpmc-smsc911x.c +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c | |||
@@ -63,23 +63,22 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) | |||
63 | gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0; | 63 | gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0; |
64 | gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff; | 64 | gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff; |
65 | 65 | ||
66 | if (gpio_request(gpmc_cfg->gpio_irq, "smsc911x irq") < 0) { | 66 | if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq")) { |
67 | pr_err("Failed to request IRQ GPIO%d\n", gpmc_cfg->gpio_irq); | 67 | pr_err("Failed to request IRQ GPIO%d\n", gpmc_cfg->gpio_irq); |
68 | goto free1; | 68 | goto free1; |
69 | } | 69 | } |
70 | 70 | ||
71 | gpio_direction_input(gpmc_cfg->gpio_irq); | ||
72 | gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); | 71 | gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); |
73 | 72 | ||
74 | if (gpio_is_valid(gpmc_cfg->gpio_reset)) { | 73 | if (gpio_is_valid(gpmc_cfg->gpio_reset)) { |
75 | ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset"); | 74 | ret = gpio_request_one(gpmc_cfg->gpio_reset, |
75 | GPIOF_OUT_INIT_HIGH, "smsc911x reset"); | ||
76 | if (ret) { | 76 | if (ret) { |
77 | pr_err("Failed to request reset GPIO%d\n", | 77 | pr_err("Failed to request reset GPIO%d\n", |
78 | gpmc_cfg->gpio_reset); | 78 | gpmc_cfg->gpio_reset); |
79 | goto free2; | 79 | goto free2; |
80 | } | 80 | } |
81 | 81 | ||
82 | gpio_direction_output(gpmc_cfg->gpio_reset, 1); | ||
83 | gpio_set_value(gpmc_cfg->gpio_reset, 0); | 82 | gpio_set_value(gpmc_cfg->gpio_reset, 0); |
84 | msleep(100); | 83 | msleep(100); |
85 | gpio_set_value(gpmc_cfg->gpio_reset, 1); | 84 | gpio_set_value(gpmc_cfg->gpio_reset, 1); |
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index 8a3c05f3c1d6..8dd26b765b7d 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
@@ -293,12 +293,11 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
293 | ); | 293 | ); |
294 | 294 | ||
295 | /* IRQ */ | 295 | /* IRQ */ |
296 | status = gpio_request(irq, "TUSB6010 irq"); | 296 | status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); |
297 | if (status < 0) { | 297 | if (status < 0) { |
298 | printk(error, 3, status); | 298 | printk(error, 3, status); |
299 | return status; | 299 | return status; |
300 | } | 300 | } |
301 | gpio_direction_input(irq); | ||
302 | tusb_resources[2].start = irq + IH_GPIO_BASE; | 301 | tusb_resources[2].start = irq + IH_GPIO_BASE; |
303 | 302 | ||
304 | /* set up memory timings ... can speed them up later */ | 303 | /* set up memory timings ... can speed them up later */ |