All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: <gregkh@linuxfoundation.org>, <balbi@ti.com>,
	<stern@rowland.harvard.edu>
Cc: <dan.j.williams@intel.com>, <peter.chen@freescale.com>,
	<jun.li@freescale.com>, <mathias.nyman@linux.intel.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [RFC][PATCH 5/9] usb: hcd: adapt to OTG
Date: Wed, 18 Mar 2015 15:55:59 +0200	[thread overview]
Message-ID: <1426686963-11613-6-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1426686963-11613-1-git-send-email-rogerq@ti.com>

Register with OTG core as part of usb_add_hcd() and
unregister from it in usb_remove_hcd().

For OTG device the HCD is actually started or stopped
from the OTG FSM.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/core/hcd.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e28bd9d..9e8ecc9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -46,6 +46,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/phy.h>
+#include <linux/usb/usb-otg.h>
 
 #include "usb.h"
 
@@ -2826,9 +2827,12 @@ int usb_add_hcd(struct usb_hcd *hcd,
 			goto err_request_irq;
 	}
 
-	retval = usb_start_hcd(hcd);
-	if (retval)
-		goto err_hcd_driver_start;
+	/* If OTG device, OTG core takes care of starting HCD */
+	if (usb_otg_register_hcd(hcd)) {
+		retval = usb_start_hcd(hcd);
+		if (retval)
+			goto err_hcd_driver_start;
+	}
 
 	return 0;
 
