hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/usb/host/ehci-orion.c
....@@ -182,6 +182,23 @@
182182 return ret;
183183 }
184184
185
+static int __maybe_unused ehci_orion_drv_suspend(struct device *dev)
186
+{
187
+ struct usb_hcd *hcd = dev_get_drvdata(dev);
188
+
189
+ return ehci_suspend(hcd, device_may_wakeup(dev));
190
+}
191
+
192
+static int __maybe_unused ehci_orion_drv_resume(struct device *dev)
193
+{
194
+ struct usb_hcd *hcd = dev_get_drvdata(dev);
195
+
196
+ return ehci_resume(hcd, false);
197
+}
198
+
199
+static SIMPLE_DEV_PM_OPS(ehci_orion_pm_ops, ehci_orion_drv_suspend,
200
+ ehci_orion_drv_resume);
201
+
185202 static const struct ehci_driver_overrides orion_overrides __initconst = {
186203 .extra_priv_size = sizeof(struct orion_ehci_hcd),
187204 .reset = ehci_orion_drv_reset,
....@@ -206,9 +223,6 @@
206223
207224 irq = platform_get_irq(pdev, 0);
208225 if (irq <= 0) {
209
- dev_err(&pdev->dev,
210
- "Found HC with no IRQ. Check %s setup!\n",
211
- dev_name(&pdev->dev));
212226 err = -ENODEV;
213227 goto err;
214228 }
....@@ -260,15 +274,7 @@
260274 if (IS_ERR(priv->phy)) {
261275 err = PTR_ERR(priv->phy);
262276 if (err != -ENOSYS)
263
- goto err_phy_get;
264
- } else {
265
- err = phy_init(priv->phy);
266
- if (err)
267
- goto err_phy_init;
268
-
269
- err = phy_power_on(priv->phy);
270
- if (err)
271
- goto err_phy_power_on;
277
+ goto err_dis_clk;
272278 }
273279
274280 /*
....@@ -300,19 +306,12 @@
300306
301307 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
302308 if (err)
303
- goto err_add_hcd;
309
+ goto err_dis_clk;
304310
305311 device_wakeup_enable(hcd->self.controller);
306312 return 0;
307313
308
-err_add_hcd:
309
- if (!IS_ERR(priv->phy))
310
- phy_power_off(priv->phy);
311
-err_phy_power_on:
312
- if (!IS_ERR(priv->phy))
313
- phy_exit(priv->phy);
314
-err_phy_init:
315
-err_phy_get:
314
+err_dis_clk:
316315 if (!IS_ERR(priv->clk))
317316 clk_disable_unprepare(priv->clk);
318317 err_put_hcd:
....@@ -330,11 +329,6 @@
330329 struct orion_ehci_hcd *priv = hcd_to_orion_priv(hcd);
331330
332331 usb_remove_hcd(hcd);
333
-
334
- if (!IS_ERR(priv->phy)) {
335
- phy_power_off(priv->phy);
336
- phy_exit(priv->phy);
337
- }
338332
339333 if (!IS_ERR(priv->clk))
340334 clk_disable_unprepare(priv->clk);
....@@ -358,6 +352,7 @@
358352 .driver = {
359353 .name = "orion-ehci",
360354 .of_match_table = ehci_orion_dt_ids,
355
+ .pm = &ehci_orion_pm_ops,
361356 },
362357 };
363358