kernel: bump 5.4 to 5.4.67
[openwrt/openwrt.git] / target / linux / bcm63xx / patches-5.4 / 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 @@ -666,6 +666,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 @@ -62,6 +62,9 @@ static int ehci_platform_reset(struct us
38
39 ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
40
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 if (retval < 0)
47 --- a/drivers/usb/host/ehci.h
48 +++ b/drivers/usb/host/ehci.h
49 @@ -203,6 +203,7 @@ struct ehci_hcd { /* one per controlle
50 u32 command;
51
52 /* SILICON QUIRKS */
53 + unsigned int num_ports;
54 unsigned no_selective_suspend:1;
55 unsigned has_fsl_port_bug:1; /* FreeScale */
56 unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */
57 --- a/include/linux/usb/ehci_pdriver.h
58 +++ b/include/linux/usb/ehci_pdriver.h
59 @@ -43,6 +43,7 @@ struct usb_hcd;
60 */
61 struct usb_ehci_pdata {
62 int caps_offset;
63 + unsigned int num_ports;
64 unsigned has_tt:1;
65 unsigned has_synopsys_hc_bug:1;
66 unsigned big_endian_desc:1;