mediatek: backport upstream mediatek patches
[oweals/openwrt.git] / target / linux / mediatek / patches-4.14 / 0127-usb-xhci-mtk-use-ports-count-from-xhci-in-xhci_mtk_s.patch
1 From f97aa71fe34135e7fc8da6231e61ee06f79d739d Mon Sep 17 00:00:00 2001
2 From: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 Date: Fri, 13 Oct 2017 16:26:34 +0800
4 Subject: [PATCH 127/224] usb: xhci-mtk: use ports count from xhci in
5  xhci_mtk_sch_init()
6
7 Make use of ports count from xhci but not from ippc in
8 xhci_mtk_sch_init()
9
10 Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
11 Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
12 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 ---
14  drivers/usb/host/xhci-mtk-sch.c | 3 ++-
15  drivers/usb/host/xhci-mtk.c     | 3 ---
16  2 files changed, 2 insertions(+), 4 deletions(-)
17
18 diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
19 index 6e7ddf6cafae..bfc51bc902b8 100644
20 --- a/drivers/usb/host/xhci-mtk-sch.c
21 +++ b/drivers/usb/host/xhci-mtk-sch.c
22 @@ -287,12 +287,13 @@ static bool need_bw_sch(struct usb_host_endpoint *ep,
23  
24  int xhci_mtk_sch_init(struct xhci_hcd_mtk *mtk)
25  {
26 +       struct xhci_hcd *xhci = hcd_to_xhci(mtk->hcd);
27         struct mu3h_sch_bw_info *sch_array;
28         int num_usb_bus;
29         int i;
30  
31         /* ss IN and OUT are separated */
32 -       num_usb_bus = mtk->num_u3_ports * 2 + mtk->num_u2_ports;
33 +       num_usb_bus = xhci->num_usb3_ports * 2 + xhci->num_usb2_ports;
34  
35         sch_array = kcalloc(num_usb_bus, sizeof(*sch_array), GFP_KERNEL);
36         if (sch_array == NULL)
37 diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
38 index c197a6d9e157..9502ca408f01 100644
39 --- a/drivers/usb/host/xhci-mtk.c
40 +++ b/drivers/usb/host/xhci-mtk.c
41 @@ -492,7 +492,6 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
42  /* called during probe() after chip reset completes */
43  static int xhci_mtk_setup(struct usb_hcd *hcd)
44  {
45 -       struct xhci_hcd *xhci = hcd_to_xhci(hcd);
46         struct xhci_hcd_mtk *mtk = hcd_to_mtk(hcd);
47         int ret;
48  
49 @@ -507,8 +506,6 @@ static int xhci_mtk_setup(struct usb_hcd *hcd)
50                 return ret;
51  
52         if (usb_hcd_is_primary_hcd(hcd)) {
53 -               mtk->num_u3_ports = xhci->num_usb3_ports;
54 -               mtk->num_u2_ports = xhci->num_usb2_ports;
55                 ret = xhci_mtk_sch_init(mtk);
56                 if (ret)
57                         return ret;
58 -- 
59 2.11.0
60