Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp484726imj; Thu, 7 Feb 2019 07:18:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IYpDv9iP9Gk3y0HTuygpnHgtb1GUaX63IDdtV/BLTTQ0wxIWTG7fqXGt7IN1plcn/hjd+mP X-Received: by 2002:a17:902:8690:: with SMTP id g16mr12944457plo.81.1549552710814; Thu, 07 Feb 2019 07:18:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549552710; cv=none; d=google.com; s=arc-20160816; b=b5rm5asXH49dF/cQZSqZxCkTMVId7ojh/b8O2dOtki/c1TFJwoZxjDBd4/F/z2ZN4k KtMT8Wzoi26jJvYwdDlKrKIJ+R3mcqleXCtt95or2m16W2/jCaZxJeCOUlDdjYMJ6WsV eIHwqacoqzrs4cMOJfqAqZdVXm1QWBzejOQUdB9ftBpgF/UCrMUBEZp9mdXaAOTbMlzO cEoK7oSzrMJXMH36a12uIGTJXnLazvCRHWvgW6OyM9n2wx5TAykU3yXjqe5qdhWrm67B gcnNx2G6S/BWoaoxiyL253rtFkOUJLckbnMfDnreA3ILx7jZmB109KNR50IsZ381BI3I Mbsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=f6nYbk9CfPOAf3jV4FS+0waz/Vh9XejXm1uS2dqF/hU=; b=kdZG0McV3Elrhjep0E7iD8UnuBmerybLWQB1Dip7WaqDWrqx3lem5AWr7Ohj9cm1L2 u9dEzmLKgoarTqcs5k8cJ6lAvi7L4NUHlheBWPLqFlrooG8WFLrKLT8uOGOMd8S666EY f3bDWDIB8gkVKCha3BczZ//b1l4MdgDpYaHHifEqQofimPh2zW1GltQkBm+FT58d9SlL TKKxEF9Go6QPnavPOzDZN2blr+BSyAOnU8Bph06plDddAEwoNKNL1w2Pu3vT9OY8Mcr5 zoV+RH0paWJTMDJevmIQSYpg8Y5u9r7p7nD78C9HqS0vaNTxoOkrVBcwRthLaOrj2L8A Sr+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="ef/p43L+"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si9433353pll.30.2019.02.07.07.18.14; Thu, 07 Feb 2019 07:18:30 -0800 (PST) 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; dkim=pass header.i=@broadcom.com header.s=google header.b="ef/p43L+"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbfBGPRu (ORCPT + 99 others); Thu, 7 Feb 2019 10:17:50 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51060 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfBGPRt (ORCPT ); Thu, 7 Feb 2019 10:17:49 -0500 Received: by mail-wm1-f65.google.com with SMTP id z5so253114wmf.0 for ; Thu, 07 Feb 2019 07:17:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f6nYbk9CfPOAf3jV4FS+0waz/Vh9XejXm1uS2dqF/hU=; b=ef/p43L+DfaK/3/XJz9rI92id63xSN+v5mt3Mf7foy1nvv2MR3Ew+6qF3tMnheQIU9 oJGalN6tos++BnnhnE3UZFsS6R7oMr9VgGF9hZ7kXlI6RuER1rnyOBJEMd8SZbTF+Yd7 Lyr2iQfE//T6LylYVTovoOvLBL32Yn42iEdhQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f6nYbk9CfPOAf3jV4FS+0waz/Vh9XejXm1uS2dqF/hU=; b=kh20PSJnxFWaqAK8RIjk/IrE/LStE3RQ7pXKbgb+pAE7GSqg+ySmYvuEfRGV6eSAeX J3pqPw/iqQLZdpjgO7Bwga0lQ2u6NWMfI6e0OHmXVFESIy3QVsXBsr8zpT2wLNP/TRWM 69D3UuSSUWHXBRHFqgMXfCaHVQuIYMRwk3TRjQ07QKaNOhlJLZxvz0hd3cb2Jznj5aFK c+is3ZrExfJUuIelw7fk2unzc3mi5NaZKiua57TQFFCp7DI9KY3dGTq7eGLI60vwokv7 BaFHmB8OImUFmfaCdA25RTSAKa07g31FfiTGpUXCC6rO+6AVtxCrVVgFlHNpCDuCpUq+ a0MQ== X-Gm-Message-State: AHQUAuZw/O8A/3kcpPRJcY+RFfxE32WgjRAZ38wY7C6XdSh1qIjeqkcb 6sQ6H0jn/dV4zbIFh/YksOL9JoXG1YuGfarkeC9HKg== X-Received: by 2002:a1c:2c6:: with SMTP id 189mr7670003wmc.21.1549552667171; Thu, 07 Feb 2019 07:17:47 -0800 (PST) MIME-Version: 1.0 References: <1549347534-11320-1-git-send-email-srinath.mannam@broadcom.com> <1549347534-11320-3-git-send-email-srinath.mannam@broadcom.com> <6392f206-9db2-5506-9e5d-cdf2b784d32e@linux.intel.com> In-Reply-To: <6392f206-9db2-5506-9e5d-cdf2b784d32e@linux.intel.com> From: Srinath Mannam Date: Thu, 7 Feb 2019 20:47:34 +0530 Message-ID: Subject: Re: [PATCH 2/2] drivers: xhci: Add quirk to reset xHCI port PHY To: Mathias Nyman Cc: Greg Kroah-Hartman , Mathias Nyman , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathias, Thanks for review, please see my comments below inline. On Thu, Feb 7, 2019 at 8:32 PM Mathias Nyman wrote: > > On 05.02.2019 08:18, Srinath Mannam wrote: > > Add a quirk to reset xHCI port PHY on port disconnect event. > > Stingray USB HS PHY has an issue, that USB High Speed device detected > > at Full Speed after the same port has connected to Full speed device. > > This problem can be resolved with that port PHY reset on disconnect. > > > > Signed-off-by: Srinath Mannam > > Reviewed-by: Ray Jui > > --- > > drivers/usb/core/hcd.c | 6 ++++++ > > drivers/usb/core/phy.c | 21 +++++++++++++++++++++ > > drivers/usb/core/phy.h | 1 + > > drivers/usb/host/xhci-plat.c | 3 +++ > > drivers/usb/host/xhci-ring.c | 9 ++++++--- > > drivers/usb/host/xhci.h | 1 + > > include/linux/usb/hcd.h | 1 + > > 7 files changed, 39 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > > index 015b126..e2b87a6 100644 > > --- a/drivers/usb/core/hcd.c > > +++ b/drivers/usb/core/hcd.c > > @@ -2663,6 +2663,12 @@ int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1) > > return hcd->driver->find_raw_port_number(hcd, port1); > > } > > > > +int usb_hcd_phy_port_reset(struct usb_hcd *hcd, int port) > > +{ > > + return usb_phy_roothub_port_reset(hcd->phy_roothub, port); > > +} > > +EXPORT_SYMBOL_GPL(usb_hcd_phy_port_reset); > > + > > static int usb_hcd_request_irqs(struct usb_hcd *hcd, > > unsigned int irqnum, unsigned long irqflags) > > { > > diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c > > index 38b2c77..c64767d 100644 > > --- a/drivers/usb/core/phy.c > > +++ b/drivers/usb/core/phy.c > > @@ -162,6 +162,27 @@ void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub) > > } > > EXPORT_SYMBOL_GPL(usb_phy_roothub_power_off); > > > > +int usb_phy_roothub_port_reset(struct usb_phy_roothub *phy_roothub, int port) > > +{ > > + struct usb_phy_roothub *roothub_entry; > > + struct list_head *head; > > + int i = 0; > > + > > + if (!phy_roothub) > > + return -EINVAL; > > + > > + head = &phy_roothub->list; > > + > > + list_for_each_entry(roothub_entry, head, list) { > > + if (i == port) > > + return phy_reset(roothub_entry->phy); > > + i++; > > + } > > I'm not that familiar with SoC's that have several PHYs per controller, > but this looks odd. > > For the above code to work wouldn't it require that each port has their own PHY, > and the PHYs are added to the list of usb_phy_roothub is in the same order as usb ports? > > Or is there something I don't understand here? > In our SOC (Stingray), xHCI controller has three ports and each port connected to separate PHY. Stingray xHCI controller supports both SS and HS ports and connected separate PHYs. We passed PHY phandlers in xHCI DT node in the order of port numbers. as shown below xHCI DT node. So that all PHYs added to usb_phy_roothub are in order of port numbers. xhci1: usb@11000 { compatible = "generic-xhci"; reg = <0x00011000 0x1000>; interrupts = ; phys = <&usb1_phy1>, <&usbphy2>, <&usb1_phy0>; phy-names = "phy0", "phy1", "phy2"; dma-coherent; status = "disabled"; }; But we have issue with HS PHYs, so that those PHYs are required to reset. Regards, Srinath. > -Mathias >