summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2012-08-29 11:49:18 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-02 10:30:20 -0700
commit61fee2c3e35d8496685317c4e17c98e8905ba762 (patch)
treee0f4c4d4a7a904fbc15c2b46c34b534388c155c9
parent5527f1341645e192145f7e581230dcf4447dd8c7 (diff)
USB: ohci-at91: fix PIO handling in relation with number of ports
commit 6fffb77c8393151b0cf8cef1b9c2ba90587dd2e8 upstream. If the number of ports present on the SoC/board is not the maximum and that the platform data is not filled with all data, there is an easy way to mess the PIO setup for this interface. This quick fix addresses mis-configuration in USB host platform data that is common in at91 boards since commit 0ee6d1e (USB: ohci-at91: change maximum number of ports) that did not modified the associatd board files. Reported-by: Klaus Falkner <klaus.falkner@solectrix.de> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/ohci-at91.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 55d3d6414478..50bd3f1e3307 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -569,6 +569,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
if (pdata) {
at91_for_each_port(i) {
+ /*
+ * do not configure PIO if not in relation with
+ * real USB port on board
+ */
+ if (i >= pdata->ports) {
+ pdata->vbus_pin[i] = -EINVAL;
+ pdata->overcurrent_pin[i] = -EINVAL;
+ break;
+ }
+
if (!gpio_is_valid(pdata->vbus_pin[i]))
continue;
gpio = pdata->vbus_pin[i];