Skip to content

Commit 6fffb77

Browse files
Nicolas Ferregregkh
authored andcommitted
USB: ohci-at91: fix PIO handling in relation with number of ports
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 <[email protected]> Signed-off-by: Nicolas Ferre <[email protected]> Cc: Stable <[email protected]> [3.4+] Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 26a538b commit 6fffb77

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/usb/host/ohci-at91.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,16 @@ static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
570570

571571
if (pdata) {
572572
at91_for_each_port(i) {
573+
/*
574+
* do not configure PIO if not in relation with
575+
* real USB port on board
576+
*/
577+
if (i >= pdata->ports) {
578+
pdata->vbus_pin[i] = -EINVAL;
579+
pdata->overcurrent_pin[i] = -EINVAL;
580+
break;
581+
}
582+
573583
if (!gpio_is_valid(pdata->vbus_pin[i]))
574584
continue;
575585
gpio = pdata->vbus_pin[i];

0 commit comments

Comments
 (0)