aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2014-10-06 23:43:05 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:00:56 -0500
commit5f6aea3453ccafc0c3e16f9f7db79ce91b377e9a (patch)
treebb26ddbecdb0bea926f36e7c5ed4cbd1eef685c9 /drivers/usb/renesas_usbhs
parentc042b85a2cbb0c612e9ed3c7ea1af684bba5dcd3 (diff)
usb: renesas_usbhs: clean up rcar2.c to support a generic PHY
To support both usb PHY and generic PHY, this patch cleans up rcar2.c. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/rcar2.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c
index f264cadc12cd..485b88957a2f 100644
--- a/drivers/usb/renesas_usbhs/rcar2.c
+++ b/drivers/usb/renesas_usbhs/rcar2.c
@@ -20,25 +20,28 @@
20static int usbhs_rcar2_hardware_init(struct platform_device *pdev) 20static int usbhs_rcar2_hardware_init(struct platform_device *pdev)
21{ 21{
22 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); 22 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
23 struct usb_phy *usb_phy;
24 23
25 usb_phy = usb_get_phy_dev(&pdev->dev, 0); 24 if (IS_ENABLED(CONFIG_USB_PHY)) {
26 if (IS_ERR(usb_phy)) 25 struct usb_phy *usb_phy = usb_get_phy_dev(&pdev->dev, 0);
27 return PTR_ERR(usb_phy);
28 26
29 priv->usb_phy = usb_phy; 27 if (IS_ERR(usb_phy))
30 return 0; 28 return PTR_ERR(usb_phy);
29
30 priv->usb_phy = usb_phy;
31 return 0;
32 }
33
34 return -ENXIO;
31} 35}
32 36
33static int usbhs_rcar2_hardware_exit(struct platform_device *pdev) 37static int usbhs_rcar2_hardware_exit(struct platform_device *pdev)
34{ 38{
35 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); 39 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
36 40
37 if (!priv->usb_phy) 41 if (priv->usb_phy) {
38 return 0; 42 usb_put_phy(priv->usb_phy);
39 43 priv->usb_phy = NULL;
40 usb_put_phy(priv->usb_phy); 44 }
41 priv->usb_phy = NULL;
42 45
43 return 0; 46 return 0;
44} 47}
@@ -47,21 +50,22 @@ static int usbhs_rcar2_power_ctrl(struct platform_device *pdev,
47 void __iomem *base, int enable) 50 void __iomem *base, int enable)
48{ 51{
49 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); 52 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
53 int retval = -ENODEV;
50 54
51 if (!priv->usb_phy) 55 if (priv->usb_phy) {
52 return -ENODEV; 56 if (enable) {
57 retval = usb_phy_init(priv->usb_phy);
53 58
54 if (enable) { 59 if (!retval)
55 int retval = usb_phy_init(priv->usb_phy); 60 retval = usb_phy_set_suspend(priv->usb_phy, 0);
56 61 } else {
57 if (!retval) 62 usb_phy_set_suspend(priv->usb_phy, 1);
58 retval = usb_phy_set_suspend(priv->usb_phy, 0); 63 usb_phy_shutdown(priv->usb_phy);
59 return retval; 64 retval = 0;
65 }
60 } 66 }
61 67
62 usb_phy_set_suspend(priv->usb_phy, 1); 68 return retval;
63 usb_phy_shutdown(priv->usb_phy);
64 return 0;
65} 69}
66 70
67static int usbhs_rcar2_get_id(struct platform_device *pdev) 71static int usbhs_rcar2_get_id(struct platform_device *pdev)