brcm63xx: update development kernel to linux 3.14
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.14 / 206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch
1 From 6ac09efa8f0e189ffe7dd7b0889289de56ee44cc Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sun, 19 Jan 2014 12:18:03 +0100
4 Subject: [PATCH] USB: EHCI: allow limiting ports for ehci-platform
5
6 In the same way as the ohci platform driver allows limiting ports,
7 enable the same for ehci. This prevents a mismatch in the available
8 ports between ehci/ohci on USB 2.0 controllers.
9
10 This is needed if the USB host controller always reports the maximum
11 number of ports regardless of the number of available ports (because
12 one might be set to be usb device).
13
14 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
15 ---
16 drivers/usb/host/ehci-hcd.c | 4 ++++
17 drivers/usb/host/ehci-platform.c | 2 ++
18 drivers/usb/host/ehci.h | 1 +
19 include/linux/usb/ehci_pdriver.h | 1 +
20 4 files changed, 8 insertions(+)
21
22 --- a/drivers/usb/host/ehci-hcd.c
23 +++ b/drivers/usb/host/ehci-hcd.c
24 @@ -660,6 +660,10 @@ int ehci_setup(struct usb_hcd *hcd)
25
26 /* cache this readonly data; minimize chip reads */
27 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
28 + if (ehci->num_ports) {
29 + ehci->hcs_params &= ~0xf; /* bits 3:0, ports on HC */
30 + ehci->hcs_params |= ehci->num_ports;
31 + }
32
33 ehci->sbrn = HCD_USB2;
34
35 --- a/drivers/usb/host/ehci-platform.c
36 +++ b/drivers/usb/host/ehci-platform.c
37 @@ -48,6 +48,8 @@ static int ehci_platform_reset(struct us
38 ehci->big_endian_desc = pdata->big_endian_desc;
39 ehci->big_endian_mmio = pdata->big_endian_mmio;
40 ehci->ignore_oc = pdata->ignore_oc;
41 + if (pdata->num_ports && pdata->num_ports <= 15)
42 + ehci->num_ports = pdata->num_ports;
43
44 if (pdata->pre_setup) {
45 retval = pdata->pre_setup(hcd);
46 --- a/drivers/usb/host/ehci.h
47 +++ b/drivers/usb/host/ehci.h
48 @@ -213,6 +213,7 @@ struct ehci_hcd { /* one per controlle
49 u32 command;
50
51 /* SILICON QUIRKS */
52 + unsigned int num_ports;
53 unsigned no_selective_suspend:1;
54 unsigned has_fsl_port_bug:1; /* FreeScale */
55 unsigned big_endian_mmio:1;
56 --- a/include/linux/usb/ehci_pdriver.h
57 +++ b/include/linux/usb/ehci_pdriver.h
58 @@ -40,6 +40,7 @@ struct usb_hcd;
59 */
60 struct usb_ehci_pdata {
61 int caps_offset;
62 + unsigned int num_ports;
63 unsigned has_tt:1;
64 unsigned has_synopsys_hc_bug:1;
65 unsigned big_endian_desc:1;