.. | .. |
---|
182 | 182 | return ret; |
---|
183 | 183 | } |
---|
184 | 184 | |
---|
| 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 | + |
---|
185 | 202 | static const struct ehci_driver_overrides orion_overrides __initconst = { |
---|
186 | 203 | .extra_priv_size = sizeof(struct orion_ehci_hcd), |
---|
187 | 204 | .reset = ehci_orion_drv_reset, |
---|
.. | .. |
---|
206 | 223 | |
---|
207 | 224 | irq = platform_get_irq(pdev, 0); |
---|
208 | 225 | if (irq <= 0) { |
---|
209 | | - dev_err(&pdev->dev, |
---|
210 | | - "Found HC with no IRQ. Check %s setup!\n", |
---|
211 | | - dev_name(&pdev->dev)); |
---|
212 | 226 | err = -ENODEV; |
---|
213 | 227 | goto err; |
---|
214 | 228 | } |
---|
.. | .. |
---|
260 | 274 | if (IS_ERR(priv->phy)) { |
---|
261 | 275 | err = PTR_ERR(priv->phy); |
---|
262 | 276 | 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; |
---|
272 | 278 | } |
---|
273 | 279 | |
---|
274 | 280 | /* |
---|
.. | .. |
---|
300 | 306 | |
---|
301 | 307 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
---|
302 | 308 | if (err) |
---|
303 | | - goto err_add_hcd; |
---|
| 309 | + goto err_dis_clk; |
---|
304 | 310 | |
---|
305 | 311 | device_wakeup_enable(hcd->self.controller); |
---|
306 | 312 | return 0; |
---|
307 | 313 | |
---|
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: |
---|
316 | 315 | if (!IS_ERR(priv->clk)) |
---|
317 | 316 | clk_disable_unprepare(priv->clk); |
---|
318 | 317 | err_put_hcd: |
---|
.. | .. |
---|
330 | 329 | struct orion_ehci_hcd *priv = hcd_to_orion_priv(hcd); |
---|
331 | 330 | |
---|
332 | 331 | usb_remove_hcd(hcd); |
---|
333 | | - |
---|
334 | | - if (!IS_ERR(priv->phy)) { |
---|
335 | | - phy_power_off(priv->phy); |
---|
336 | | - phy_exit(priv->phy); |
---|
337 | | - } |
---|
338 | 332 | |
---|
339 | 333 | if (!IS_ERR(priv->clk)) |
---|
340 | 334 | clk_disable_unprepare(priv->clk); |
---|
.. | .. |
---|
358 | 352 | .driver = { |
---|
359 | 353 | .name = "orion-ehci", |
---|
360 | 354 | .of_match_table = ehci_orion_dt_ids, |
---|
| 355 | + .pm = &ehci_orion_pm_ops, |
---|
361 | 356 | }, |
---|
362 | 357 | }; |
---|
363 | 358 | |
---|