diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-09-19 03:28:25 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-11-29 10:46:14 -0500 |
commit | cc9f9aef6ad3ebdda911e25b38222c215f7634f9 (patch) | |
tree | 26382188e2876795ae2573c4e0b6bf46463948bc | |
parent | 63b4c2967850033de0a488d2ba7cd09052199d99 (diff) |
ARM: at91/soc: use gpio_is_valid to check the gpio
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
-rw-r--r-- | arch/arm/mach-at91/at91cap9_devices.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 26 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 26 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9g45_devices.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 16 |
7 files changed, 72 insertions, 72 deletions
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c index 3f54eca3fca6..d298fb7cb210 100644 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -76,7 +76,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
76 | 76 | ||
77 | /* Enable VBus control for UHP ports */ | 77 | /* Enable VBus control for UHP ports */ |
78 | for (i = 0; i < data->ports; i++) { | 78 | for (i = 0; i < data->ports; i++) { |
79 | if (data->vbus_pin[i]) | 79 | if (gpio_is_valid(data->vbus_pin[i])) |
80 | at91_set_gpio_output(data->vbus_pin[i], 0); | 80 | at91_set_gpio_output(data->vbus_pin[i], 0); |
81 | } | 81 | } |
82 | 82 | ||
@@ -179,7 +179,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
179 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 179 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
180 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 180 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
181 | 181 | ||
182 | if (data && data->vbus_pin > 0) { | 182 | if (data && gpio_is_valid(data->vbus_pin)) { |
183 | at91_set_gpio_input(data->vbus_pin, 0); | 183 | at91_set_gpio_input(data->vbus_pin, 0); |
184 | at91_set_deglitch(data->vbus_pin, 1); | 184 | at91_set_deglitch(data->vbus_pin, 1); |
185 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 185 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -232,7 +232,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
232 | if (!data) | 232 | if (!data) |
233 | return; | 233 | return; |
234 | 234 | ||
235 | if (data->phy_irq_pin) { | 235 | if (gpio_is_valid(data->phy_irq_pin)) { |
236 | at91_set_gpio_input(data->phy_irq_pin, 0); | 236 | at91_set_gpio_input(data->phy_irq_pin, 0); |
237 | at91_set_deglitch(data->phy_irq_pin, 1); | 237 | at91_set_deglitch(data->phy_irq_pin, 1); |
238 | } | 238 | } |
@@ -332,13 +332,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
332 | return; | 332 | return; |
333 | 333 | ||
334 | /* input/irq */ | 334 | /* input/irq */ |
335 | if (data->det_pin) { | 335 | if (gpio_is_valid(data->det_pin)) { |
336 | at91_set_gpio_input(data->det_pin, 1); | 336 | at91_set_gpio_input(data->det_pin, 1); |
337 | at91_set_deglitch(data->det_pin, 1); | 337 | at91_set_deglitch(data->det_pin, 1); |
338 | } | 338 | } |
339 | if (data->wp_pin) | 339 | if (gpio_is_valid(data->wp_pin)) |
340 | at91_set_gpio_input(data->wp_pin, 1); | 340 | at91_set_gpio_input(data->wp_pin, 1); |
341 | if (data->vcc_pin) | 341 | if (gpio_is_valid(data->vcc_pin)) |
342 | at91_set_gpio_output(data->vcc_pin, 0); | 342 | at91_set_gpio_output(data->vcc_pin, 0); |
343 | 343 | ||
344 | if (mmc_id == 0) { /* MCI0 */ | 344 | if (mmc_id == 0) { /* MCI0 */ |
@@ -425,15 +425,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
425 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | 425 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); |
426 | 426 | ||
427 | /* enable pin */ | 427 | /* enable pin */ |
428 | if (data->enable_pin) | 428 | if (gpio_is_valid(data->enable_pin)) |
429 | at91_set_gpio_output(data->enable_pin, 1); | 429 | at91_set_gpio_output(data->enable_pin, 1); |
430 | 430 | ||
431 | /* ready/busy pin */ | 431 | /* ready/busy pin */ |
432 | if (data->rdy_pin) | 432 | if (gpio_is_valid(data->rdy_pin)) |
433 | at91_set_gpio_input(data->rdy_pin, 1); | 433 | at91_set_gpio_input(data->rdy_pin, 1); |
434 | 434 | ||
435 | /* card detect pin */ | 435 | /* card detect pin */ |
436 | if (data->det_pin) | 436 | if (gpio_is_valid(data->det_pin)) |
437 | at91_set_gpio_input(data->det_pin, 1); | 437 | at91_set_gpio_input(data->det_pin, 1); |
438 | 438 | ||
439 | nand_data = *data; | 439 | nand_data = *data; |
@@ -816,7 +816,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
816 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ | 816 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ |
817 | 817 | ||
818 | /* reset */ | 818 | /* reset */ |
819 | if (data->reset_pin) | 819 | if (gpio_is_valid(data->reset_pin)) |
820 | at91_set_gpio_output(data->reset_pin, 0); | 820 | at91_set_gpio_output(data->reset_pin, 0); |
821 | 821 | ||
822 | ac97_data = *data; | 822 | ac97_data = *data; |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index cb2244086113..064bbae65e5b 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -114,11 +114,11 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
114 | if (!data) | 114 | if (!data) |
115 | return; | 115 | return; |
116 | 116 | ||
117 | if (data->vbus_pin) { | 117 | if (gpio_is_valid(data->vbus_pin)) { |
118 | at91_set_gpio_input(data->vbus_pin, 0); | 118 | at91_set_gpio_input(data->vbus_pin, 0); |
119 | at91_set_deglitch(data->vbus_pin, 1); | 119 | at91_set_deglitch(data->vbus_pin, 1); |
120 | } | 120 | } |
121 | if (data->pullup_pin) | 121 | if (gpio_is_valid(data->pullup_pin)) |
122 | at91_set_gpio_output(data->pullup_pin, 0); | 122 | at91_set_gpio_output(data->pullup_pin, 0); |
123 | 123 | ||
124 | udc_data = *data; | 124 | udc_data = *data; |
@@ -167,7 +167,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
167 | if (!data) | 167 | if (!data) |
168 | return; | 168 | return; |
169 | 169 | ||
170 | if (data->phy_irq_pin) { | 170 | if (gpio_is_valid(data->phy_irq_pin)) { |
171 | at91_set_gpio_input(data->phy_irq_pin, 0); | 171 | at91_set_gpio_input(data->phy_irq_pin, 0); |
172 | at91_set_deglitch(data->phy_irq_pin, 1); | 172 | at91_set_deglitch(data->phy_irq_pin, 1); |
173 | } | 173 | } |
@@ -260,7 +260,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
260 | ); | 260 | ); |
261 | 261 | ||
262 | /* input/irq */ | 262 | /* input/irq */ |
263 | if (data->irq_pin) { | 263 | if (gpio_is_valid(data->irq_pin)) { |
264 | at91_set_gpio_input(data->irq_pin, 1); | 264 | at91_set_gpio_input(data->irq_pin, 1); |
265 | at91_set_deglitch(data->irq_pin, 1); | 265 | at91_set_deglitch(data->irq_pin, 1); |
266 | } | 266 | } |
@@ -268,7 +268,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
268 | at91_set_deglitch(data->det_pin, 1); | 268 | at91_set_deglitch(data->det_pin, 1); |
269 | 269 | ||
270 | /* outputs, initially off */ | 270 | /* outputs, initially off */ |
271 | if (data->vcc_pin) | 271 | if (gpio_is_valid(data->vcc_pin)) |
272 | at91_set_gpio_output(data->vcc_pin, 0); | 272 | at91_set_gpio_output(data->vcc_pin, 0); |
273 | at91_set_gpio_output(data->rst_pin, 0); | 273 | at91_set_gpio_output(data->rst_pin, 0); |
274 | 274 | ||
@@ -328,13 +328,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
328 | return; | 328 | return; |
329 | 329 | ||
330 | /* input/irq */ | 330 | /* input/irq */ |
331 | if (data->det_pin) { | 331 | if (gpio_is_valid(data->det_pin)) { |
332 | at91_set_gpio_input(data->det_pin, 1); | 332 | at91_set_gpio_input(data->det_pin, 1); |
333 | at91_set_deglitch(data->det_pin, 1); | 333 | at91_set_deglitch(data->det_pin, 1); |
334 | } | 334 | } |
335 | if (data->wp_pin) | 335 | if (gpio_is_valid(data->wp_pin)) |
336 | at91_set_gpio_input(data->wp_pin, 1); | 336 | at91_set_gpio_input(data->wp_pin, 1); |
337 | if (data->vcc_pin) | 337 | if (gpio_is_valid(data->vcc_pin)) |
338 | at91_set_gpio_output(data->vcc_pin, 0); | 338 | at91_set_gpio_output(data->vcc_pin, 0); |
339 | 339 | ||
340 | /* CLK */ | 340 | /* CLK */ |
@@ -419,15 +419,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
419 | ); | 419 | ); |
420 | 420 | ||
421 | /* enable pin */ | 421 | /* enable pin */ |
422 | if (data->enable_pin) | 422 | if (gpio_is_valid(data->enable_pin)) |
423 | at91_set_gpio_output(data->enable_pin, 1); | 423 | at91_set_gpio_output(data->enable_pin, 1); |
424 | 424 | ||
425 | /* ready/busy pin */ | 425 | /* ready/busy pin */ |
426 | if (data->rdy_pin) | 426 | if (gpio_is_valid(data->rdy_pin)) |
427 | at91_set_gpio_input(data->rdy_pin, 1); | 427 | at91_set_gpio_input(data->rdy_pin, 1); |
428 | 428 | ||
429 | /* card detect pin */ | 429 | /* card detect pin */ |
430 | if (data->det_pin) | 430 | if (gpio_is_valid(data->det_pin)) |
431 | at91_set_gpio_input(data->det_pin, 1); | 431 | at91_set_gpio_input(data->det_pin, 1); |
432 | 432 | ||
433 | at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ | 433 | at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index f6d8ccf42a8d..f9bcb251e338 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -115,7 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
115 | if (!data) | 115 | if (!data) |
116 | return; | 116 | return; |
117 | 117 | ||
118 | if (data->vbus_pin) { | 118 | if (gpio_is_valid(data->vbus_pin)) { |
119 | at91_set_gpio_input(data->vbus_pin, 0); | 119 | at91_set_gpio_input(data->vbus_pin, 0); |
120 | at91_set_deglitch(data->vbus_pin, 1); | 120 | at91_set_deglitch(data->vbus_pin, 1); |
121 | } | 121 | } |
@@ -168,7 +168,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
168 | if (!data) | 168 | if (!data) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | if (data->phy_irq_pin) { | 171 | if (gpio_is_valid(data->phy_irq_pin)) { |
172 | at91_set_gpio_input(data->phy_irq_pin, 0); | 172 | at91_set_gpio_input(data->phy_irq_pin, 0); |
173 | at91_set_deglitch(data->phy_irq_pin, 1); | 173 | at91_set_deglitch(data->phy_irq_pin, 1); |
174 | } | 174 | } |
@@ -243,13 +243,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
243 | return; | 243 | return; |
244 | 244 | ||
245 | /* input/irq */ | 245 | /* input/irq */ |
246 | if (data->det_pin) { | 246 | if (gpio_is_valid(data->det_pin)) { |
247 | at91_set_gpio_input(data->det_pin, 1); | 247 | at91_set_gpio_input(data->det_pin, 1); |
248 | at91_set_deglitch(data->det_pin, 1); | 248 | at91_set_deglitch(data->det_pin, 1); |
249 | } | 249 | } |
250 | if (data->wp_pin) | 250 | if (gpio_is_valid(data->wp_pin)) |
251 | at91_set_gpio_input(data->wp_pin, 1); | 251 | at91_set_gpio_input(data->wp_pin, 1); |
252 | if (data->vcc_pin) | 252 | if (gpio_is_valid(data->vcc_pin)) |
253 | at91_set_gpio_output(data->vcc_pin, 0); | 253 | at91_set_gpio_output(data->vcc_pin, 0); |
254 | 254 | ||
255 | /* CLK */ | 255 | /* CLK */ |
@@ -330,11 +330,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
330 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { | 330 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { |
331 | if (data->slot[i].bus_width) { | 331 | if (data->slot[i].bus_width) { |
332 | /* input/irq */ | 332 | /* input/irq */ |
333 | if (data->slot[i].detect_pin) { | 333 | if (gpio_is_valid(data->slot[i].detect_pin)) { |
334 | at91_set_gpio_input(data->slot[i].detect_pin, 1); | 334 | at91_set_gpio_input(data->slot[i].detect_pin, 1); |
335 | at91_set_deglitch(data->slot[i].detect_pin, 1); | 335 | at91_set_deglitch(data->slot[i].detect_pin, 1); |
336 | } | 336 | } |
337 | if (data->slot[i].wp_pin) | 337 | if (gpio_is_valid(data->slot[i].wp_pin)) |
338 | at91_set_gpio_input(data->slot[i].wp_pin, 1); | 338 | at91_set_gpio_input(data->slot[i].wp_pin, 1); |
339 | 339 | ||
340 | switch (i) { | 340 | switch (i) { |
@@ -426,15 +426,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
426 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 426 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
427 | 427 | ||
428 | /* enable pin */ | 428 | /* enable pin */ |
429 | if (data->enable_pin) | 429 | if (gpio_is_valid(data->enable_pin)) |
430 | at91_set_gpio_output(data->enable_pin, 1); | 430 | at91_set_gpio_output(data->enable_pin, 1); |
431 | 431 | ||
432 | /* ready/busy pin */ | 432 | /* ready/busy pin */ |
433 | if (data->rdy_pin) | 433 | if (gpio_is_valid(data->rdy_pin)) |
434 | at91_set_gpio_input(data->rdy_pin, 1); | 434 | at91_set_gpio_input(data->rdy_pin, 1); |
435 | 435 | ||
436 | /* card detect pin */ | 436 | /* card detect pin */ |
437 | if (data->det_pin) | 437 | if (gpio_is_valid(data->det_pin)) |
438 | at91_set_gpio_input(data->det_pin, 1); | 438 | at91_set_gpio_input(data->det_pin, 1); |
439 | 439 | ||
440 | nand_data = *data; | 440 | nand_data = *data; |
@@ -1290,17 +1290,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1290 | 1290 | ||
1291 | at91_sys_write(AT91_MATRIX_EBICSA, csa); | 1291 | at91_sys_write(AT91_MATRIX_EBICSA, csa); |
1292 | 1292 | ||
1293 | if (data->rst_pin) { | 1293 | if (gpio_is_valid(data->rst_pin)) { |
1294 | at91_set_multi_drive(data->rst_pin, 0); | 1294 | at91_set_multi_drive(data->rst_pin, 0); |
1295 | at91_set_gpio_output(data->rst_pin, 1); | 1295 | at91_set_gpio_output(data->rst_pin, 1); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | if (data->irq_pin) { | 1298 | if (gpio_is_valid(data->irq_pin)) { |
1299 | at91_set_gpio_input(data->irq_pin, 0); | 1299 | at91_set_gpio_input(data->irq_pin, 0); |
1300 | at91_set_deglitch(data->irq_pin, 1); | 1300 | at91_set_deglitch(data->irq_pin, 1); |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | if (data->det_pin) { | 1303 | if (gpio_is_valid(data->det_pin)) { |
1304 | at91_set_gpio_input(data->det_pin, 0); | 1304 | at91_set_gpio_input(data->det_pin, 0); |
1305 | at91_set_deglitch(data->det_pin, 1); | 1305 | at91_set_deglitch(data->det_pin, 1); |
1306 | } | 1306 | } |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index e5cff1d902d0..dff4c2de20c7 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -118,7 +118,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
118 | if (!data) | 118 | if (!data) |
119 | return; | 119 | return; |
120 | 120 | ||
121 | if (data->vbus_pin) { | 121 | if (gpio_is_valid(data->vbus_pin)) { |
122 | at91_set_gpio_input(data->vbus_pin, 0); | 122 | at91_set_gpio_input(data->vbus_pin, 0); |
123 | at91_set_deglitch(data->vbus_pin, 1); | 123 | at91_set_deglitch(data->vbus_pin, 1); |
124 | } | 124 | } |
@@ -171,13 +171,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
171 | return; | 171 | return; |
172 | 172 | ||
173 | /* input/irq */ | 173 | /* input/irq */ |
174 | if (data->det_pin) { | 174 | if (gpio_is_valid(data->det_pin)) { |
175 | at91_set_gpio_input(data->det_pin, 1); | 175 | at91_set_gpio_input(data->det_pin, 1); |
176 | at91_set_deglitch(data->det_pin, 1); | 176 | at91_set_deglitch(data->det_pin, 1); |
177 | } | 177 | } |
178 | if (data->wp_pin) | 178 | if (gpio_is_valid(data->wp_pin)) |
179 | at91_set_gpio_input(data->wp_pin, 1); | 179 | at91_set_gpio_input(data->wp_pin, 1); |
180 | if (data->vcc_pin) | 180 | if (gpio_is_valid(data->vcc_pin)) |
181 | at91_set_gpio_output(data->vcc_pin, 0); | 181 | at91_set_gpio_output(data->vcc_pin, 0); |
182 | 182 | ||
183 | /* CLK */ | 183 | /* CLK */ |
@@ -240,15 +240,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
240 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 240 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
241 | 241 | ||
242 | /* enable pin */ | 242 | /* enable pin */ |
243 | if (data->enable_pin) | 243 | if (gpio_is_valid(data->enable_pin)) |
244 | at91_set_gpio_output(data->enable_pin, 1); | 244 | at91_set_gpio_output(data->enable_pin, 1); |
245 | 245 | ||
246 | /* ready/busy pin */ | 246 | /* ready/busy pin */ |
247 | if (data->rdy_pin) | 247 | if (gpio_is_valid(data->rdy_pin)) |
248 | at91_set_gpio_input(data->rdy_pin, 1); | 248 | at91_set_gpio_input(data->rdy_pin, 1); |
249 | 249 | ||
250 | /* card detect pin */ | 250 | /* card detect pin */ |
251 | if (data->det_pin) | 251 | if (gpio_is_valid(data->det_pin)) |
252 | at91_set_gpio_input(data->det_pin, 1); | 252 | at91_set_gpio_input(data->det_pin, 1); |
253 | 253 | ||
254 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ | 254 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index b344ec8a9af2..a1d452b22514 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -70,7 +70,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
70 | 70 | ||
71 | /* Enable VBus control for UHP ports */ | 71 | /* Enable VBus control for UHP ports */ |
72 | for (i = 0; i < data->ports; i++) { | 72 | for (i = 0; i < data->ports; i++) { |
73 | if (data->vbus_pin[i]) | 73 | if (gpio_is_valid(data->vbus_pin[i])) |
74 | at91_set_gpio_output(data->vbus_pin[i], 0); | 74 | at91_set_gpio_output(data->vbus_pin[i], 0); |
75 | } | 75 | } |
76 | 76 | ||
@@ -123,7 +123,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
123 | if (!data) | 123 | if (!data) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | if (data->vbus_pin) { | 126 | if (gpio_is_valid(data->vbus_pin)) { |
127 | at91_set_gpio_input(data->vbus_pin, 0); | 127 | at91_set_gpio_input(data->vbus_pin, 0); |
128 | at91_set_deglitch(data->vbus_pin, 1); | 128 | at91_set_deglitch(data->vbus_pin, 1); |
129 | } | 129 | } |
@@ -176,7 +176,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
176 | if (!data) | 176 | if (!data) |
177 | return; | 177 | return; |
178 | 178 | ||
179 | if (data->phy_irq_pin) { | 179 | if (gpio_is_valid(data->phy_irq_pin)) { |
180 | at91_set_gpio_input(data->phy_irq_pin, 0); | 180 | at91_set_gpio_input(data->phy_irq_pin, 0); |
181 | at91_set_deglitch(data->phy_irq_pin, 1); | 181 | at91_set_deglitch(data->phy_irq_pin, 1); |
182 | } | 182 | } |
@@ -276,13 +276,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
276 | return; | 276 | return; |
277 | 277 | ||
278 | /* input/irq */ | 278 | /* input/irq */ |
279 | if (data->det_pin) { | 279 | if (gpio_is_valid(data->det_pin)) { |
280 | at91_set_gpio_input(data->det_pin, 1); | 280 | at91_set_gpio_input(data->det_pin, 1); |
281 | at91_set_deglitch(data->det_pin, 1); | 281 | at91_set_deglitch(data->det_pin, 1); |
282 | } | 282 | } |
283 | if (data->wp_pin) | 283 | if (gpio_is_valid(data->wp_pin)) |
284 | at91_set_gpio_input(data->wp_pin, 1); | 284 | at91_set_gpio_input(data->wp_pin, 1); |
285 | if (data->vcc_pin) | 285 | if (gpio_is_valid(data->vcc_pin)) |
286 | at91_set_gpio_output(data->vcc_pin, 0); | 286 | at91_set_gpio_output(data->vcc_pin, 0); |
287 | 287 | ||
288 | if (mmc_id == 0) { /* MCI0 */ | 288 | if (mmc_id == 0) { /* MCI0 */ |
@@ -430,17 +430,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
430 | } | 430 | } |
431 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); | 431 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); |
432 | 432 | ||
433 | if (data->det_pin) { | 433 | if (gpio_is_valid(data->det_pin)) { |
434 | at91_set_gpio_input(data->det_pin, 1); | 434 | at91_set_gpio_input(data->det_pin, 1); |
435 | at91_set_deglitch(data->det_pin, 1); | 435 | at91_set_deglitch(data->det_pin, 1); |
436 | } | 436 | } |
437 | 437 | ||
438 | if (data->irq_pin) { | 438 | if (gpio_is_valid(data->irq_pin)) { |
439 | at91_set_gpio_input(data->irq_pin, 1); | 439 | at91_set_gpio_input(data->irq_pin, 1); |
440 | at91_set_deglitch(data->irq_pin, 1); | 440 | at91_set_deglitch(data->irq_pin, 1); |
441 | } | 441 | } |
442 | 442 | ||
443 | if (data->vcc_pin) | 443 | if (gpio_is_valid(data->vcc_pin)) |
444 | /* initially off */ | 444 | /* initially off */ |
445 | at91_set_gpio_output(data->vcc_pin, 0); | 445 | at91_set_gpio_output(data->vcc_pin, 0); |
446 | 446 | ||
@@ -500,15 +500,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
500 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); | 500 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); |
501 | 501 | ||
502 | /* enable pin */ | 502 | /* enable pin */ |
503 | if (data->enable_pin) | 503 | if (gpio_is_valid(data->enable_pin)) |
504 | at91_set_gpio_output(data->enable_pin, 1); | 504 | at91_set_gpio_output(data->enable_pin, 1); |
505 | 505 | ||
506 | /* ready/busy pin */ | 506 | /* ready/busy pin */ |
507 | if (data->rdy_pin) | 507 | if (gpio_is_valid(data->rdy_pin)) |
508 | at91_set_gpio_input(data->rdy_pin, 1); | 508 | at91_set_gpio_input(data->rdy_pin, 1); |
509 | 509 | ||
510 | /* card detect pin */ | 510 | /* card detect pin */ |
511 | if (data->det_pin) | 511 | if (gpio_is_valid(data->det_pin)) |
512 | at91_set_gpio_input(data->det_pin, 1); | 512 | at91_set_gpio_input(data->det_pin, 1); |
513 | 513 | ||
514 | nand_data = *data; | 514 | nand_data = *data; |
@@ -749,7 +749,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
749 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ | 749 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ |
750 | 750 | ||
751 | /* reset */ | 751 | /* reset */ |
752 | if (data->reset_pin) | 752 | if (gpio_is_valid(data->reset_pin)) |
753 | at91_set_gpio_output(data->reset_pin, 0); | 753 | at91_set_gpio_output(data->reset_pin, 0); |
754 | 754 | ||
755 | ac97_data = *data; | 755 | ac97_data = *data; |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index fc3eb4d9c5c9..b7582dd10dc3 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -120,7 +120,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) | |||
120 | 120 | ||
121 | /* Enable VBus control for UHP ports */ | 121 | /* Enable VBus control for UHP ports */ |
122 | for (i = 0; i < data->ports; i++) { | 122 | for (i = 0; i < data->ports; i++) { |
123 | if (data->vbus_pin[i]) | 123 | if (gpio_is_valid(data->vbus_pin[i])) |
124 | at91_set_gpio_output(data->vbus_pin[i], 0); | 124 | at91_set_gpio_output(data->vbus_pin[i], 0); |
125 | } | 125 | } |
126 | 126 | ||
@@ -181,7 +181,7 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) | |||
181 | 181 | ||
182 | /* Enable VBus control for UHP ports */ | 182 | /* Enable VBus control for UHP ports */ |
183 | for (i = 0; i < data->ports; i++) { | 183 | for (i = 0; i < data->ports; i++) { |
184 | if (data->vbus_pin[i]) | 184 | if (gpio_is_valid(data->vbus_pin[i])) |
185 | at91_set_gpio_output(data->vbus_pin[i], 0); | 185 | at91_set_gpio_output(data->vbus_pin[i], 0); |
186 | } | 186 | } |
187 | 187 | ||
@@ -263,7 +263,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
265 | 265 | ||
266 | if (data && data->vbus_pin > 0) { | 266 | if (data && gpio_is_valid(data->vbus_pin)) { |
267 | at91_set_gpio_input(data->vbus_pin, 0); | 267 | at91_set_gpio_input(data->vbus_pin, 0); |
268 | at91_set_deglitch(data->vbus_pin, 1); | 268 | at91_set_deglitch(data->vbus_pin, 1); |
269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -316,7 +316,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
316 | if (!data) | 316 | if (!data) |
317 | return; | 317 | return; |
318 | 318 | ||
319 | if (data->phy_irq_pin) { | 319 | if (gpio_is_valid(data->phy_irq_pin)) { |
320 | at91_set_gpio_input(data->phy_irq_pin, 0); | 320 | at91_set_gpio_input(data->phy_irq_pin, 0); |
321 | at91_set_deglitch(data->phy_irq_pin, 1); | 321 | at91_set_deglitch(data->phy_irq_pin, 1); |
322 | } | 322 | } |
@@ -449,11 +449,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
449 | 449 | ||
450 | 450 | ||
451 | /* input/irq */ | 451 | /* input/irq */ |
452 | if (data->slot[0].detect_pin) { | 452 | if (gpio_is_valid(data->slot[0].detect_pin)) { |
453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); | 453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); |
454 | at91_set_deglitch(data->slot[0].detect_pin, 1); | 454 | at91_set_deglitch(data->slot[0].detect_pin, 1); |
455 | } | 455 | } |
456 | if (data->slot[0].wp_pin) | 456 | if (gpio_is_valid(data->slot[0].wp_pin)) |
457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); | 457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); |
458 | 458 | ||
459 | if (mmc_id == 0) { /* MCI0 */ | 459 | if (mmc_id == 0) { /* MCI0 */ |
@@ -556,15 +556,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | 556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); |
557 | 557 | ||
558 | /* enable pin */ | 558 | /* enable pin */ |
559 | if (data->enable_pin) | 559 | if (gpio_is_valid(data->enable_pin)) |
560 | at91_set_gpio_output(data->enable_pin, 1); | 560 | at91_set_gpio_output(data->enable_pin, 1); |
561 | 561 | ||
562 | /* ready/busy pin */ | 562 | /* ready/busy pin */ |
563 | if (data->rdy_pin) | 563 | if (gpio_is_valid(data->rdy_pin)) |
564 | at91_set_gpio_input(data->rdy_pin, 1); | 564 | at91_set_gpio_input(data->rdy_pin, 1); |
565 | 565 | ||
566 | /* card detect pin */ | 566 | /* card detect pin */ |
567 | if (data->det_pin) | 567 | if (gpio_is_valid(data->det_pin)) |
568 | at91_set_gpio_input(data->det_pin, 1); | 568 | at91_set_gpio_input(data->det_pin, 1); |
569 | 569 | ||
570 | nand_data = *data; | 570 | nand_data = *data; |
@@ -859,7 +859,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ | 859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ |
860 | 860 | ||
861 | /* reset */ | 861 | /* reset */ |
862 | if (data->reset_pin) | 862 | if (gpio_is_valid(data->reset_pin)) |
863 | at91_set_gpio_output(data->reset_pin, 0); | 863 | at91_set_gpio_output(data->reset_pin, 0); |
864 | 864 | ||
865 | ac97_data = *data; | 865 | ac97_data = *data; |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 366c1cfd4f77..61908dce9784 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -147,7 +147,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
147 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 147 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
148 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 148 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
149 | 149 | ||
150 | if (data && data->vbus_pin > 0) { | 150 | if (data && gpio_is_valid(data->vbus_pin)) { |
151 | at91_set_gpio_input(data->vbus_pin, 0); | 151 | at91_set_gpio_input(data->vbus_pin, 0); |
152 | at91_set_deglitch(data->vbus_pin, 1); | 152 | at91_set_deglitch(data->vbus_pin, 1); |
153 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 153 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -201,13 +201,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
201 | return; | 201 | return; |
202 | 202 | ||
203 | /* input/irq */ | 203 | /* input/irq */ |
204 | if (data->det_pin) { | 204 | if (gpio_is_valid(data->det_pin)) { |
205 | at91_set_gpio_input(data->det_pin, 1); | 205 | at91_set_gpio_input(data->det_pin, 1); |
206 | at91_set_deglitch(data->det_pin, 1); | 206 | at91_set_deglitch(data->det_pin, 1); |
207 | } | 207 | } |
208 | if (data->wp_pin) | 208 | if (gpio_is_valid(data->wp_pin)) |
209 | at91_set_gpio_input(data->wp_pin, 1); | 209 | at91_set_gpio_input(data->wp_pin, 1); |
210 | if (data->vcc_pin) | 210 | if (gpio_is_valid(data->vcc_pin)) |
211 | at91_set_gpio_output(data->vcc_pin, 0); | 211 | at91_set_gpio_output(data->vcc_pin, 0); |
212 | 212 | ||
213 | /* CLK */ | 213 | /* CLK */ |
@@ -275,15 +275,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
275 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 275 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
276 | 276 | ||
277 | /* enable pin */ | 277 | /* enable pin */ |
278 | if (data->enable_pin) | 278 | if (gpio_is_valid(data->enable_pin)) |
279 | at91_set_gpio_output(data->enable_pin, 1); | 279 | at91_set_gpio_output(data->enable_pin, 1); |
280 | 280 | ||
281 | /* ready/busy pin */ | 281 | /* ready/busy pin */ |
282 | if (data->rdy_pin) | 282 | if (gpio_is_valid(data->rdy_pin)) |
283 | at91_set_gpio_input(data->rdy_pin, 1); | 283 | at91_set_gpio_input(data->rdy_pin, 1); |
284 | 284 | ||
285 | /* card detect pin */ | 285 | /* card detect pin */ |
286 | if (data->det_pin) | 286 | if (gpio_is_valid(data->det_pin)) |
287 | at91_set_gpio_input(data->det_pin, 1); | 287 | at91_set_gpio_input(data->det_pin, 1); |
288 | 288 | ||
289 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ | 289 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ |
@@ -483,7 +483,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
483 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ | 483 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ |
484 | 484 | ||
485 | /* reset */ | 485 | /* reset */ |
486 | if (data->reset_pin) | 486 | if (gpio_is_valid(data->reset_pin)) |
487 | at91_set_gpio_output(data->reset_pin, 0); | 487 | at91_set_gpio_output(data->reset_pin, 0); |
488 | 488 | ||
489 | ac97_data = *data; | 489 | ac97_data = *data; |