@@ -2936,7 +2940,9 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 {
 	dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
 
-	usb_stop_hcd(hcd);
+	/* If OTG device, OTG core takes care of stopping HCD */
+	if (usb_otg_unregister_hcd(hcd))
+		usb_stop_hcd(hcd);
 
 	if (usb_hcd_is_primary_hcd(hcd)) {
 		if (hcd->irq > 0)
-- 
2.1.0


WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: gregkh@linuxfoundation.org, balbi@ti.com, stern@rowland.harvard.edu
Cc: dan.j.williams@intel.com, peter.chen@freescale.com,
	jun.li@freescale.com, mathias.nyman@linux.intel.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, Roger Quadros <rogerq@ti.com>
Subject: [RFC][PATCH 5/9] usb: hcd: adapt to OTG
Date: Wed, 18 Mar 2015 15:55:59 +0200	[thread overview]
Message-ID: <1426686963-11613-6-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1426686963-11613-1-git-send-email-rogerq@ti.com>

Register with OTG core as part of usb_add_hcd() and
unregister from it in usb_remove_hcd().

For OTG device the HCD is actually started or stopped
from the OTG FSM.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/core/hcd.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index e28bd9d..9e8ecc9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -46,6 +46,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/phy.h>
+#include <linux/usb/usb-otg.h>
 
 #include "usb.h"
 
@@ -2826,9 +2827,12 @@ int usb_add_hcd(struct usb_hcd *hcd,
 			goto err_request_irq;
 	}
 
-	retval = usb_start_hcd(hcd);
-	if (retval)
-		goto err_hcd_driver_start;
+	/* If OTG device, OTG core takes care of starting HCD */
+	if (usb_otg_register_hcd(hcd)) {
+		retval = usb_start_hcd(hcd);
+		if (retval)
+			goto err_hcd_driver_start;
+	}
 
 	return 0;
 
@@ -2936,7 +2940,9 @@ void usb_remove_hcd(struct usb_hcd *hcd)
 {
 	dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);
 
-	usb_stop_hcd(hcd);
+	/* If OTG device, OTG core takes care of stopping HCD */
+	if (usb_otg_unregister_hcd(hcd))
+		usb_stop_hcd(hcd);
 
 	if (usb_hcd_is_primary_hcd(hcd)) {
 		if (hcd->irq > 0)
-- 
2.1.0

  parent reply	other threads:[~2015-03-18 13:56 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 13:55 [RFC][PATCH 0/9] USB: OTG Core functionality Roger Quadros
2015-03-18 13:55 ` Roger Quadros
2015-03-18 13:55 ` [RFC][PATCH 1/9] usb: hcd: Introduce usb_start/stop_hcd() Roger Quadros
2015-03-18 13:55   ` Roger Quadros
2015-03-18 19:49   ` Alan Stern
2015-03-18 19:49     ` Alan Stern
2015-03-18 21:41     ` Tony Lindgren
2015-03-18 21:41       ` Tony Lindgren
2015-03-19  1:51       ` Alan Stern
2015-03-19  1:51         ` Alan Stern
2015-03-19  2:38         ` Tony Lindgren
2015-03-19  2:38           ` Tony Lindgren
2015-03-19 11:38     ` Roger Quadros
2015-03-19 11:38       ` Roger Quadros
2015-03-19 14:17       ` Alan Stern
2015-03-19 14:17         ` Alan Stern
2015-03-20  6:32       ` Peter Chen
2015-03-20  6:32         ` Peter Chen
2015-03-20  9:49         ` Roger Quadros
2015-03-20  9:49           ` Roger Quadros
2015-03-19  1:46   ` Peter Chen
2015-03-19  1:46     ` Peter Chen
2015-03-18 13:55 ` [RFC][PATCH 2/9] usb: gadget: add usb_gadget_start/stop() Roger Quadros
2015-03-18 13:55   ` Roger Quadros
2015-03-19  3:30   ` Peter Chen
2015-03-19  3:30     ` Peter Chen
2015-03-19 10:14     ` Roger Quadros
2015-03-19 10:14       ` Roger Quadros
2015-03-19 14:09       ` Li Jun
2015-03-19 14:09         ` Li Jun
2015-03-19 14:50         ` Roger Quadros
2015-03-19 14:50           ` Roger Quadros
2015-03-20  7:18           ` Peter Chen
2015-03-20  7:18             ` Peter Chen
2015-03-20  9:46             ` Roger Quadros
2015-03-20  9:46               ` Roger Quadros
2015-03-20 11:08               ` Roger Quadros
2015-03-20 11:08                 ` Roger Quadros
2015-03-21  1:30                 ` Peter Chen
2015-03-21  1:30                   ` Peter Chen
2015-03-18 13:55 ` [RFC][PATCH 3/9] usb: otg: add OTG core Roger Quadros
2015-03-18 13:55   ` Roger Quadros
2015-03-19  3:40   ` Peter Chen
2015-03-19  3:40     ` Peter Chen
2015-03-19 10:18     ` Roger Quadros
2015-03-19 10:18       ` Roger Quadros
2015-03-20  7:45       ` Peter Chen
2015-03-20  7:45         ` Peter Chen
2015-03-20  9:18         ` Roger Quadros
2015-03-20  9:18           ` Roger Quadros
2015-03-20  9:32           ` Peter Chen
2015-03-19  8:26   ` Li Jun
2015-03-19  8:26     ` Li Jun
2015-03-19 10:30     ` Roger Quadros
2015-03-19 10:30       ` Roger Quadros
2015-03-19 14:41       ` Li Jun
2015-03-19 14:41         ` Li Jun
2015-03-19 14:54         ` Roger Quadros
2015-03-19 14:54           ` Roger Quadros
2015-03-18 13:55 ` [RFC][PATCH 4/9] usb: otg: hub: Notify OTG fsm when A device sets b_hnp_enable Roger Quadros
2015-03-18 13:55   ` Roger Quadros
2015-03-18 13:55 ` Roger Quadros [this message]
2015-03-18 13:55   ` [RFC][PATCH 5/9] usb: hcd: adapt to OTG Roger Quadros
2015-03-18 13:56 ` [RFC][PATCH 6/9] usb: gadget: udc: " Roger Quadros
2015-03-18 13:56   ` Roger Quadros
2015-03-18 13:56 ` [RFC][PATCH 7/9] usb: dwc3: adapt to OTG core Roger Quadros
2015-03-18 13:56   ` Roger Quadros
2015-03-18 13:56 ` [RFC][PATCH 8/9] usb: otg-fsm: Remove unused members in struct otg_fsm Roger Quadros
2015-03-18 13:56   ` Roger Quadros
2015-03-19  3:46   ` Peter Chen
2015-03-19  3:46     ` Peter Chen
2015-03-19 10:20     ` Roger Quadros
2015-03-19 10:20       ` Roger Quadros
2015-03-18 13:56 ` [RFC][PATCH 9/9] usb: otg-fsm: Add documentation for " Roger Quadros
2015-03-18 13:56   ` Roger Quadros
2015-03-18 17:37 ` [RFC][PATCH 0/9] USB: OTG Core functionality Tony Lindgren
2015-03-19 10:31   ` Roger Quadros
2015-03-19 10:31     ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426686963-11613-6-git-send-email-rogerq@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@ti.com \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=peter.chen@freescale.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.