perf python: Do not force closing original perf descriptor in evlist.get_pollfd()
[linux/fpc-iii.git] / drivers / usb / renesas_usbhs / rcar2.c
blob0027092b1118e53222eecda389c71e91a7aaa0d9
1 // SPDX-License-Identifier: GPL-1.0+
2 /*
3 * Renesas USB driver R-Car Gen. 2 initialization and power control
5 * Copyright (C) 2014 Ulrich Hecht
6 */
8 #include <linux/gpio.h>
9 #include <linux/of_gpio.h>
10 #include <linux/phy/phy.h>
11 #include "common.h"
12 #include "rcar2.h"
14 static int usbhs_rcar2_hardware_init(struct platform_device *pdev)
16 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
18 if (IS_ENABLED(CONFIG_GENERIC_PHY)) {
19 struct phy *phy = phy_get(&pdev->dev, "usb");
21 if (IS_ERR(phy))
22 return PTR_ERR(phy);
24 priv->phy = phy;
25 return 0;
28 return -ENXIO;
31 static int usbhs_rcar2_hardware_exit(struct platform_device *pdev)
33 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
35 if (priv->phy) {
36 phy_put(priv->phy);
37 priv->phy = NULL;
40 return 0;
43 static int usbhs_rcar2_power_ctrl(struct platform_device *pdev,
44 void __iomem *base, int enable)
46 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
47 int retval = -ENODEV;
49 if (priv->phy) {
50 if (enable) {
51 retval = phy_init(priv->phy);
53 if (!retval)
54 retval = phy_power_on(priv->phy);
55 } else {
56 phy_power_off(priv->phy);
57 phy_exit(priv->phy);
58 retval = 0;
62 return retval;
65 static int usbhs_rcar2_get_id(struct platform_device *pdev)
67 return USBHS_GADGET;
70 const struct renesas_usbhs_platform_callback usbhs_rcar2_ops = {
71 .hardware_init = usbhs_rcar2_hardware_init,
72 .hardware_exit = usbhs_rcar2_hardware_exit,
73 .power_ctrl = usbhs_rcar2_power_ctrl,
74 .get_id = usbhs_rcar2_get_id,