1e8afb7bbf574f96d9251998c7268a8725b53de3
[openwrt/staging/ldir.git] /
1 From 8e10548f7f4814e530857d2049d6af6bc78add53 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Thu, 3 Feb 2022 22:44:43 +0100
4 Subject: [PATCH 2/3] Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional
5 for 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 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 Link: https://lore.kernel.org/r/20220203214444.1508-5-kabel@kernel.org
27 Signed-off-by: Vinod Koul <vkoul@kernel.org>
28 ---
29 drivers/usb/host/xhci-mvebu.c | 42 -----------------------------------
30 drivers/usb/host/xhci-mvebu.h | 6 -----
31 drivers/usb/host/xhci-plat.c | 20 +----------------
32 drivers/usb/host/xhci-plat.h | 1 -
33 4 files changed, 1 insertion(+), 68 deletions(-)
34
35 --- a/drivers/usb/host/xhci-mvebu.c
36 +++ b/drivers/usb/host/xhci-mvebu.c
37 @@ -8,7 +8,6 @@
38 #include <linux/mbus.h>
39 #include <linux/of.h>
40 #include <linux/platform_device.h>
41 -#include <linux/phy/phy.h>
42
43 #include <linux/usb.h>
44 #include <linux/usb/hcd.h>
45 @@ -74,47 +73,6 @@ int xhci_mvebu_mbus_init_quirk(struct us
46
47 return 0;
48 }
49 -
50 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
51 -{
52 - struct xhci_hcd *xhci = hcd_to_xhci(hcd);
53 - struct device *dev = hcd->self.controller;
54 - struct phy *phy;
55 - int ret;
56 -
57 - /* Old bindings miss the PHY handle */
58 - phy = of_phy_get(dev->of_node, "usb3-phy");
59 - if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
60 - return -EPROBE_DEFER;
61 - else if (IS_ERR(phy))
62 - goto phy_out;
63 -
64 - ret = phy_init(phy);
65 - if (ret)
66 - goto phy_put;
67 -
68 - ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
69 - if (ret)
70 - goto phy_exit;
71 -
72 - ret = phy_power_on(phy);
73 - if (ret == -EOPNOTSUPP) {
74 - /* Skip initializatin of XHCI PHY when it is unsupported by firmware */
75 - dev_warn(dev, "PHY unsupported by firmware\n");
76 - xhci->quirks |= XHCI_SKIP_PHY_INIT;
77 - }
78 - if (ret)
79 - goto phy_exit;
80 -
81 - phy_power_off(phy);
82 -phy_exit:
83 - phy_exit(phy);
84 -phy_put:
85 - of_phy_put(phy);
86 -phy_out:
87 -
88 - return 0;
89 -}
90
91 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
92 {
93 --- a/drivers/usb/host/xhci-mvebu.h
94 +++ b/drivers/usb/host/xhci-mvebu.h
95 @@ -12,18 +12,12 @@ struct usb_hcd;
96
97 #if IS_ENABLED(CONFIG_USB_XHCI_MVEBU)
98 int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd);
99 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd);
100 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd);
101 #else
102 static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
103 {
104 return 0;
105 }
106 -
107 -static inline int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
108 -{
109 - return 0;
110 -}
111
112 static inline int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
113 {
114 --- a/drivers/usb/host/xhci-plat.c
115 +++ b/drivers/usb/host/xhci-plat.c
116 @@ -44,16 +44,6 @@ static void xhci_priv_plat_start(struct
117 priv->plat_start(hcd);
118 }
119
120 -static int xhci_priv_plat_setup(struct usb_hcd *hcd)
121 -{
122 - struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
123 -
124 - if (!priv->plat_setup)
125 - return 0;
126 -
127 - return priv->plat_setup(hcd);
128 -}
129 -
130 static int xhci_priv_init_quirk(struct usb_hcd *hcd)
131 {
132 struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
133 @@ -121,7 +111,6 @@ static const struct xhci_plat_priv xhci_
134 };
135
136 static const struct xhci_plat_priv xhci_plat_marvell_armada3700 = {
137 - .plat_setup = xhci_mvebu_a3700_plat_setup,
138 .init_quirk = xhci_mvebu_a3700_init_quirk,
139 };
140
141 @@ -341,14 +330,7 @@ static int xhci_plat_probe(struct platfo
142
143 hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
144 xhci->shared_hcd->tpl_support = hcd->tpl_support;
145 -
146 - if (priv) {
147 - ret = xhci_priv_plat_setup(hcd);
148 - if (ret)
149 - goto disable_usb_phy;
150 - }
151 -
152 - if ((xhci->quirks & XHCI_SKIP_PHY_INIT) || (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)))
153 + if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
154 hcd->skip_phy_initialization = 1;
155
156 if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
157 --- a/drivers/usb/host/xhci-plat.h
158 +++ b/drivers/usb/host/xhci-plat.h
159 @@ -13,7 +13,6 @@
160 struct xhci_plat_priv {
161 const char *firmware_name;
162 unsigned long long quirks;
163 - int (*plat_setup)(struct usb_hcd *);
164 void (*plat_start)(struct usb_hcd *);
165 int (*init_quirk)(struct usb_hcd *);
166 int (*suspend_quirk)(struct usb_hcd *);