Skip to contentSkip to conversation

usb: ohci-exynos: Change to use phy provided by the generic phy framework

PATCH In review Jingoo Han 2 participants 3 messages Nov 6, 2013 – Dec 9, 2013

Subsystems (3)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 usb: ohci-exynos: Change to use phy provided by the generic phy framework

Change the phy provider used from the old usb phy specific to a new one using the generic phy framework.

---
Exynos OHCI driver also uses Exynos USB2.0 PHY. Thus, I make this patch based-on Kamil Debski's patchset for adding Exynos USB 2.0 PHY driver.
(http://www.spinics.net/lists/linux-samsung-soc/msg24104.html)

 drivers/usb/host/ohci-exynos.c |   28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/usb/host/ohci-exynos.c +8 -20
index a87baed..76eb4d3 100644
@@ -17,12 +17,12 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/usb/phy.h>
 #include <linux/usb/samsung_usb_phy.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
-#include <linux/usb/otg.h>
 
 #include "ohci.h"
 
@@ -35,8 +35,7 @@ static struct hc_driver __read_mostly exynos_ohci_hc_driver;
 
 struct exynos_ohci_hcd {
 	struct clk *clk;
-	struct usb_phy *phy;
-	struct usb_otg *otg;
+	struct phy *phy;
 };
 
 static void exynos_ohci_phy_enable(struct platform_device *pdev)
@@ -45,7 +44,7 @@ static void exynos_ohci_phy_enable(struct platform_device *pdev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 
 	if (exynos_ohci->phy)
-		usb_phy_init(exynos_ohci->phy);
+		phy_power_on(exynos_ohci->phy);
 }
 
 static void exynos_ohci_phy_disable(struct platform_device *pdev)
@@ -54,7 +53,7 @@ static void exynos_ohci_phy_disable(struct platform_device *pdev)
 	struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd);
 
 	if (exynos_ohci->phy)
-		usb_phy_shutdown(exynos_ohci->phy);
+		phy_power_off(exynos_ohci->phy);
 }
 
 static int exynos_ohci_probe(struct platform_device *pdev)
@@ -62,7 +61,8 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 	struct exynos_ohci_hcd *exynos_ohci;
 	struct usb_hcd *hcd;
 	struct resource *res;
-	struct usb_phy *phy;
+	struct phy *phy;
+	const char *phy_name;
 	int irq;
 	int err;
 
@@ -89,14 +89,14 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 					"samsung,exynos5440-ohci"))
 		goto skip_phy;
 
-	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
+	phy_name = of_get_property(pdev->dev.of_node, "phy-names", NULL);
+	phy =  devm_phy_get(&pdev->dev, phy_name);
 	if (IS_ERR(phy)) {
 		usb_put_hcd(hcd);
 		dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
 		return -EPROBE_DEFER;
 	} else {
 		exynos_ohci->phy = phy;
-		exynos_ohci->otg = phy->otg;
 	}
 
 skip_phy:
@@ -135,9 +135,6 @@ skip_phy:
 		goto fail_io;
 	}
 
-	if (exynos_ohci->otg)
-		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
-
 	platform_set_drvdata(pdev, hcd);
 
 	exynos_ohci_phy_enable(pdev);
@@ -165,9 +162,6 @@ static int exynos_ohci_remove(struct platform_device *pdev)
 
 	usb_remove_hcd(hcd);
 
-	if (exynos_ohci->otg)
-		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
-
 	exynos_ohci_phy_disable(pdev);
 
 	clk_disable_unprepare(exynos_ohci->clk);
@@ -210,9 +204,6 @@ static int exynos_ohci_suspend(struct device *dev)
 
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 
-	if (exynos_ohci->otg)
-		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
-
 	exynos_ohci_phy_disable(pdev);
 
 	clk_disable_unprepare(exynos_ohci->clk);
@@ -231,9 +222,6 @@ static int exynos_ohci_resume(struct device *dev)
 
 	clk_prepare_enable(exynos_ohci->clk);
 
-	if (exynos_ohci->otg)
-		exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self);
-
 	exynos_ohci_phy_enable(pdev);
 
 	ohci_resume(hcd, false);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 5 lines · Jingoo Han

Change the phy provider used from the old usb phy specific to a new one using the generic phy framework.

Quoted 8 lines

---
Exynos OHCI driver also uses Exynos USB2.0 PHY. Thus, I make this patch based-on Kamil Debski's patchset for adding Exynos USB 2.0 PHY driver.
(http://www.spinics.net/lists/linux-samsung-soc/msg24104.html)

 drivers/usb/host/ohci-exynos.c |   28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

This has some fuzz when applied to my tree, care to redo it against my usb-next branch of the usb.git tree on git.kernel.org?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
Quoted 12 lines · Greg KH
Quoted 11 lines · Jingoo Han

Change the phy provider used from the old usb phy specific to a new one using the generic phy framework.

---
Exynos OHCI driver also uses Exynos USB2.0 PHY. Thus, I make this patch based-on Kamil Debski's patchset for adding Exynos USB 2.0 PHY driver.
(http://www.spinics.net/lists/linux-samsung-soc/msg24104.html)

Quoted 5 lines
Quoted 2 lines
 drivers/usb/host/ohci-exynos.c |   28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

This has some fuzz when applied to my tree, care to redo it against my usb-next branch of the usb.git tree on git.kernel.org?

Hi Greg,

This patch should be updated, based on Kamil Debski's V4 patchset for adding Exynos USB 2.0 PHY driver [1].
I will send v2 patch based on Kamil Debski's V4 patchset [1].

[1] [PATCH v4 0/9] phy: Add new Exynos USB 2.0 PHY driver

     (http://www.spinics.net/lists/linux-usb/msg98911.html)

Thank you.

Best regards,
Jingoo Han