b8a3e880ced93d076ffb744546add30afa965803
[openwrt/staging/mans0n.git] /
1 From 9f0dfb279b1dd505d5e10b10e4a78a62030978d8 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Thu, 23 Sep 2021 19:40:06 +0200
4 Subject: [PATCH] Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional for
5 Armada 3720"
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This reverts commit 3241929b67d28c83945d3191c6816a3271fd6b85.
11
12 Armada 3720 phy driver (phy-mvebu-a3700-comphy.c) does not return
13 -EOPNOTSUPP from phy_power_on() callback anymore.
14
15 So remove XHCI_SKIP_PHY_INIT flag from xhci_mvebu_a3700_plat_setup() and
16 then also whole xhci_mvebu_a3700_plat_setup() function which is there just
17 to handle -EOPNOTSUPP for XHCI_SKIP_PHY_INIT.
18
19 xhci plat_setup callback is not used by any other xhci plat driver, so
20 remove this callback completely.
21
22 Signed-off-by: Pali Rohár <pali@kernel.org>
23 Signed-off-by: Marek Behún <kabel@kernel.org>
24 Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
25 ---
26 drivers/usb/host/xhci-mvebu.c | 42 -----------------------------------
27 drivers/usb/host/xhci-mvebu.h | 6 -----
28 drivers/usb/host/xhci-plat.c | 20 +----------------
29 drivers/usb/host/xhci-plat.h | 1 -
30 4 files changed, 1 insertion(+), 68 deletions(-)
31
32 --- a/drivers/usb/host/xhci-mvebu.c
33 +++ b/drivers/usb/host/xhci-mvebu.c
34 @@ -8,7 +8,6 @@
35 #include <linux/mbus.h>
36 #include <linux/of.h>
37 #include <linux/platform_device.h>
38 -#include <linux/phy/phy.h>
39
40 #include <linux/usb.h>
41 #include <linux/usb/hcd.h>
42 @@ -74,47 +73,6 @@ int xhci_mvebu_mbus_init_quirk(struct us
43
44 return 0;
45 }
46 -
47 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
48 -{
49 - struct xhci_hcd *xhci = hcd_to_xhci(hcd);
50 - struct device *dev = hcd->self.controller;
51 - struct phy *phy;
52 - int ret;
53 -
54 - /* Old bindings miss the PHY handle */
55 - phy = of_phy_get(dev->of_node, "usb3-phy");
56 - if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
57 - return -EPROBE_DEFER;
58 - else if (IS_ERR(phy))
59 - goto phy_out;
60 -
61 - ret = phy_init(phy);
62 - if (ret)
63 - goto phy_put;
64 -
65 - ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
66 - if (ret)
67 - goto phy_exit;
68 -
69 - ret = phy_power_on(phy);
70 - if (ret == -EOPNOTSUPP) {
71 - /* Skip initializatin of XHCI PHY when it is unsupported by firmware */
72 - dev_warn(dev, "PHY unsupported by firmware\n");
73 - xhci->quirks |= XHCI_SKIP_PHY_INIT;
74 - }
75 - if (ret)
76 - goto phy_exit;
77 -
78 - phy_power_off(phy);
79 -phy_exit:
80 - phy_exit(phy);
81 -phy_put:
82 - of_phy_put(phy);
83 -phy_out:
84 -
85 - return 0;
86 -}
87
88 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
89 {
90 --- a/drivers/usb/host/xhci-mvebu.h
91 +++ b/drivers/usb/host/xhci-mvebu.h
92 @@ -12,18 +12,12 @@ struct usb_hcd;
93
94 #if IS_ENABLED(CONFIG_USB_XHCI_MVEBU)
95 int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd);
96 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd);
97 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd);
98 #else
99 static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
100 {
101 return 0;
102 }
103 -
104 -static inline int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
105 -{
106 - return 0;
107 -}
108
109 static inline int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
110 {
111 --- a/drivers/usb/host/xhci-plat.c
112 +++ b/drivers/usb/host/xhci-plat.c
113 @@ -44,16 +44,6 @@ static void xhci_priv_plat_start(struct
114 priv->plat_start(hcd);
115 }
116
117 -static int xhci_priv_plat_setup(struct usb_hcd *hcd)
118 -{
119 - struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
120 -
121 - if (!priv->plat_setup)
122 - return 0;
123 -
124 - return priv->plat_setup(hcd);
125 -}
126 -
127 static int xhci_priv_init_quirk(struct usb_hcd *hcd)
128 {
129 struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
130 @@ -121,7 +111,6 @@ static const struct xhci_plat_priv xhci_
131 };
132
133 static const struct xhci_plat_priv xhci_plat_marvell_armada3700 = {
134 - .plat_setup = xhci_mvebu_a3700_plat_setup,
135 .init_quirk = xhci_mvebu_a3700_init_quirk,
136 };
137
138 @@ -341,14 +330,7 @@ static int xhci_plat_probe(struct platfo
139
140 hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
141 xhci->shared_hcd->tpl_support = hcd->tpl_support;
142 -
143 - if (priv) {
144 - ret = xhci_priv_plat_setup(hcd);
145 - if (ret)
146 - goto disable_usb_phy;
147 - }
148 -
149 - if ((xhci->quirks & XHCI_SKIP_PHY_INIT) || (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)))
150 + if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
151 hcd->skip_phy_initialization = 1;
152
153 if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
154 --- a/drivers/usb/host/xhci-plat.h
155 +++ b/drivers/usb/host/xhci-plat.h
156 @@ -13,7 +13,6 @@
157 struct xhci_plat_priv {
158 const char *firmware_name;
159 unsigned long long quirks;
160 - int (*plat_setup)(struct usb_hcd *);
161 void (*plat_start)(struct usb_hcd *);
162 int (*init_quirk)(struct usb_hcd *);
163 int (*suspend_quirk)(struct usb_hcd *);