From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Chen Subject: Re: [PATCH v2 07/22] usb: chipidea: Notify events when switching host mode Date: Fri, 8 Jul 2016 17:29:05 +0800 Message-ID: <20160708092905.GE20485@shlinux2> References: <20160707222114.1673-1-stephen.boyd@linaro.org> <20160707222114.1673-8-stephen.boyd@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20160707222114.1673-8-stephen.boyd@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Stephen Boyd Cc: Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Peter Chen , Greg Kroah-Hartman , Andy Gross , linux-arm-kernel@lists.infradead.org List-Id: linux-arm-msm@vger.kernel.org On Thu, Jul 07, 2016 at 03:20:58PM -0700, Stephen Boyd wrote: > The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to > the wrapper drivers when it calls hw_device_reset(), but that > function is not called from chipidea/host.c. And the udc.c file > sends the CI_HDRC_CONTROLLER_STOPPED_EVENT but the host.c file > doesn't do anything. > > The intent of the reset event is to allow the wrapper driver to > do any wrapper specific things after the reset bit has been set > in the usb command register. Therefore, add this event hook in > the host role after we toggle that bit. > > Similarly, the intent of the stopped event is to allow the > wrapper driver to do any wrapper specific things after the device > is stopped. So when we stop the host role, send the stopped > event. > > Cc: Peter Chen > Cc: Greg Kroah-Hartman > Signed-off-by: Stephen Boyd > --- > drivers/usb/chipidea/host.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c > index 053bac9d983c..a1d8551ca79d 100644 > --- a/drivers/usb/chipidea/host.c > +++ b/drivers/usb/chipidea/host.c > @@ -87,6 +87,9 @@ static int ehci_ci_reset(struct usb_hcd *hcd) > if (ret) > return ret; > > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_RESET_EVENT); > + > ci_platform_configure(ci); > > return ret; > @@ -184,6 +187,9 @@ static void host_stop(struct ci_hdrc *ci) > struct usb_hcd *hcd = ci->hcd; > > if (hcd) { > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, > + CI_HDRC_CONTROLLER_STOPPED_EVENT); > usb_remove_hcd(hcd); > usb_put_hcd(hcd); > if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && Acked-by: Peter Chen -- Best Regards, Peter Chen From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932471AbcGHJoj (ORCPT ); Fri, 8 Jul 2016 05:44:39 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36006 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754543AbcGHJge (ORCPT ); Fri, 8 Jul 2016 05:36:34 -0400 Date: Fri, 8 Jul 2016 17:29:05 +0800 From: Peter Chen To: Stephen Boyd Cc: linux-usb@vger.kernel.org, Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Peter Chen , Greg Kroah-Hartman , Andy Gross , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 07/22] usb: chipidea: Notify events when switching host mode Message-ID: <20160708092905.GE20485@shlinux2> References: <20160707222114.1673-1-stephen.boyd@linaro.org> <20160707222114.1673-8-stephen.boyd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160707222114.1673-8-stephen.boyd@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 07, 2016 at 03:20:58PM -0700, Stephen Boyd wrote: > The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to > the wrapper drivers when it calls hw_device_reset(), but that > function is not called from chipidea/host.c. And the udc.c file > sends the CI_HDRC_CONTROLLER_STOPPED_EVENT but the host.c file > doesn't do anything. > > The intent of the reset event is to allow the wrapper driver to > do any wrapper specific things after the reset bit has been set > in the usb command register. Therefore, add this event hook in > the host role after we toggle that bit. > > Similarly, the intent of the stopped event is to allow the > wrapper driver to do any wrapper specific things after the device > is stopped. So when we stop the host role, send the stopped > event. > > Cc: Peter Chen > Cc: Greg Kroah-Hartman > Signed-off-by: Stephen Boyd > --- > drivers/usb/chipidea/host.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c > index 053bac9d983c..a1d8551ca79d 100644 > --- a/drivers/usb/chipidea/host.c > +++ b/drivers/usb/chipidea/host.c > @@ -87,6 +87,9 @@ static int ehci_ci_reset(struct usb_hcd *hcd) > if (ret) > return ret; > > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_RESET_EVENT); > + > ci_platform_configure(ci); > > return ret; > @@ -184,6 +187,9 @@ static void host_stop(struct ci_hdrc *ci) > struct usb_hcd *hcd = ci->hcd; > > if (hcd) { > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, > + CI_HDRC_CONTROLLER_STOPPED_EVENT); > usb_remove_hcd(hcd); > usb_put_hcd(hcd); > if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && Acked-by: Peter Chen -- Best Regards, Peter Chen From mboxrd@z Thu Jan 1 00:00:00 1970 From: hzpeterchen@gmail.com (Peter Chen) Date: Fri, 8 Jul 2016 17:29:05 +0800 Subject: [PATCH v2 07/22] usb: chipidea: Notify events when switching host mode In-Reply-To: <20160707222114.1673-8-stephen.boyd@linaro.org> References: <20160707222114.1673-1-stephen.boyd@linaro.org> <20160707222114.1673-8-stephen.boyd@linaro.org> Message-ID: <20160708092905.GE20485@shlinux2> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Jul 07, 2016 at 03:20:58PM -0700, Stephen Boyd wrote: > The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to > the wrapper drivers when it calls hw_device_reset(), but that > function is not called from chipidea/host.c. And the udc.c file > sends the CI_HDRC_CONTROLLER_STOPPED_EVENT but the host.c file > doesn't do anything. > > The intent of the reset event is to allow the wrapper driver to > do any wrapper specific things after the reset bit has been set > in the usb command register. Therefore, add this event hook in > the host role after we toggle that bit. > > Similarly, the intent of the stopped event is to allow the > wrapper driver to do any wrapper specific things after the device > is stopped. So when we stop the host role, send the stopped > event. > > Cc: Peter Chen > Cc: Greg Kroah-Hartman > Signed-off-by: Stephen Boyd > --- > drivers/usb/chipidea/host.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c > index 053bac9d983c..a1d8551ca79d 100644 > --- a/drivers/usb/chipidea/host.c > +++ b/drivers/usb/chipidea/host.c > @@ -87,6 +87,9 @@ static int ehci_ci_reset(struct usb_hcd *hcd) > if (ret) > return ret; > > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_RESET_EVENT); > + > ci_platform_configure(ci); > > return ret; > @@ -184,6 +187,9 @@ static void host_stop(struct ci_hdrc *ci) > struct usb_hcd *hcd = ci->hcd; > > if (hcd) { > + if (ci->platdata->notify_event) > + ci->platdata->notify_event(ci, > + CI_HDRC_CONTROLLER_STOPPED_EVENT); > usb_remove_hcd(hcd); > usb_put_hcd(hcd); > if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) && Acked-by: Peter Chen -- Best Regards, Peter Chen