From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752977AbdJTL1D convert rfc822-to-8bit (ORCPT ); Fri, 20 Oct 2017 07:27:03 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:48786 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803AbdJTL1B (ORCPT ); Fri, 20 Oct 2017 07:27:01 -0400 From: Minas Harutyunyan To: John Stultz , Minas Harutyunyan CC: John Youn , lkml , Wei Xu , Guodong Xu , "Amit Pundir" , YongQin Liu , Douglas Anderson , Chen Yu , Felipe Balbi , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" Subject: Re: [RESEND x2][PATCH 0/3] dwc2 fixes for edge cases on hikey Thread-Topic: [RESEND x2][PATCH 0/3] dwc2 fixes for edge cases on hikey Thread-Index: AQHTMkq1fSiD2TKttEaGjxxQhxASTg== Date: Fri, 20 Oct 2017 11:26:56 +0000 Message-ID: <410670D7E743164D87FA6160E7907A560113A30FF7@am04wembxa.internal.synopsys.com> References: <1505937448-13475-1-git-send-email-john.stultz@linaro.org> <2B3535C5ECE8B5419E3ECBE3007729090269FF70AC@US01WEMBX2.internal.synopsys.com> <410670D7E743164D87FA6160E7907A560113A21CDB@am04wembxa.internal.synopsys.com> <410670D7E743164D87FA6160E7907A560113A2C8E9@am04wembxa.internal.synopsys.com> <410670D7E743164D87FA6160E7907A560113A2E38F@am04wembxa.internal.synopsys.com> <410670D7E743164D87FA6160E7907A560113A2ECC2@am04wembxa.internal.synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.92] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi John Stultz, On 10/20/2017 12:06 AM, John Stultz wrote: > On Tue, Oct 17, 2017 at 1:41 AM, Minas Harutyunyan > wrote: >> On 10/17/2017 1:34 AM, John Stultz wrote: >>> On Mon, Oct 16, 2017 at 1:36 AM, Minas Harutyunyan >>> wrote: >>>> On b-plug disconnect should asserted GOTGINT.SesEndDet interrupt. >>>> According previously sent by you register dump (GHWCFG2 = 0x23affc70) >>>> your core OTG_MODE=0. >>>> Bellow fragment from programming guide on Device disconnect: >>>> >>>> "7.3Device Disconnection >>>> The device session ends when the USB cable is disconnected or if the >>>> VBUS is switched off by the Host. The >>>> device disconnect flow varies depending on the value of the OTG_MODE >>>> configuration parameter. >>>> >>>> When OTG_MODE = 0,1, or 3 >>>> When OTG_MODE is set to 0,1, or 3, the device disconnect flow is as follows: >>>> 1. When the USB cable is unplugged or when the VBUS is switched off by >>>> the Host, the Device core >>>> trigger GINTSTS.OTGInt [bit 2] interrupt bit. >>>> 2. When the device application detects GINTSTS.OTGInt interrupt, it >>>> checks that the >>>> GOTGINT.SesEndDet (Session End Detected) bit is set to 1’b1." >>>> >>>> So, you should receive and handle "Session End Detected". In function >>>> dwc2_handle_otg_intr() on this interrupt (in device mode) calling >>>> dwc2_hsotg_disconnect() function. By adding your patch "[PATCH 3/3] usb: >>>> dwc2: Fix UDC state tracking" state changed to not attached as required. >>> >>> >>> So, on the HiKey board (using 4.14-rc5 + Vardan's patch), I'm not >>> seeing the GOTGINT_SES_END_DET in dwc2_handle_otg_intr() when I remove >>> the USB OTG cable. >>> >>> In fact, I'm not seeing any calls to dwc2_handle_otg_intr()... which >>> seems... odd maybe? Any clues as to what might be going wrong then? >>> >>> thanks >>> -john >>> >> Hi John Stultz, >> So, on Hikey board on unplug B connector GOTGINT.SesEndDet interrupt not >> asserted, instead asserted GINTSTS_CONIDSTSCHNG. Please, confirm. > > Correct. On B unplug, I see: > dwc2_handle_conn_id_status_change_intr: ++Connector ID Status Change > Interrupt++ (Host) I can't understand how on B unplug connector id status changed to host! More probable it's board design issue. Please investigate hikey design. Electrically Connector ID pin status changed when plugged A connector and when unplugged A connector because of in A connector internally ConnID pin connected to ground. In B connector ConnID pin floating. > > And I never see any calls to dwc2_handle_otg_intr(). > >> In this case without your patch "[PATCH 1/3] usb: dwc2: Improve gadget >> state disconnection handling" but by applying your patch "[PATCH 3/3] >> usb: dwc2: Fix UDC state tracking": >> 1. On B plug connect UDC state will be set to "configured" >> 2. On B plug disconnect - "not attached". >> Is it Ok for you? > On our setup I tested your patch 3/3 without patches 1/3 and 2/3 and its changed state correctly. > So this is what I expect, but I don't see it. Since without my patch, > nothing seems to call disconenct when the B plug is disconnected, I > still see: > # cat /sys/class/udc/f72c0000.usb/state > configured > > thanks > -john >