linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/2] Add generic PHY support to USB HCD
@ 2014-09-04 21:40 Sergei Shtylyov
  2014-09-04 21:42 ` [PATCH v5 1/2] usb: rename phy to usb_phy in HCD Sergei Shtylyov
  2014-09-04 21:44 ` [PATCH v5 2/2] usb: hcd: add generic PHY support Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2014-09-04 21:40 UTC (permalink / raw)
  To: gregkh, linux-usb
  Cc: linux-sh, yoshihiro.shimoda.uh, Peter.Chen, stern, swarren,
	thierry.reding, balbi, linux-tegra, linux-omap, linux-kernel,
	antoine.tenart

Hello.

   This patchset is against the usb-next' branch of Greg KH's 'usb.git' repo.
Here I add support for the generic PHY to the 'struct usb_hcd' (having to
rename the existing 'phy' field to 'usb_phy' beforehand). This was mainly
intended to be used with the PCI OHCI/EHCI drivers and also xHCI driver;
however there are several more dependent patchsets now posted to 'linux-usb'.
   Greg, if you want links to these patchsets and the device tree patches using
this patchset in order to link the PCI OHCI/EHCI devices to the PHY, just ask
(I have already posted the previously but will probably have to repost them
again)...

[1/2] usb: rename phy to usb_phy in HCD
[2/2] usb: hcd: add generic PHY support

WBR, Sergei


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 1/2] usb: rename phy to usb_phy in HCD
  2014-09-04 21:40 [PATCH v5 0/2] Add generic PHY support to USB HCD Sergei Shtylyov
@ 2014-09-04 21:42 ` Sergei Shtylyov
  2014-09-05 14:06   ` Felipe Balbi
  2014-09-24  5:11   ` Greg KH
  2014-09-04 21:44 ` [PATCH v5 2/2] usb: hcd: add generic PHY support Sergei Shtylyov
  1 sibling, 2 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2014-09-04 21:42 UTC (permalink / raw)
  To: gregkh, linux-usb, Peter.Chen, stern, swarren, thierry.reding,
	balbi, linux-tegra, linux-omap
  Cc: linux-sh, yoshihiro.shimoda.uh, linux-kernel, antoine.tenart

From: Antoine Tenart <antoine.tenart@free-electrons.com>

The USB PHY member of the HCD structure is renamed to 'usb_phy' and
modifications are done in all drivers accessing it.
This is in preparation to adding the generic PHY support.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
[Sergei: added missing 'drivers/usb/misc/lvstest.c' file, resolved rejects
caused by patch reordering, updated changelog.]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>

---
Changes in version 5:
- imported the patch from Antoine Tenart's series;
- added missing 'drivers/usb/misc/lvstest.c' file;
- resolved rejects caused by patch reordering;
- refreshed patch;
- updated changelog.

 drivers/usb/chipidea/host.c   |    2 +-
 drivers/usb/core/hcd.c        |   20 ++++++++++----------
 drivers/usb/core/hub.c        |    8 ++++----
 drivers/usb/host/ehci-fsl.c   |   16 ++++++++--------
 drivers/usb/host/ehci-hub.c   |    2 +-
 drivers/usb/host/ehci-msm.c   |    4 ++--
 drivers/usb/host/ehci-tegra.c |   16 ++++++++--------
 drivers/usb/host/ohci-omap.c  |   20 ++++++++++----------
 drivers/usb/misc/lvstest.c    |    8 ++++----
 include/linux/usb/hcd.h       |    2 +-
 10 files changed, 49 insertions(+), 49 deletions(-)

Index: usb/drivers/usb/chipidea/host.c
===================================================================
--- usb.orig/drivers/usb/chipidea/host.c
+++ usb/drivers/usb/chipidea/host.c
@@ -59,7 +59,7 @@ static int host_start(struct ci_hdrc *ci
 	hcd->has_tt = 1;
 
 	hcd->power_budget = ci->platdata->power_budget;
-	hcd->phy = ci->transceiver;
+	hcd->usb_phy = ci->transceiver;
 
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = ci->hw_bank.cap;
Index: usb/drivers/usb/core/hcd.c
===================================================================
--- usb.orig/drivers/usb/core/hcd.c
+++ usb/drivers/usb/core/hcd.c
@@ -2627,7 +2627,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
 	int retval;
 	struct usb_device *rhdev;
 
-	if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->phy) {
+	if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->usb_phy) {
 		struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0);
 
 		if (IS_ERR(phy)) {
@@ -2640,7 +2640,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
 				usb_put_phy(phy);
 				return retval;
 			}
-			hcd->phy = phy;
+			hcd->usb_phy = phy;
 			hcd->remove_phy = 1;
 		}
 	}
@@ -2788,10 +2788,10 @@ err_allocate_root_hub:
 err_register_bus:
 	hcd_buffer_destroy(hcd);
 err_remove_phy:
-	if (hcd->remove_phy && hcd->phy) {
-		usb_phy_shutdown(hcd->phy);
-		usb_put_phy(hcd->phy);
-		hcd->phy = NULL;
+	if (hcd->remove_phy && hcd->usb_phy) {
+		usb_phy_shutdown(hcd->usb_phy);
+		usb_put_phy(hcd->usb_phy);
+		hcd->usb_phy = NULL;
 	}
 	return retval;
 }
