From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: RE: [PATCH 04/21] usb: chipidea: Only read/write OTGSC from one place Date: Mon, 27 Jun 2016 12:07:54 -0700 Message-ID: <146705447431.30684.10431147947045016957@sboyd-linaro> References: <20160626072838.28082-1-stephen.boyd@linaro.org> <20160626072838.28082-5-stephen.boyd@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jun Li , "linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" Cc: "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Peter Chen , Greg Kroah-Hartman , "Ivan T. Ivanov" List-Id: linux-arm-msm@vger.kernel.org Quoting Jun Li (2016-06-27 01:04:39) > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index > > 03b6743461d1..763a8332b009 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -104,7 +104,32 @@ void ci_handle_vbus_change(struct ci_hdrc *ci) > > usb_gadget_vbus_disconnect(&ci->gadget); > > } > > > > -#define CI_VBUS_STABLE_TIMEOUT_MS 5000 > > +/** > > + * Sometimes, it needs to wait register value before going on. > > + * Eg, when switch to device mode, the vbus value should be lower > > + * than OTGSC_BSV before connects to host. > > This should be updated since this API is dedicated for BSV now. Ok I've updated it to say: When we switch to device mode, the vbus value should be lower than OTGSC_BSV before connecting to host. > > > + * > > + * @ci: the controller > > + * > > + * This function returns an error code if timeout */ static int > > +hw_wait_otgsc_bsv(struct ci_hdrc *ci) { > > + unsigned long elapse = jiffies + msecs_to_jiffies(5000); > > + u32 mask = OTGSC_BSV; > > + > > + while (!hw_read_otgsc(ci, mask)) { > > Reverse logic, should be: > while (hw_read_otgsc(ci, mask)) { > Good catch! Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbcF0TID (ORCPT ); Mon, 27 Jun 2016 15:08:03 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34649 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbcF0TIA convert rfc822-to-8bit (ORCPT ); Mon, 27 Jun 2016 15:08:00 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Jun Li , "linux-usb@vger.kernel.org" From: Stephen Boyd In-Reply-To: Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "Andy Gross" , "Bjorn Andersson" , "Neil Armstrong" , "Arnd Bergmann" , "Felipe Balbi" , "Peter Chen" , "Greg Kroah-Hartman" , "Ivan T. Ivanov" References: <20160626072838.28082-1-stephen.boyd@linaro.org> <20160626072838.28082-5-stephen.boyd@linaro.org> Message-ID: <146705447431.30684.10431147947045016957@sboyd-linaro> User-Agent: alot/0.3.7 Subject: RE: [PATCH 04/21] usb: chipidea: Only read/write OTGSC from one place Date: Mon, 27 Jun 2016 12:07:54 -0700 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Jun Li (2016-06-27 01:04:39) > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index > > 03b6743461d1..763a8332b009 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -104,7 +104,32 @@ void ci_handle_vbus_change(struct ci_hdrc *ci) > > usb_gadget_vbus_disconnect(&ci->gadget); > > } > > > > -#define CI_VBUS_STABLE_TIMEOUT_MS 5000 > > +/** > > + * Sometimes, it needs to wait register value before going on. > > + * Eg, when switch to device mode, the vbus value should be lower > > + * than OTGSC_BSV before connects to host. > > This should be updated since this API is dedicated for BSV now. Ok I've updated it to say: When we switch to device mode, the vbus value should be lower than OTGSC_BSV before connecting to host. > > > + * > > + * @ci: the controller > > + * > > + * This function returns an error code if timeout */ static int > > +hw_wait_otgsc_bsv(struct ci_hdrc *ci) { > > + unsigned long elapse = jiffies + msecs_to_jiffies(5000); > > + u32 mask = OTGSC_BSV; > > + > > + while (!hw_read_otgsc(ci, mask)) { > > Reverse logic, should be: > while (hw_read_otgsc(ci, mask)) { > Good catch! Thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 From: stephen.boyd@linaro.org (Stephen Boyd) Date: Mon, 27 Jun 2016 12:07:54 -0700 Subject: [PATCH 04/21] usb: chipidea: Only read/write OTGSC from one place In-Reply-To: References: <20160626072838.28082-1-stephen.boyd@linaro.org> <20160626072838.28082-5-stephen.boyd@linaro.org> Message-ID: <146705447431.30684.10431147947045016957@sboyd-linaro> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Quoting Jun Li (2016-06-27 01:04:39) > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index > > 03b6743461d1..763a8332b009 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -104,7 +104,32 @@ void ci_handle_vbus_change(struct ci_hdrc *ci) > > usb_gadget_vbus_disconnect(&ci->gadget); > > } > > > > -#define CI_VBUS_STABLE_TIMEOUT_MS 5000 > > +/** > > + * Sometimes, it needs to wait register value before going on. > > + * Eg, when switch to device mode, the vbus value should be lower > > + * than OTGSC_BSV before connects to host. > > This should be updated since this API is dedicated for BSV now. Ok I've updated it to say: When we switch to device mode, the vbus value should be lower than OTGSC_BSV before connecting to host. > > > + * > > + * @ci: the controller > > + * > > + * This function returns an error code if timeout */ static int > > +hw_wait_otgsc_bsv(struct ci_hdrc *ci) { > > + unsigned long elapse = jiffies + msecs_to_jiffies(5000); > > + u32 mask = OTGSC_BSV; > > + > > + while (!hw_read_otgsc(ci, mask)) { > > Reverse logic, should be: > while (hw_read_otgsc(ci, mask)) { > Good catch! Thanks.