Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp233496img; Mon, 18 Mar 2019 01:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTFYB8mSrTtE/vp+LbIFjGh+KexH5r78MKboZE8RhinfoSf1XBR+VVepMdL5S0ZVrsCxUE X-Received: by 2002:a17:902:54f:: with SMTP id 73mr18845775plf.210.1552898880465; Mon, 18 Mar 2019 01:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552898880; cv=none; d=google.com; s=arc-20160816; b=uIP1O4n+Ba8CojrapUkNo5xSbglyqpxwyHIs4NBv3cXTOhS+SxIVp2XuFFJUeWX6qB Cs6ue1uHnc/89JLvf1CM0Ir0LSRhR6p8gcJ4pVbltaVRj596s2UaiQkHMADevDJvO4ib 9rQT5aDSO8C3M33QBQhTLucU8tc/Ca3XgemBtJVfiVz6crDSkjCdJjnY5mNzhnblnKHY bUIcW2Nw11HuJ+ChlJmlDaJUzZ2grBzwY6ZkDqp8+ZOtL5kB9WD+aefwmZv0UbIe6Ecc 4aPRiH6tDGx/sTUSnFyMEwdEUXPbWShgBKet2z2si7IC9uoOTDjCL8+T+OpIA67BK8mT +42Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=DsXquo9IdAKYsTlMIqewKDyK/W2bzPZk/8BeujFmVc8=; b=BTD6CU0SmC1iIdmlwVOoxiBO/PRiWb6UAZLtdCGR7YjXDD3fSf+DyAJMfi5JXEkx9s Iu9FvXCZhxGMEcz6Ul+wQ0WrzR3ejpKK7cVYc+2+ZZSVu10jMdwMajjWWliwGlkanuFl ln+BfjtUIJMIXIBf44aQWea/qlDSorsrzZVPhANQxZdRs/g4s8UjeMFfADV23eLFdUZ5 URmnDw41f5ePVwUdUhYIh4OwH84KFCeTjeTXukqe4dLj2RfsmYKGHFmTnNOIRHekL67k rWkSom62bjbV51O+34QulnyFMhjJfNfDJR6mMzEVqwSghPJKhPEcbDZK5R6VuzWdn62v NvNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y18si8521456pgf.247.2019.03.18.01.47.45; Mon, 18 Mar 2019 01:48:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfCRIpk (ORCPT + 99 others); Mon, 18 Mar 2019 04:45:40 -0400 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:41002 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726946AbfCRIpi (ORCPT ); Mon, 18 Mar 2019 04:45:38 -0400 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 Cc: Kishon Vijay Abraham I , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [BUG] USB (EHCI/OHCI) broken on Allwinner SoCs Message-ID: <20190318084536.GA27150@wens.csie.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; --- If the two changes make sense I'll send them out as actual patches.