]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
at91: ohci-at91: add vbus_pin_inverted platform attribute
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 13 Jul 2011 09:29:16 +0000 (11:29 +0200)
committerArnd Bergmann <arnd@arndb.de>
Sat, 10 Sep 2011 21:03:13 +0000 (23:03 +0200)
The existing OHCI AT91 driver made the assumption that the enable
input of the USB power switch was active low. However, some USB power
switches such as the Micrel MIC2026-1 [1] have an active high input to
enable the power. A new vbus_pin_inverted attribute is added to the
at91_usbh_data structure so that board files can tell the OHCI driver
if the vbus pin logic is active low or active high.

[1] http://www.micrel.com/page.do?page=product-info/products/mic2026.shtml

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
arch/arm/mach-at91/include/mach/board.h
drivers/usb/host/ohci-at91.c

index ed544a0d5a1d8b5ce5bc4681ed7e83ef704ab41d..61d52dc050518890bfff8f812af745bd9f6810c0 100644 (file)
@@ -98,6 +98,7 @@ extern void __init at91_add_device_eth(struct at91_eth_data *data);
 struct at91_usbh_data {
        u8              ports;          /* number of ports on root hub */
        u8              vbus_pin[2];    /* port power-control pin */
+       u8              vbus_pin_inverted;
 };
 extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
 extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
index e08cb10d1aca96ef8cf43122db40a626c2b0fabe..5dd381fc2ddb8c18592a8a481e65a7d14e2eeb40 100644 (file)
@@ -279,7 +279,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
                        if (pdata->vbus_pin[i] <= 0)
                                continue;
                        gpio_request(pdata->vbus_pin[i], "ohci_vbus");
-                       gpio_direction_output(pdata->vbus_pin[i], 0);
+                       gpio_direction_output(pdata->vbus_pin[i], pdata->vbus_pin_inverted);
                }
        }
 
@@ -296,7 +296,7 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
                for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
                        if (pdata->vbus_pin[i] <= 0)
                                continue;
-                       gpio_direction_output(pdata->vbus_pin[i], 1);
+                       gpio_direction_output(pdata->vbus_pin[i], !pdata->vbus_pin_inverted);
                        gpio_free(pdata->vbus_pin[i]);
                }
        }