From patchwork Mon Mar 18 08:45:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 10856991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7832113B5 for ; Mon, 18 Mar 2019 08:45:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 567AD291B3 for ; Mon, 18 Mar 2019 08:45:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A17E292C4; Mon, 18 Mar 2019 08:45:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47110292A1 for ; Mon, 18 Mar 2019 08:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kYQQCRNTIxP0UnthD+nil9yoZZ4WHGx11AxH6kaEkWs=; b=EltfVYQU9G2SZf 8FDSApYvV39CX/P+GwZ3ukYyBs5+azM2ttnhYiQNq1zUKwp3p19x8Etqm/ltxDtRWw9vYO5bG5det 3j6DFVwqHzGxTWCdB3X7WpeDItOQB7E3XMWWfes6bBytg3g4EnGEyMucIC7krNbT0kzAhQqb4eobQ XP376VtyJ7BliGyIWJLcZmk54jtqYMoHzytbhPUQWR0M7MhSSgk4PzFnunkD/jSB15TgKpHA/klIK v32KId3uZDqLKgFkFM8B69jOayvc3az2H/D/xh5P668+fZuL47bOQ9QbHIUMN3OREaabkWbHIGdAH Xe4ZC7dSdK3T5Ab92hEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5nu2-0000rv-7G; Mon, 18 Mar 2019 08:45:50 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5ntx-0000ir-3T for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2019 08:45:47 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 38A945FD14; Mon, 18 Mar 2019 16:45:36 +0800 (CST) Date: Mon, 18 Mar 2019 16:45:36 +0800 From: Chen-Yu Tsai To: Maxime Ripard , Greg Kroah-Hartman , Grygorii Strashko Subject: [BUG] USB (EHCI/OHCI) broken on Allwinner SoCs Message-ID: <20190318084536.GA27150@wens.csie.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190318_014545_682575_44AE463F X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kishon Vijay Abraham I Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi everyone, USB EHCI/OHCI hosts are broken on Allwinner SoCs on v5.1-rc1. I believe this is partially triggered by commit b97a31348379 ("usb: core: comply to PHY framework"), and partially due to how the Allwinner USB PHY driver handles phy_set_mode for non-OTG PHYs. Note this is not from a bisect. The following changes fix this. Hunk 1 makes our PHY driver accept PHY_MODE_USB_HOST for the non-OTG PHYs as a no-op. --- If the two changes make sense I'll send them out as actual patches. diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 5163097b43df..4bbd9ede38c8 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -485,8 +485,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); int new_mode; - if (phy->index != 0) + if (phy->index != 0) { + if (mode == PHY_MODE_USB_HOST) + return 0; return -EINVAL; + } switch (mode) { case PHY_MODE_USB_HOST: --- Hunk 2 makes the USB core call phy_set_mode with PHY_MODE_USB_HOST instead of PHY_MODE_USB_HOST_SS. Not sure why PHY_MODE_USB_HOST_SS was used here, but I believe only a small set of hardware actually support SuperSpeed, so it might be better to use the more encompasing PHY_MODE_USB_HOST. That or the core code would have to check which speed class the port is for and pass in the appropriate mode. The Allwinner PHYs do not support SuperSpeed. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 3189181bb628..7f25e384144d 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2740,7 +2740,7 @@ int usb_add_hcd(struct usb_hcd *hcd, return retval; retval = usb_phy_roothub_set_mode(hcd->phy_roothub, - PHY_MODE_USB_HOST_SS); + PHY_MODE_USB_HOST); if (retval) goto err_usb_phy_roothub_power_on;