summaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/Kconfig2
-rw-r--r--drivers/phy/phy-core.c7
-rw-r--r--drivers/phy/phy-omap-usb2.c11
-rw-r--r--drivers/phy/phy-samsung-usb2.c1
4 files changed, 14 insertions, 7 deletions
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 16a2f067c242..64b98d242ea6 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -112,6 +112,7 @@ config PHY_EXYNOS5250_SATA
112config PHY_SUN4I_USB 112config PHY_SUN4I_USB
113 tristate "Allwinner sunxi SoC USB PHY driver" 113 tristate "Allwinner sunxi SoC USB PHY driver"
114 depends on ARCH_SUNXI && HAS_IOMEM && OF 114 depends on ARCH_SUNXI && HAS_IOMEM && OF
115 depends on RESET_CONTROLLER
115 select GENERIC_PHY 116 select GENERIC_PHY
116 help 117 help
117 Enable this to support the transceiver that is part of Allwinner 118 Enable this to support the transceiver that is part of Allwinner
@@ -122,6 +123,7 @@ config PHY_SUN4I_USB
122 123
123config PHY_SAMSUNG_USB2 124config PHY_SAMSUNG_USB2
124 tristate "Samsung USB 2.0 PHY driver" 125 tristate "Samsung USB 2.0 PHY driver"
126 depends on HAS_IOMEM
125 select GENERIC_PHY 127 select GENERIC_PHY
126 select MFD_SYSCON 128 select MFD_SYSCON
127 help 129 help
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index c64a2f3b2d62..49c446530101 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
614 return phy; 614 return phy;
615 615
616put_dev: 616put_dev:
617 put_device(&phy->dev); 617 put_device(&phy->dev); /* calls phy_release() which frees resources */
618 ida_remove(&phy_ida, phy->id); 618 return ERR_PTR(ret);
619
619free_phy: 620free_phy:
620 kfree(phy); 621 kfree(phy);
621 return ERR_PTR(ret); 622 return ERR_PTR(ret);
@@ -799,7 +800,7 @@ static void phy_release(struct device *dev)
799 800
800 phy = to_phy(dev); 801 phy = to_phy(dev);
801 dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); 802 dev_vdbg(dev, "releasing '%s'\n", dev_name(dev));
802 ida_remove(&phy_ida, phy->id); 803 ida_simple_remove(&phy_ida, phy->id);
803 kfree(phy); 804 kfree(phy);
804} 805}
805 806
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 7007c11fe07d..34b396146c8a 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -233,8 +233,8 @@ static int omap_usb2_probe(struct platform_device *pdev)
233 if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { 233 if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) {
234 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 234 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
235 phy->phy_base = devm_ioremap_resource(&pdev->dev, res); 235 phy->phy_base = devm_ioremap_resource(&pdev->dev, res);
236 if (!phy->phy_base) 236 if (IS_ERR(phy->phy_base))
237 return -ENOMEM; 237 return PTR_ERR(phy->phy_base);
238 phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; 238 phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
239 } 239 }
240 240
@@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
262 otg->phy = &phy->phy; 262 otg->phy = &phy->phy;
263 263
264 platform_set_drvdata(pdev, phy); 264 platform_set_drvdata(pdev, phy);
265 pm_runtime_enable(phy->dev);
266 265
267 generic_phy = devm_phy_create(phy->dev, &ops, NULL); 266 generic_phy = devm_phy_create(phy->dev, &ops, NULL);
268 if (IS_ERR(generic_phy)) 267 if (IS_ERR(generic_phy))
@@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev)
270 269
271 phy_set_drvdata(generic_phy, phy); 270 phy_set_drvdata(generic_phy, phy);
272 271
272 pm_runtime_enable(phy->dev);
273 phy_provider = devm_of_phy_provider_register(phy->dev, 273 phy_provider = devm_of_phy_provider_register(phy->dev,
274 of_phy_simple_xlate); 274 of_phy_simple_xlate);
275 if (IS_ERR(phy_provider)) 275 if (IS_ERR(phy_provider)) {
276 pm_runtime_disable(phy->dev);
276 return PTR_ERR(phy_provider); 277 return PTR_ERR(phy_provider);
278 }
277 279
278 phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); 280 phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
279 if (IS_ERR(phy->wkupclk)) { 281 if (IS_ERR(phy->wkupclk)) {
@@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev)
317 if (!IS_ERR(phy->optclk)) 319 if (!IS_ERR(phy->optclk))
318 clk_unprepare(phy->optclk); 320 clk_unprepare(phy->optclk);
319 usb_remove_phy(&phy->phy); 321 usb_remove_phy(&phy->phy);
322 pm_runtime_disable(phy->dev);
320 323
321 return 0; 324 return 0;
322} 325}
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c
index 8a8c6bc8709a..1e69a32c221d 100644
--- a/drivers/phy/phy-samsung-usb2.c
+++ b/drivers/phy/phy-samsung-usb2.c
@@ -107,6 +107,7 @@ static const struct of_device_id samsung_usb2_phy_of_match[] = {
107#endif 107#endif
108 { }, 108 { },
109}; 109};
110MODULE_DEVICE_TABLE(of, samsung_usb2_phy_of_match);
110 111
111static int samsung_usb2_phy_probe(struct platform_device *pdev) 112static int samsung_usb2_phy_probe(struct platform_device *pdev)
112{ 113{