@@ -2864,10 +2864,10 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 
 	usb_deregister_bus(&hcd->self);
 	hcd_buffer_destroy(hcd);
-	if (hcd->remove_phy && hcd->phy) {
-		usb_phy_shutdown(hcd->phy);
-		usb_put_phy(hcd->phy);
-		hcd->phy = NULL;
+	if (hcd->remove_phy && hcd->usb_phy) {
+		usb_phy_shutdown(hcd->usb_phy);
+		usb_put_phy(hcd->usb_phy);
+		hcd->usb_phy = NULL;
 	}
 
 	usb_put_invalidate_rhdev(hcd);
Index: usb/drivers/usb/core/hub.c
===================================================================
--- usb.orig/drivers/usb/core/hub.c
+++ usb/drivers/usb/core/hub.c
@@ -4461,8 +4461,8 @@ hub_port_init (struct usb_hub *hub, stru
 	if (retval)
 		goto fail;
 
-	if (hcd->phy && !hdev->parent)
-		usb_phy_notify_connect(hcd->phy, udev->speed);
+	if (hcd->usb_phy && !hdev->parent)
+		usb_phy_notify_connect(hcd->usb_phy, udev->speed);
 
 	/*
 	 * Some superspeed devices have finished the link training process
@@ -4617,9 +4617,9 @@ static void hub_port_connect(struct usb_
 
 	/* Disconnect any existing devices under this port */
 	if (udev) {
-		if (hcd->phy && !hdev->parent &&
+		if (hcd->usb_phy && !hdev->parent &&
 				!(portstatus & USB_PORT_STAT_CONNECTION))
-			usb_phy_notify_disconnect(hcd->phy, udev->speed);
+			usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
 		usb_disconnect(&port_dev->child);
 	}
 
Index: usb/drivers/usb/host/ehci-fsl.c
===================================================================
--- usb.orig/drivers/usb/host/ehci-fsl.c
+++ usb/drivers/usb/host/ehci-fsl.c
@@ -136,15 +136,15 @@ static int usb_hcd_fsl_probe(const struc
 	if (pdata->operating_mode == FSL_USB2_DR_OTG) {
 		struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 
-		hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
+		hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
 		dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, phy=0x%p\n",
-			hcd, ehci, hcd->phy);
+			hcd, ehci, hcd->usb_phy);
 
-		if (!IS_ERR_OR_NULL(hcd->phy)) {
-			retval = otg_set_host(hcd->phy->otg,
+		if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
+			retval = otg_set_host(hcd->usb_phy->otg,
 					      &ehci_to_hcd(ehci)->self);
 			if (retval) {
-				usb_put_phy(hcd->phy);
+				usb_put_phy(hcd->usb_phy);
 				goto err2;
 			}
 		} else {
@@ -181,9 +181,9 @@ static void usb_hcd_fsl_remove(struct us
 {
 	struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
 
-	if (!IS_ERR_OR_NULL(hcd->phy)) {
-		otg_set_host(hcd->phy->otg, NULL);
-		usb_put_phy(hcd->phy);
+	if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
+		otg_set_host(hcd->usb_phy->otg, NULL);
+		usb_put_phy(hcd->usb_phy);
 	}
 
 	usb_remove_hcd(hcd);
Index: usb/drivers/usb/host/ehci-hub.c
===================================================================
--- usb.orig/drivers/usb/host/ehci-hub.c
+++ usb/drivers/usb/host/ehci-hub.c
@@ -922,7 +922,7 @@ int ehci_hub_control(
 #ifdef CONFIG_USB_OTG
 			if ((hcd->self.otg_port == (wIndex + 1))
 			    && hcd->self.b_hnp_enable) {
-				otg_start_hnp(hcd->phy->otg);
+				otg_start_hnp(hcd->usb_phy->otg);
 				break;
 			}
 #endif
Index: usb/drivers/usb/host/ehci-msm.c
===================================================================
--- usb.orig/drivers/usb/host/ehci-msm.c
+++ usb/drivers/usb/host/ehci-msm.c
@@ -124,7 +124,7 @@ static int ehci_msm_probe(struct platfor
 		goto put_hcd;
 	}
 
-	hcd->phy = phy;
+	hcd->usb_phy = phy;
 	device_init_wakeup(&pdev->dev, 1);
 	/*
 	 * OTG device parent of HCD takes care of putting
@@ -151,7 +151,7 @@ static int ehci_msm_remove(struct platfo
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
-	otg_set_host(hcd->phy->otg, NULL);
+	otg_set_host(hcd->usb_phy->otg, NULL);
 
 	/* FIXME: need to call usb_remove_hcd() here? */
 
Index: usb/drivers/usb/host/ehci-tegra.c
===================================================================
--- usb.orig/drivers/usb/host/ehci-tegra.c
+++ usb/drivers/usb/host/ehci-tegra.c
@@ -206,7 +206,7 @@ static int tegra_ehci_hub_control(
 		if (tegra->port_resuming && !(temp & PORT_SUSPEND)) {
 			/* Resume completed, re-enable disconnect detection */
 			tegra->port_resuming = 0;
-			tegra_usb_phy_postresume(hcd->phy);
+			tegra_usb_phy_postresume(hcd->usb_phy);
 		}
 	}
 
@@ -259,7 +259,7 @@ static int tegra_ehci_hub_control(
 			goto done;
 
 		/* Disable disconnect detection during port resume */
-		tegra_usb_phy_preresume(hcd->phy);
+		tegra_usb_phy_preresume(hcd->usb_phy);
 
 		ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25);
 
@@ -454,7 +454,7 @@ static int tegra_ehci_probe(struct platf
 		err = PTR_ERR(u_phy);
 		goto cleanup_clk_en;
 	}
-	hcd->phy = u_phy;
+	hcd->usb_phy = u_phy;
 
 	tegra->needs_double_reset = of_property_read_bool(pdev->dev.of_node,
 		"nvidia,needs-double-reset");
@@ -475,7 +475,7 @@ static int tegra_ehci_probe(struct platf
 	ehci->caps = hcd->regs + 0x100;
 	ehci->has_hostpc = soc_config->has_hostpc;
 
-	err = usb_phy_init(hcd->phy);
+	err = usb_phy_init(hcd->usb_phy);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to initialize phy\n");
 		goto cleanup_clk_en;
@@ -490,7 +490,7 @@ static int tegra_ehci_probe(struct platf
 	}
 	u_phy->otg->host = hcd_to_bus(hcd);
 
-	err = usb_phy_set_suspend(hcd->phy, 0);
+	err = usb_phy_set_suspend(hcd->usb_phy, 0);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to power on the phy\n");
 		goto cleanup_phy;
@@ -517,7 +517,7 @@ static int tegra_ehci_probe(struct platf
 cleanup_otg_set_host:
 	otg_set_host(u_phy->otg, NULL);
 cleanup_phy:
-	usb_phy_shutdown(hcd->phy);
+	usb_phy_shutdown(hcd->usb_phy);
 cleanup_clk_en:
 	clk_disable_unprepare(tegra->clk);
 cleanup_hcd_create:
@@ -531,9 +531,9 @@ static int tegra_ehci_remove(struct plat
 	struct tegra_ehci_hcd *tegra =
 		(struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
 
-	otg_set_host(hcd->phy->otg, NULL);
+	otg_set_host(hcd->usb_phy->otg, NULL);
 
-	usb_phy_shutdown(hcd->phy);
+	usb_phy_shutdown(hcd->usb_phy);
 	usb_remove_hcd(hcd);
 
 	clk_disable_unprepare(tegra->clk);
Index: usb/drivers/usb/host/ohci-omap.c
===================================================================
--- usb.orig/drivers/usb/host/ohci-omap.c
+++ usb/drivers/usb/host/ohci-omap.c
@@ -180,10 +180,10 @@ static void start_hnp(struct ohci_hcd *o
 	unsigned long	flags;
 	u32 l;
 
-	otg_start_hnp(hcd->phy->otg);
+	otg_start_hnp(hcd->usb_phy->otg);
 
 	local_irq_save(flags);
-	hcd->phy->state = OTG_STATE_A_SUSPEND;
+	hcd->usb_phy->state = OTG_STATE_A_SUSPEND;
 	writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
 	l = omap_readl(OTG_CTRL);
 	l &= ~OTG_A_BUSREQ;
@@ -220,14 +220,14 @@ static int ohci_omap_reset(struct usb_hc
 
 #ifdef	CONFIG_USB_OTG
 	if (need_transceiver) {
-		hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
-		if (!IS_ERR_OR_NULL(hcd->phy)) {
-			int	status = otg_set_host(hcd->phy->otg,
+		hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
+		if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
+			int	status = otg_set_host(hcd->usb_phy->otg,
 						&ohci_to_hcd(ohci)->self);
 			dev_dbg(hcd->self.controller, "init %s phy, status %d\n",
-					hcd->phy->label, status);
+					hcd->usb_phy->label, status);
 			if (status) {
-				usb_put_phy(hcd->phy);
+				usb_put_phy(hcd->usb_phy);
 				return status;
 			}
 		} else {
@@ -399,9 +399,9 @@ usb_hcd_omap_remove (struct usb_hcd *hcd
 	dev_dbg(hcd->self.controller, "stopping USB Controller\n");
 	usb_remove_hcd(hcd);
 	omap_ohci_clock_power(0);
-	if (!IS_ERR_OR_NULL(hcd->phy)) {
-		(void) otg_set_host(hcd->phy->otg, 0);
-		usb_put_phy(hcd->phy);
+	if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
+		(void) otg_set_host(hcd->usb_phy->otg, 0);
+		usb_put_phy(hcd->usb_phy);
 	}
 	if (machine_is_omap_osk())
 		gpio_free(9);
Index: usb/drivers/usb/misc/lvstest.c
===================================================================
--- usb.orig/drivers/usb/misc/lvstest.c
+++ usb/drivers/usb/misc/lvstest.c
@@ -333,13 +333,13 @@ static void lvs_rh_work(struct work_stru
 					USB_PORT_STAT_CONNECTION) {
 				lvs->present = true;
 				lvs->portnum = i;
-				if (hcd->phy)
-					usb_phy_notify_connect(hcd->phy,
+				if (hcd->usb_phy)
+					usb_phy_notify_connect(hcd->usb_phy,
 							USB_SPEED_SUPER);
 			} else {
 				lvs->present = false;
-				if (hcd->phy)
-					usb_phy_notify_disconnect(hcd->phy,
+				if (hcd->usb_phy)
+					usb_phy_notify_disconnect(hcd->usb_phy,
 							USB_SPEED_SUPER);
 			}
 			break;
Index: usb/include/linux/usb/hcd.h
===================================================================
--- usb.orig/include/linux/usb/hcd.h
+++ usb/include/linux/usb/hcd.h
@@ -106,7 +106,7 @@ struct usb_hcd {
 	 * OTG and some Host controllers need software interaction with phys;
 	 * other external phys should be software-transparent
 	 */
-	struct usb_phy	*phy;
+	struct usb_phy		*usb_phy;
 
 	/* Flags that need to be manipulated atomically because they can
 	 * change while the host controller is running.  Always use


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 2/2] usb: hcd: add generic PHY support
  2014-09-04 21:40 [PATCH v5 0/2] Add generic PHY support to USB HCD Sergei Shtylyov
  2014-09-04 21:42 ` [PATCH v5 1/2] usb: rename phy to usb_phy in HCD Sergei Shtylyov
@ 2014-09-04 21:44 ` Sergei Shtylyov
  1 sibling, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2014-09-04 21:44 UTC (permalink / raw)
  To: gregkh, linux-usb
  Cc: linux-sh, yoshihiro.shimoda.uh, linux-kernel, antoine.tenart

Add the generic PHY support, analogous to the USB PHY support. Intended it to be
used with the PCI EHCI/OHCI drivers and the xHCI platform driver.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

---
Changes in version 5:
- renamed the new 'gen_phy' field of 'struct usb_phy' back to 'phy';
- resolved rejects occured due to a newly added patch.

Changes in version 4:
- refreshed the patch.

Changes in version 3:
- refreshed the patch.

Changes in version 2:
- renamed the new 'phy' field of 'struct usb_phy' to 'gen_phy';
- resolved rejects due to removal of the first patch in the series.

 drivers/usb/core/hcd.c  |   42 ++++++++++++++++++++++++++++++++++++++++--
 include/linux/usb/hcd.h |    1 +
 2 files changed, 41 insertions(+), 2 deletions(-)

Index: usb/drivers/usb/core/hcd.c
===================================================================
--- usb.orig/drivers/usb/core/hcd.c
+++ usb/drivers/usb/core/hcd.c
@@ -42,6 +42,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/types.h>
 
+#include <linux/phy/phy.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/phy.h>
@@ -2645,6 +2646,29 @@ int usb_add_hcd(struct usb_hcd *hcd,
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_GENERIC_PHY)) {
+		struct phy *phy = phy_get(hcd->self.controller, "usb");
+
+		if (IS_ERR(phy)) {
+			retval = PTR_ERR(phy);
+			if (retval == -EPROBE_DEFER)
+				goto err_phy;
+		} else {
+			retval = phy_init(phy);
+			if (retval) {
+				phy_put(phy);
+				goto err_phy;
+			}
+			retval = phy_power_on(phy);
+			if (retval) {
+				phy_exit(phy);
+				phy_put(phy);
+				goto err_phy;
+			}
+			hcd->phy = phy;
+		}
+	}
+
 	dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
 
 	/* Keep old behaviour if authorized_default is not in [0, 1]. */
@@ -2660,7 +2684,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
 	 */
 	if ((retval = hcd_buffer_create(hcd)) != 0) {
 		dev_dbg(hcd->self.controller, "pool alloc failed\n");
-		goto err_remove_phy;
+		goto err_create_buf;
 	}
 
 	if ((retval = usb_register_bus(&hcd->self)) < 0)
@@ -2787,7 +2811,14 @@ err_allocate_root_hub:
 	usb_deregister_bus(&hcd->self);
 err_register_bus:
 	hcd_buffer_destroy(hcd);
-err_remove_phy:
+err_create_buf:
+	if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) {
+		phy_power_off(hcd->phy);
+		phy_exit(hcd->phy);
+		phy_put(hcd->phy);
+		hcd->phy = NULL;
+	}
+err_phy:
 	if (hcd->remove_phy && hcd->usb_phy) {
 		usb_phy_shutdown(hcd->usb_phy);
 		usb_put_phy(hcd->usb_phy);
@@ -2864,6 +2895,13 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 
 	usb_deregister_bus(&hcd->self);
 	hcd_buffer_destroy(hcd);
+
+	if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) {
+		phy_power_off(hcd->phy);
+		phy_exit(hcd->phy);
+		phy_put(hcd->phy);
+		hcd->phy = NULL;
+	}
 	if (hcd->remove_phy && hcd->usb_phy) {
 		usb_phy_shutdown(hcd->usb_phy);
 		usb_put_phy(hcd->usb_phy);
Index: usb/include/linux/usb/hcd.h
===================================================================
--- usb.orig/include/linux/usb/hcd.h
+++ usb/include/linux/usb/hcd.h
@@ -107,6 +107,7 @@ struct usb_hcd {
 	 * other external phys should be software-transparent
 	 */
 	struct usb_phy		*usb_phy;
+	struct phy		*phy;
 
 	/* Flags that need to be manipulated atomically because they can
 	 * change while the host controller is running.  Always use


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 1/2] usb: rename phy to usb_phy in HCD
  2014-09-04 21:42 ` [PATCH v5 1/2] usb: rename phy to usb_phy in HCD Sergei Shtylyov
@ 2014-09-05 14:06   ` Felipe Balbi
  2014-09-24  5:11   ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2014-09-05 14:06 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: gregkh, linux-usb, Peter.Chen, stern, swarren, thierry.reding,
	balbi, linux-tegra, linux-omap, linux-sh, yoshihiro.shimoda.uh,
	linux-kernel, antoine.tenart

[-- Attachment #1: Type: text/plain, Size: 12763 bytes --]

On Fri, Sep 05, 2014 at 01:42:09AM +0400, Sergei Shtylyov wrote:
> From: Antoine Tenart <antoine.tenart@free-electrons.com>
> 
> The USB PHY member of the HCD structure is renamed to 'usb_phy' and
> modifications are done in all drivers accessing it.
> This is in preparation to adding the generic PHY support.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> [Sergei: added missing 'drivers/usb/misc/lvstest.c' file, resolved rejects
> caused by patch reordering, updated changelog.]
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
> Changes in version 5:
> - imported the patch from Antoine Tenart's series;
> - added missing 'drivers/usb/misc/lvstest.c' file;
> - resolved rejects caused by patch reordering;
> - refreshed patch;
> - updated changelog.
> 
>  drivers/usb/chipidea/host.c   |    2 +-
>  drivers/usb/core/hcd.c        |   20 ++++++++++----------
>  drivers/usb/core/hub.c        |    8 ++++----
>  drivers/usb/host/ehci-fsl.c   |   16 ++++++++--------
>  drivers/usb/host/ehci-hub.c   |    2 +-
>  drivers/usb/host/ehci-msm.c   |    4 ++--
>  drivers/usb/host/ehci-tegra.c |   16 ++++++++--------
>  drivers/usb/host/ohci-omap.c  |   20 ++++++++++----------
>  drivers/usb/misc/lvstest.c    |    8 ++++----
>  include/linux/usb/hcd.h       |    2 +-
>  10 files changed, 49 insertions(+), 49 deletions(-)
> 
> Index: usb/drivers/usb/chipidea/host.c
> ===================================================================
> --- usb.orig/drivers/usb/chipidea/host.c
> +++ usb/drivers/usb/chipidea/host.c
> @@ -59,7 +59,7 @@ static int host_start(struct ci_hdrc *ci
>  	hcd->has_tt = 1;
>  
>  	hcd->power_budget = ci->platdata->power_budget;
> -	hcd->phy = ci->transceiver;
> +	hcd->usb_phy = ci->transceiver;
>  
>  	ehci = hcd_to_ehci(hcd);
>  	ehci->caps = ci->hw_bank.cap;
> Index: usb/drivers/usb/core/hcd.c
> ===================================================================
> --- usb.orig/drivers/usb/core/hcd.c
> +++ usb/drivers/usb/core/hcd.c
> @@ -2627,7 +2627,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
>  	int retval;
>  	struct usb_device *rhdev;
>  
> -	if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->phy) {
> +	if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->usb_phy) {
>  		struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0);
>  
>  		if (IS_ERR(phy)) {
> @@ -2640,7 +2640,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
>  				usb_put_phy(phy);
>  				return retval;
>  			}
> -			hcd->phy = phy;
> +			hcd->usb_phy = phy;
>  			hcd->remove_phy = 1;
>  		}
>  	}
> @@ -2788,10 +2788,10 @@ err_allocate_root_hub:
>  err_register_bus:
>  	hcd_buffer_destroy(hcd);
>  err_remove_phy:
> -	if (hcd->remove_phy && hcd->phy) {
> -		usb_phy_shutdown(hcd->phy);
> -		usb_put_phy(hcd->phy);
> -		hcd->phy = NULL;
> +	if (hcd->remove_phy && hcd->usb_phy) {
> +		usb_phy_shutdown(hcd->usb_phy);
> +		usb_put_phy(hcd->usb_phy);
> +		hcd->usb_phy = NULL;
>  	}
>  	return retval;
>  }
> @@ -2864,10 +2864,10 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>  
>  	usb_deregister_bus(&hcd->self);
>  	hcd_buffer_destroy(hcd);
> -	if (hcd->remove_phy && hcd->phy) {
> -		usb_phy_shutdown(hcd->phy);
> -		usb_put_phy(hcd->phy);
> -		hcd->phy = NULL;
> +	if (hcd->remove_phy && hcd->usb_phy) {
> +		usb_phy_shutdown(hcd->usb_phy);
> +		usb_put_phy(hcd->usb_phy);
> +		hcd->usb_phy = NULL;
>  	}
>  
>  	usb_put_invalidate_rhdev(hcd);
> Index: usb/drivers/usb/core/hub.c
> ===================================================================
> --- usb.orig/drivers/usb/core/hub.c
> +++ usb/drivers/usb/core/hub.c
> @@ -4461,8 +4461,8 @@ hub_port_init (struct usb_hub *hub, stru
>  	if (retval)
>  		goto fail;
>  
> -	if (hcd->phy && !hdev->parent)
> -		usb_phy_notify_connect(hcd->phy, udev->speed);
> +	if (hcd->usb_phy && !hdev->parent)
> +		usb_phy_notify_connect(hcd->usb_phy, udev->speed);
>  
>  	/*
>  	 * Some superspeed devices have finished the link training process
> @@ -4617,9 +4617,9 @@ static void hub_port_connect(struct usb_
>  
>  	/* Disconnect any existing devices under this port */
>  	if (udev) {
> -		if (hcd->phy && !hdev->parent &&
> +		if (hcd->usb_phy && !hdev->parent &&
>  				!(portstatus & USB_PORT_STAT_CONNECTION))
> -			usb_phy_notify_disconnect(hcd->phy, udev->speed);
> +			usb_phy_notify_disconnect(hcd->usb_phy, udev->speed);
>  		usb_disconnect(&port_dev->child);
>  	}
>  
> Index: usb/drivers/usb/host/ehci-fsl.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ehci-fsl.c
> +++ usb/drivers/usb/host/ehci-fsl.c
> @@ -136,15 +136,15 @@ static int usb_hcd_fsl_probe(const struc
>  	if (pdata->operating_mode == FSL_USB2_DR_OTG) {
>  		struct ehci_hcd *ehci = hcd_to_ehci(hcd);
>  
> -		hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
> +		hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
>  		dev_dbg(&pdev->dev, "hcd=0x%p  ehci=0x%p, phy=0x%p\n",
> -			hcd, ehci, hcd->phy);
> +			hcd, ehci, hcd->usb_phy);
>  
> -		if (!IS_ERR_OR_NULL(hcd->phy)) {
> -			retval = otg_set_host(hcd->phy->otg,
> +		if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
> +			retval = otg_set_host(hcd->usb_phy->otg,
>  					      &ehci_to_hcd(ehci)->self);
>  			if (retval) {
> -				usb_put_phy(hcd->phy);
> +				usb_put_phy(hcd->usb_phy);
>  				goto err2;
>  			}
>  		} else {
> @@ -181,9 +181,9 @@ static void usb_hcd_fsl_remove(struct us
>  {
>  	struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
>  
> -	if (!IS_ERR_OR_NULL(hcd->phy)) {
> -		otg_set_host(hcd->phy->otg, NULL);
> -		usb_put_phy(hcd->phy);
> +	if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
> +		otg_set_host(hcd->usb_phy->otg, NULL);
> +		usb_put_phy(hcd->usb_phy);
>  	}
>  
>  	usb_remove_hcd(hcd);
> Index: usb/drivers/usb/host/ehci-hub.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ehci-hub.c
> +++ usb/drivers/usb/host/ehci-hub.c
> @@ -922,7 +922,7 @@ int ehci_hub_control(
>  #ifdef CONFIG_USB_OTG
>  			if ((hcd->self.otg_port == (wIndex + 1))
>  			    && hcd->self.b_hnp_enable) {
> -				otg_start_hnp(hcd->phy->otg);
> +				otg_start_hnp(hcd->usb_phy->otg);
>  				break;
>  			}
>  #endif
> Index: usb/drivers/usb/host/ehci-msm.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ehci-msm.c
> +++ usb/drivers/usb/host/ehci-msm.c
> @@ -124,7 +124,7 @@ static int ehci_msm_probe(struct platfor
>  		goto put_hcd;
>  	}
>  
> -	hcd->phy = phy;
> +	hcd->usb_phy = phy;
>  	device_init_wakeup(&pdev->dev, 1);
>  	/*
>  	 * OTG device parent of HCD takes care of putting
> @@ -151,7 +151,7 @@ static int ehci_msm_remove(struct platfo
>  	pm_runtime_disable(&pdev->dev);
>  	pm_runtime_set_suspended(&pdev->dev);
>  
> -	otg_set_host(hcd->phy->otg, NULL);
> +	otg_set_host(hcd->usb_phy->otg, NULL);
>  
>  	/* FIXME: need to call usb_remove_hcd() here? */
>  
> Index: usb/drivers/usb/host/ehci-tegra.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ehci-tegra.c
> +++ usb/drivers/usb/host/ehci-tegra.c
> @@ -206,7 +206,7 @@ static int tegra_ehci_hub_control(
>  		if (tegra->port_resuming && !(temp & PORT_SUSPEND)) {
>  			/* Resume completed, re-enable disconnect detection */
>  			tegra->port_resuming = 0;
> -			tegra_usb_phy_postresume(hcd->phy);
> +			tegra_usb_phy_postresume(hcd->usb_phy);
>  		}
>  	}
>  
> @@ -259,7 +259,7 @@ static int tegra_ehci_hub_control(
>  			goto done;
>  
>  		/* Disable disconnect detection during port resume */
> -		tegra_usb_phy_preresume(hcd->phy);
> +		tegra_usb_phy_preresume(hcd->usb_phy);
>  
>  		ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25);
>  
> @@ -454,7 +454,7 @@ static int tegra_ehci_probe(struct platf
>  		err = PTR_ERR(u_phy);
>  		goto cleanup_clk_en;
>  	}
> -	hcd->phy = u_phy;
> +	hcd->usb_phy = u_phy;
>  
>  	tegra->needs_double_reset = of_property_read_bool(pdev->dev.of_node,
>  		"nvidia,needs-double-reset");
> @@ -475,7 +475,7 @@ static int tegra_ehci_probe(struct platf
>  	ehci->caps = hcd->regs + 0x100;
>  	ehci->has_hostpc = soc_config->has_hostpc;
>  
> -	err = usb_phy_init(hcd->phy);
> +	err = usb_phy_init(hcd->usb_phy);
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to initialize phy\n");
>  		goto cleanup_clk_en;
> @@ -490,7 +490,7 @@ static int tegra_ehci_probe(struct platf
>  	}
>  	u_phy->otg->host = hcd_to_bus(hcd);
>  
> -	err = usb_phy_set_suspend(hcd->phy, 0);
> +	err = usb_phy_set_suspend(hcd->usb_phy, 0);
>  	if (err) {
>  		dev_err(&pdev->dev, "Failed to power on the phy\n");
>  		goto cleanup_phy;
> @@ -517,7 +517,7 @@ static int tegra_ehci_probe(struct platf
>  cleanup_otg_set_host:
>  	otg_set_host(u_phy->otg, NULL);
>  cleanup_phy:
> -	usb_phy_shutdown(hcd->phy);
> +	usb_phy_shutdown(hcd->usb_phy);
>  cleanup_clk_en:
>  	clk_disable_unprepare(tegra->clk);
>  cleanup_hcd_create:
> @@ -531,9 +531,9 @@ static int tegra_ehci_remove(struct plat
>  	struct tegra_ehci_hcd *tegra =
>  		(struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
>  
> -	otg_set_host(hcd->phy->otg, NULL);
> +	otg_set_host(hcd->usb_phy->otg, NULL);
>  
> -	usb_phy_shutdown(hcd->phy);
> +	usb_phy_shutdown(hcd->usb_phy);
>  	usb_remove_hcd(hcd);
>  
>  	clk_disable_unprepare(tegra->clk);
> Index: usb/drivers/usb/host/ohci-omap.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ohci-omap.c
> +++ usb/drivers/usb/host/ohci-omap.c
> @@ -180,10 +180,10 @@ static void start_hnp(struct ohci_hcd *o
>  	unsigned long	flags;
>  	u32 l;
>  
> -	otg_start_hnp(hcd->phy->otg);
> +	otg_start_hnp(hcd->usb_phy->otg);
>  
>  	local_irq_save(flags);
> -	hcd->phy->state = OTG_STATE_A_SUSPEND;
> +	hcd->usb_phy->state = OTG_STATE_A_SUSPEND;
>  	writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]);
>  	l = omap_readl(OTG_CTRL);
>  	l &= ~OTG_A_BUSREQ;
> @@ -220,14 +220,14 @@ static int ohci_omap_reset(struct usb_hc
>  
>  #ifdef	CONFIG_USB_OTG
>  	if (need_transceiver) {
> -		hcd->phy = usb_get_phy(USB_PHY_TYPE_USB2);
> -		if (!IS_ERR_OR_NULL(hcd->phy)) {
> -			int	status = otg_set_host(hcd->phy->otg,
> +		hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
> +		if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
> +			int	status = otg_set_host(hcd->usb_phy->otg,
>  						&ohci_to_hcd(ohci)->self);
>  			dev_dbg(hcd->self.controller, "init %s phy, status %d\n",
> -					hcd->phy->label, status);
> +					hcd->usb_phy->label, status);
>  			if (status) {
> -				usb_put_phy(hcd->phy);
> +				usb_put_phy(hcd->usb_phy);
>  				return status;
>  			}
>  		} else {
> @@ -399,9 +399,9 @@ usb_hcd_omap_remove (struct usb_hcd *hcd
>  	dev_dbg(hcd->self.controller, "stopping USB Controller\n");
>  	usb_remove_hcd(hcd);
>  	omap_ohci_clock_power(0);
> -	if (!IS_ERR_OR_NULL(hcd->phy)) {
> -		(void) otg_set_host(hcd->phy->otg, 0);
> -		usb_put_phy(hcd->phy);
> +	if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
> +		(void) otg_set_host(hcd->usb_phy->otg, 0);
> +		usb_put_phy(hcd->usb_phy);
>  	}
>  	if (machine_is_omap_osk())
>  		gpio_free(9);
> Index: usb/drivers/usb/misc/lvstest.c
> ===================================================================
> --- usb.orig/drivers/usb/misc/lvstest.c
> +++ usb/drivers/usb/misc/lvstest.c
> @@ -333,13 +333,13 @@ static void lvs_rh_work(struct work_stru
>  					USB_PORT_STAT_CONNECTION) {
>  				lvs->present = true;
>  				lvs->portnum = i;
> -				if (hcd->phy)
> -					usb_phy_notify_connect(hcd->phy,
> +				if (hcd->usb_phy)
> +					usb_phy_notify_connect(hcd->usb_phy,
>  							USB_SPEED_SUPER);
>  			} else {
>  				lvs->present = false;
> -				if (hcd->phy)
> -					usb_phy_notify_disconnect(hcd->phy,
> +				if (hcd->usb_phy)
> +					usb_phy_notify_disconnect(hcd->usb_phy,
>  							USB_SPEED_SUPER);
>  			}
>  			break;
> Index: usb/include/linux/usb/hcd.h
> ===================================================================
> --- usb.orig/include/linux/usb/hcd.h
> +++ usb/include/linux/usb/hcd.h
> @@ -106,7 +106,7 @@ struct usb_hcd {
>  	 * OTG and some Host controllers need software interaction with phys;
>  	 * other external phys should be software-transparent
>  	 */
> -	struct usb_phy	*phy;
> +	struct usb_phy		*usb_phy;
>  
>  	/* Flags that need to be manipulated atomically because they can
>  	 * change while the host controller is running.  Always use
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 1/2] usb: rename phy to usb_phy in HCD
  2014-09-04 21:42 ` [PATCH v5 1/2] usb: rename phy to usb_phy in HCD Sergei Shtylyov
  2014-09-05 14:06   ` Felipe Balbi
@ 2014-09-24  5:11   ` Greg KH
  2014-09-24 18:56     ` Sergei Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2014-09-24  5:11 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-usb, Peter.Chen, stern, swarren, thierry.reding, balbi,
	linux-tegra, linux-omap, linux-sh, yoshihiro.shimoda.uh,
	linux-kernel, antoine.tenart

On Fri, Sep 05, 2014 at 01:42:09AM +0400, Sergei Shtylyov wrote:
> From: Antoine Tenart <antoine.tenart@free-electrons.com>
> 
> The USB PHY member of the HCD structure is renamed to 'usb_phy' and
> modifications are done in all drivers accessing it.
> This is in preparation to adding the generic PHY support.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> [Sergei: added missing 'drivers/usb/misc/lvstest.c' file, resolved rejects
> caused by patch reordering, updated changelog.]
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> Acked-by: Felipe Balbi <balbi@ti.com>
> 
> ---
> Changes in version 5:
> - imported the patch from Antoine Tenart's series;
> - added missing 'drivers/usb/misc/lvstest.c' file;
> - resolved rejects caused by patch reordering;
> - refreshed patch;
> - updated changelog.
> 
>  drivers/usb/chipidea/host.c   |    2 +-
>  drivers/usb/core/hcd.c        |   20 ++++++++++----------
>  drivers/usb/core/hub.c        |    8 ++++----
>  drivers/usb/host/ehci-fsl.c   |   16 ++++++++--------
>  drivers/usb/host/ehci-hub.c   |    2 +-
>  drivers/usb/host/ehci-msm.c   |    4 ++--
>  drivers/usb/host/ehci-tegra.c |   16 ++++++++--------
>  drivers/usb/host/ohci-omap.c  |   20 ++++++++++----------
>  drivers/usb/misc/lvstest.c    |    8 ++++----
>  include/linux/usb/hcd.h       |    2 +-
>  10 files changed, 49 insertions(+), 49 deletions(-)

This doesn't apply to my tree at all anymore, can you refresh it and
resend?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 1/2] usb: rename phy to usb_phy in HCD
  2014-09-24  5:11   ` Greg KH
@ 2014-09-24 18:56     ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2014-09-24 18:56 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-usb, Peter.Chen, stern, swarren, thierry.reding, balbi,
	linux-tegra, linux-omap, linux-sh, yoshihiro.shimoda.uh,
	linux-kernel, antoine.tenart

hello.

On 09/24/2014 09:11 AM, Greg KH wrote:

>> From: Antoine Tenart <antoine.tenart@free-electrons.com>

>> The USB PHY member of the HCD structure is renamed to 'usb_phy' and
>> modifications are done in all drivers accessing it.
>> This is in preparation to adding the generic PHY support.

>> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
>> [Sergei: added missing 'drivers/usb/misc/lvstest.c' file, resolved rejects
>> caused by patch reordering, updated changelog.]
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>> Acked-by: Felipe Balbi <balbi@ti.com>

>> ---
>> Changes in version 5:
>> - imported the patch from Antoine Tenart's series;
>> - added missing 'drivers/usb/misc/lvstest.c' file;
>> - resolved rejects caused by patch reordering;
>> - refreshed patch;
>> - updated changelog.

>>   drivers/usb/chipidea/host.c   |    2 +-
>>   drivers/usb/core/hcd.c        |   20 ++++++++++----------
>>   drivers/usb/core/hub.c        |    8 ++++----
>>   drivers/usb/host/ehci-fsl.c   |   16 ++++++++--------
>>   drivers/usb/host/ehci-hub.c   |    2 +-
>>   drivers/usb/host/ehci-msm.c   |    4 ++--
>>   drivers/usb/host/ehci-tegra.c |   16 ++++++++--------
>>   drivers/usb/host/ohci-omap.c  |   20 ++++++++++----------
>>   drivers/usb/misc/lvstest.c    |    8 ++++----
>>   include/linux/usb/hcd.h       |    2 +-
>>   10 files changed, 49 insertions(+), 49 deletions(-)

> This doesn't apply to my tree at all anymore,

    Well, I'm seeing only a minor reject in the first file, easily fixable.

> can you refresh it and resend?

    OK, will re-post now.

> thanks,

> greg k-h

WBR, Sergei


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-24 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 21:40 [PATCH v5 0/2] Add generic PHY support to USB HCD Sergei Shtylyov
2014-09-04 21:42 ` [PATCH v5 1/2] usb: rename phy to usb_phy in HCD Sergei Shtylyov
2014-09-05 14:06   ` Felipe Balbi
2014-09-24  5:11   ` Greg KH
2014-09-24 18:56     ` Sergei Shtylyov
2014-09-04 21:44 ` [PATCH v5 2/2] usb: hcd: add generic PHY support Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).