USB: ohci: allow platform driver to specify the number of ports
authorFlorian Fainelli <florian@openwrt.org>
Mon, 8 Oct 2012 13:11:26 +0000 (15:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 18:23:59 +0000 (11:23 -0700)
This patch modifies the ohci platform driver to accept the num_ports
parameter to be set via platform_data. Setting the number of ports must be
done after the call to ohci_hcd_init().

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ohci-platform.c
include/linux/usb/ohci_pdriver.h

index e24ec9f79164afc9e6563a147cb76d4c0f3c96c3..1caaf657c5ea1cddf7930e0bf72f0b0c74e10ac5 100644 (file)
@@ -31,6 +31,10 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
                ohci->flags |= OHCI_QUIRK_FRAME_NO;
 
        ohci_hcd_init(ohci);
+
+       if (pdata->num_ports)
+               ohci->num_ports = pdata->num_ports;
+
        err = ohci_init(ohci);
 
        return err;
index 74e7755168b72c3efed2c39e46a39d7eefc5f858..012f2b7eb2b6b299e21596a9e650487759815dfb 100644 (file)
@@ -25,6 +25,7 @@
  * @big_endian_desc:   BE descriptors
  * @big_endian_mmio:   BE registers
  * @no_big_frame_no:   no big endian frame_no shift
+ * @num_ports:         number of ports
  *
  * These are general configuration options for the OHCI controller. All of
  * these options are activating more or less workarounds for some hardware.
@@ -33,6 +34,7 @@ struct usb_ohci_pdata {
        unsigned        big_endian_desc:1;
        unsigned        big_endian_mmio:1;
        unsigned        no_big_frame_no:1;
+       unsigned int    num_ports;
 
        /* Turn on all power and clocks */
        int (*power_on)(struct platform_device *pdev);