[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

Commit cc9f9aef authored by Jean-Christophe PLAGNIOL-VILLARD's avatar Jean-Christophe PLAGNIOL-VILLARD Committed by Arnd Bergmann

ARM: at91/soc: use gpio_is_valid to check the gpio

Signed-off-by: 's avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
parent 63b4c296
...@@ -76,7 +76,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) ...@@ -76,7 +76,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */ /* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) { for (i = 0; i < data->ports; i++) {
if (data->vbus_pin[i]) if (gpio_is_valid(data->vbus_pin[i]))
at91_set_gpio_output(data->vbus_pin[i], 0); at91_set_gpio_output(data->vbus_pin[i], 0);
} }
...@@ -179,7 +179,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) ...@@ -179,7 +179,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data)
usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
if (data && data->vbus_pin > 0) { if (data && gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
usba_udc_data.pdata.vbus_pin = data->vbus_pin; 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,7 +232,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data)
if (!data) if (!data)
return; return;
if (data->phy_irq_pin) { if (gpio_is_valid(data->phy_irq_pin)) {
at91_set_gpio_input(data->phy_irq_pin, 0); at91_set_gpio_input(data->phy_irq_pin, 0);
at91_set_deglitch(data->phy_irq_pin, 1); at91_set_deglitch(data->phy_irq_pin, 1);
} }
...@@ -332,13 +332,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) ...@@ -332,13 +332,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
if (mmc_id == 0) { /* MCI0 */ if (mmc_id == 0) { /* MCI0 */
...@@ -425,15 +425,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -425,15 +425,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
nand_data = *data; nand_data = *data;
...@@ -816,7 +816,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) ...@@ -816,7 +816,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */
/* reset */ /* reset */
if (data->reset_pin) if (gpio_is_valid(data->reset_pin))
at91_set_gpio_output(data->reset_pin, 0); at91_set_gpio_output(data->reset_pin, 0);
ac97_data = *data; ac97_data = *data;
......
...@@ -114,11 +114,11 @@ void __init at91_add_device_udc(struct at91_udc_data *data) ...@@ -114,11 +114,11 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
if (!data) if (!data)
return; return;
if (data->vbus_pin) { if (gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
} }
if (data->pullup_pin) if (gpio_is_valid(data->pullup_pin))
at91_set_gpio_output(data->pullup_pin, 0); at91_set_gpio_output(data->pullup_pin, 0);
udc_data = *data; udc_data = *data;
...@@ -167,7 +167,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) ...@@ -167,7 +167,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data)
if (!data) if (!data)
return; return;
if (data->phy_irq_pin) { if (gpio_is_valid(data->phy_irq_pin)) {
at91_set_gpio_input(data->phy_irq_pin, 0); at91_set_gpio_input(data->phy_irq_pin, 0);
at91_set_deglitch(data->phy_irq_pin, 1); at91_set_deglitch(data->phy_irq_pin, 1);
} }
...@@ -260,7 +260,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) ...@@ -260,7 +260,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
); );
/* input/irq */ /* input/irq */
if (data->irq_pin) { if (gpio_is_valid(data->irq_pin)) {
at91_set_gpio_input(data->irq_pin, 1); at91_set_gpio_input(data->irq_pin, 1);
at91_set_deglitch(data->irq_pin, 1); at91_set_deglitch(data->irq_pin, 1);
} }
...@@ -268,7 +268,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) ...@@ -268,7 +268,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
/* outputs, initially off */ /* outputs, initially off */
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
at91_set_gpio_output(data->rst_pin, 0); at91_set_gpio_output(data->rst_pin, 0);
...@@ -328,13 +328,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) ...@@ -328,13 +328,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
/* CLK */ /* CLK */
...@@ -419,15 +419,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -419,15 +419,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
); );
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
......
...@@ -115,7 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) ...@@ -115,7 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
if (!data) if (!data)
return; return;
if (data->vbus_pin) { if (gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
} }
...@@ -168,7 +168,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) ...@@ -168,7 +168,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data)
if (!data) if (!data)
return; return;
if (data->phy_irq_pin) { if (gpio_is_valid(data->phy_irq_pin)) {
at91_set_gpio_input(data->phy_irq_pin, 0); at91_set_gpio_input(data->phy_irq_pin, 0);
at91_set_deglitch(data->phy_irq_pin, 1); at91_set_deglitch(data->phy_irq_pin, 1);
} }
...@@ -243,13 +243,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) ...@@ -243,13 +243,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
/* CLK */ /* CLK */
...@@ -330,11 +330,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) ...@@ -330,11 +330,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
if (data->slot[i].bus_width) { if (data->slot[i].bus_width) {
/* input/irq */ /* input/irq */
if (data->slot[i].detect_pin) { if (gpio_is_valid(data->slot[i].detect_pin)) {
at91_set_gpio_input(data->slot[i].detect_pin, 1); at91_set_gpio_input(data->slot[i].detect_pin, 1);
at91_set_deglitch(data->slot[i].detect_pin, 1); at91_set_deglitch(data->slot[i].detect_pin, 1);
} }
if (data->slot[i].wp_pin) if (gpio_is_valid(data->slot[i].wp_pin))
at91_set_gpio_input(data->slot[i].wp_pin, 1); at91_set_gpio_input(data->slot[i].wp_pin, 1);
switch (i) { switch (i) {
...@@ -426,15 +426,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -426,15 +426,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
nand_data = *data; nand_data = *data;
...@@ -1290,17 +1290,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) ...@@ -1290,17 +1290,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa); at91_sys_write(AT91_MATRIX_EBICSA, csa);
if (data->rst_pin) { if (gpio_is_valid(data->rst_pin)) {
at91_set_multi_drive(data->rst_pin, 0); at91_set_multi_drive(data->rst_pin, 0);
at91_set_gpio_output(data->rst_pin, 1); at91_set_gpio_output(data->rst_pin, 1);
} }
if (data->irq_pin) { if (gpio_is_valid(data->irq_pin)) {
at91_set_gpio_input(data->irq_pin, 0); at91_set_gpio_input(data->irq_pin, 0);
at91_set_deglitch(data->irq_pin, 1); at91_set_deglitch(data->irq_pin, 1);
} }
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 0); at91_set_gpio_input(data->det_pin, 0);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
......
...@@ -118,7 +118,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) ...@@ -118,7 +118,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
if (!data) if (!data)
return; return;
if (data->vbus_pin) { if (gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
} }
...@@ -171,13 +171,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) ...@@ -171,13 +171,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
/* CLK */ /* CLK */
...@@ -240,15 +240,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -240,15 +240,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */
......
...@@ -70,7 +70,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) ...@@ -70,7 +70,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */ /* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) { for (i = 0; i < data->ports; i++) {
if (data->vbus_pin[i]) if (gpio_is_valid(data->vbus_pin[i]))
at91_set_gpio_output(data->vbus_pin[i], 0); at91_set_gpio_output(data->vbus_pin[i], 0);
} }
...@@ -123,7 +123,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) ...@@ -123,7 +123,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
if (!data) if (!data)
return; return;
if (data->vbus_pin) { if (gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
} }
...@@ -176,7 +176,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) ...@@ -176,7 +176,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data)
if (!data) if (!data)
return; return;
if (data->phy_irq_pin) { if (gpio_is_valid(data->phy_irq_pin)) {
at91_set_gpio_input(data->phy_irq_pin, 0); at91_set_gpio_input(data->phy_irq_pin, 0);
at91_set_deglitch(data->phy_irq_pin, 1); at91_set_deglitch(data->phy_irq_pin, 1);
} }
...@@ -276,13 +276,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) ...@@ -276,13 +276,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
if (mmc_id == 0) { /* MCI0 */ if (mmc_id == 0) { /* MCI0 */
...@@ -430,17 +430,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) ...@@ -430,17 +430,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
} }
at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa);
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->irq_pin) { if (gpio_is_valid(data->irq_pin)) {
at91_set_gpio_input(data->irq_pin, 1); at91_set_gpio_input(data->irq_pin, 1);
at91_set_deglitch(data->irq_pin, 1); at91_set_deglitch(data->irq_pin, 1);
} }
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
/* initially off */ /* initially off */
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
...@@ -500,15 +500,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -500,15 +500,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
nand_data = *data; nand_data = *data;
...@@ -749,7 +749,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) ...@@ -749,7 +749,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */
/* reset */ /* reset */
if (data->reset_pin) if (gpio_is_valid(data->reset_pin))
at91_set_gpio_output(data->reset_pin, 0); at91_set_gpio_output(data->reset_pin, 0);
ac97_data = *data; ac97_data = *data;
......
...@@ -120,7 +120,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) ...@@ -120,7 +120,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */ /* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) { for (i = 0; i < data->ports; i++) {
if (data->vbus_pin[i]) if (gpio_is_valid(data->vbus_pin[i]))
at91_set_gpio_output(data->vbus_pin[i], 0); at91_set_gpio_output(data->vbus_pin[i], 0);
} }
...@@ -181,7 +181,7 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) ...@@ -181,7 +181,7 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
/* Enable VBus control for UHP ports */ /* Enable VBus control for UHP ports */
for (i = 0; i < data->ports; i++) { for (i = 0; i < data->ports; i++) {
if (data->vbus_pin[i]) if (gpio_is_valid(data->vbus_pin[i]))
at91_set_gpio_output(data->vbus_pin[i], 0); at91_set_gpio_output(data->vbus_pin[i], 0);
} }
...@@ -263,7 +263,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) ...@@ -263,7 +263,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data)
usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
if (data && data->vbus_pin > 0) { if (data && gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
usba_udc_data.pdata.vbus_pin = data->vbus_pin; 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,7 +316,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data)
if (!data) if (!data)
return; return;
if (data->phy_irq_pin) { if (gpio_is_valid(data->phy_irq_pin)) {
at91_set_gpio_input(data->phy_irq_pin, 0); at91_set_gpio_input(data->phy_irq_pin, 0);
at91_set_deglitch(data->phy_irq_pin, 1); at91_set_deglitch(data->phy_irq_pin, 1);
} }
...@@ -449,11 +449,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) ...@@ -449,11 +449,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
/* input/irq */ /* input/irq */
if (data->slot[0].detect_pin) { if (gpio_is_valid(data->slot[0].detect_pin)) {
at91_set_gpio_input(data->slot[0].detect_pin, 1); at91_set_gpio_input(data->slot[0].detect_pin, 1);
at91_set_deglitch(data->slot[0].detect_pin, 1); at91_set_deglitch(data->slot[0].detect_pin, 1);
} }
if (data->slot[0].wp_pin) if (gpio_is_valid(data->slot[0].wp_pin))
at91_set_gpio_input(data->slot[0].wp_pin, 1); at91_set_gpio_input(data->slot[0].wp_pin, 1);
if (mmc_id == 0) { /* MCI0 */ if (mmc_id == 0) { /* MCI0 */
...@@ -556,15 +556,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -556,15 +556,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA);
/* enable pin */ /* enable pin */
if (data->enable_pin) if (gpio_is_valid(data->enable_pin))
at91_set_gpio_output(data->enable_pin, 1); at91_set_gpio_output(data->enable_pin, 1);
/* ready/busy pin */ /* ready/busy pin */
if (data->rdy_pin) if (gpio_is_valid(data->rdy_pin))
at91_set_gpio_input(data->rdy_pin, 1); at91_set_gpio_input(data->rdy_pin, 1);
/* card detect pin */ /* card detect pin */
if (data->det_pin) if (gpio_is_valid(data->det_pin))
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
nand_data = *data; nand_data = *data;
...@@ -859,7 +859,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) ...@@ -859,7 +859,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */
/* reset */ /* reset */
if (data->reset_pin) if (gpio_is_valid(data->reset_pin))
at91_set_gpio_output(data->reset_pin, 0); at91_set_gpio_output(data->reset_pin, 0);
ac97_data = *data; ac97_data = *data;
......
...@@ -147,7 +147,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) ...@@ -147,7 +147,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data)
usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));
if (data && data->vbus_pin > 0) { if (data && gpio_is_valid(data->vbus_pin)) {
at91_set_gpio_input(data->vbus_pin, 0); at91_set_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); at91_set_deglitch(data->vbus_pin, 1);
usba_udc_data.pdata.vbus_pin = data->vbus_pin; 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,13 +201,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
return; return;
/* input/irq */ /* input/irq */
if (data->det_pin) { if (gpio_is_valid(data->det_pin)) {
at91_set_gpio_input(data->det_pin, 1); at91_set_gpio_input(data->det_pin, 1);
at91_set_deglitch(data->det_pin, 1); at91_set_deglitch(data->det_pin, 1);
} }
if (data->wp_pin) if (gpio_is_valid(data->wp_pin))
at91_set_gpio_input(data->wp_pin, 1); at91_set_gpio_input(data->wp_pin, 1);
if (data->vcc_pin) if (gpio_is_valid(data->vcc_pin))
at91_set_gpio_output(data->vcc_pin, 0); at91_set_gpio_output(data->vcc_pin, 0);
/* CLK */ /* CLK */
...@@ -275,15 +275,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) ...@@ -275,15 +275,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)
at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);