From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751772AbbKPU0c (ORCPT ); Mon, 16 Nov 2015 15:26:32 -0500 Received: from mail-yk0-f169.google.com ([209.85.160.169]:33216 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbbKPU01 (ORCPT ); Mon, 16 Nov 2015 15:26:27 -0500 MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 16 Nov 2015 12:26:26 -0800 X-Google-Sender-Auth: sRn_VuIFkhEWvpSOQbDdBES-BBg Message-ID: Subject: Re: [PATCH v2 1/2] usb: dwc2: host: Fix missing device insertions From: Julius Werner To: Doug Anderson Cc: Alan Stern , Felipe Balbi , John Youn , Yunzhi Li , =?UTF-8?Q?Heiko_St=C3=BCbner?= , "open list:ARM/Rockchip SoC..." , Julius Werner , "Herrero, Gregory" , "Kaukab, Yousaf" , Dinh Nguyen , John Youn , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Another point to note, which I think is what prevents the flow Alan suggested from working, is this little snippet in DWC2's hub_control GetPortStatus callback: if (!hsotg->flags.b.port_connect_status) { /* * The port is disconnected, which means the core is * either in device mode or it soon will be. Just * return 0's for the remainder of the port status * since the port register can't be read if the core * is in device mode. */ *(__le32 *)buf = cpu_to_le32(port_status); break; } This is before it actually checks the register state of the port. So it relies on dwc2_hcd_connect() and dwc2_hcd_disconnect() to be called in the right order to give the correct answer for USB_PORT_STAT_CONNECTION. This could maybe be improved but I don't know what kind of weird interactions with device mode operation made that snippet necessary in the first place.