kernel: 5.10: Backport pending Armada 3720 comphy patches
[openwrt/staging/jow.git] / target / linux / generic / pending-5.10 / 851-0005-Revert-usb-host-xhci-mvebu-make-USB-3.0-PHY-optional.patch
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 diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
33 index 8ca1a235d164..60651a50770f 100644
34 --- a/drivers/usb/host/xhci-mvebu.c
35 +++ b/drivers/usb/host/xhci-mvebu.c
36 @@ -8,7 +8,6 @@
37 #include <linux/mbus.h>
38 #include <linux/of.h>
39 #include <linux/platform_device.h>
40 -#include <linux/phy/phy.h>
41
42 #include <linux/usb.h>
43 #include <linux/usb/hcd.h>
44 @@ -75,47 +74,6 @@ int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
45 return 0;
46 }
47
48 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
49 -{
50 - struct xhci_hcd *xhci = hcd_to_xhci(hcd);
51 - struct device *dev = hcd->self.controller;
52 - struct phy *phy;
53 - int ret;
54 -
55 - /* Old bindings miss the PHY handle */
56 - phy = of_phy_get(dev->of_node, "usb3-phy");
57 - if (IS_ERR(phy) && PTR_ERR(phy) == -EPROBE_DEFER)
58 - return -EPROBE_DEFER;
59 - else if (IS_ERR(phy))
60 - goto phy_out;
61 -
62 - ret = phy_init(phy);
63 - if (ret)
64 - goto phy_put;
65 -
66 - ret = phy_set_mode(phy, PHY_MODE_USB_HOST_SS);
67 - if (ret)
68 - goto phy_exit;
69 -
70 - ret = phy_power_on(phy);
71 - if (ret == -EOPNOTSUPP) {
72 - /* Skip initializatin of XHCI PHY when it is unsupported by firmware */
73 - dev_warn(dev, "PHY unsupported by firmware\n");
74 - xhci->quirks |= XHCI_SKIP_PHY_INIT;
75 - }
76 - if (ret)
77 - goto phy_exit;
78 -
79 - phy_power_off(phy);
80 -phy_exit:
81 - phy_exit(phy);
82 -phy_put:
83 - of_phy_put(phy);
84 -phy_out:
85 -
86 - return 0;
87 -}
88 -
89 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
90 {
91 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
92 diff --git a/drivers/usb/host/xhci-mvebu.h b/drivers/usb/host/xhci-mvebu.h
93 index 01bf3fcb3eca..3be021793cc8 100644
94 --- a/drivers/usb/host/xhci-mvebu.h
95 +++ b/drivers/usb/host/xhci-mvebu.h
96 @@ -12,7 +12,6 @@ struct usb_hcd;
97
98 #if IS_ENABLED(CONFIG_USB_XHCI_MVEBU)
99 int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd);
100 -int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd);
101 int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd);
102 #else
103 static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
104 @@ -20,11 +19,6 @@ static inline int xhci_mvebu_mbus_init_quirk(struct usb_hcd *hcd)
105 return 0;
106 }
107
108 -static inline int xhci_mvebu_a3700_plat_setup(struct usb_hcd *hcd)
109 -{
110 - return 0;
111 -}
112 -
113 static inline int xhci_mvebu_a3700_init_quirk(struct usb_hcd *hcd)
114 {
115 return 0;
116 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
117 index c1edcc9b13ce..4d34f6005381 100644
118 --- a/drivers/usb/host/xhci-plat.c
119 +++ b/drivers/usb/host/xhci-plat.c
120 @@ -44,16 +44,6 @@ static void xhci_priv_plat_start(struct usb_hcd *hcd)
121 priv->plat_start(hcd);
122 }
123
124 -static int xhci_priv_plat_setup(struct usb_hcd *hcd)
125 -{
126 - struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
127 -
128 - if (!priv->plat_setup)
129 - return 0;
130 -
131 - return priv->plat_setup(hcd);
132 -}
133 -
134 static int xhci_priv_init_quirk(struct usb_hcd *hcd)
135 {
136 struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
137 @@ -121,7 +111,6 @@ static const struct xhci_plat_priv xhci_plat_marvell_armada = {
138 };
139
140 static const struct xhci_plat_priv xhci_plat_marvell_armada3700 = {
141 - .plat_setup = xhci_mvebu_a3700_plat_setup,
142 .init_quirk = xhci_mvebu_a3700_init_quirk,
143 };
144
145 @@ -341,14 +330,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
146
147 hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
148 xhci->shared_hcd->tpl_support = hcd->tpl_support;
149 -
150 - if (priv) {
151 - ret = xhci_priv_plat_setup(hcd);
152 - if (ret)
153 - goto disable_usb_phy;
154 - }
155 -
156 - if ((xhci->quirks & XHCI_SKIP_PHY_INIT) || (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)))
157 + if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
158 hcd->skip_phy_initialization = 1;
159
160 if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
161 diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
162 index 561d0b7bce09..1fb149d1fbce 100644
163 --- a/drivers/usb/host/xhci-plat.h
164 +++ b/drivers/usb/host/xhci-plat.h
165 @@ -13,7 +13,6 @@
166 struct xhci_plat_priv {
167 const char *firmware_name;
168 unsigned long long quirks;
169 - int (*plat_setup)(struct usb_hcd *);
170 void (*plat_start)(struct usb_hcd *);
171 int (*init_quirk)(struct usb_hcd *);
172 int (*suspend_quirk)(struct usb_hcd *);
173 --
174 2.34.1
175