From patchwork Mon Sep 18 13:40:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 814925 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JsjJHqv7"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xwnCt4CXmz9s7c for ; Mon, 18 Sep 2017 23:39:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 574E9C21E61; Mon, 18 Sep 2017 13:37:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E8DA9C21F4D; Mon, 18 Sep 2017 13:36:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 25A45C21E73; Mon, 18 Sep 2017 13:36:36 +0000 (UTC) Received: from mail-io0-f194.google.com (mail-io0-f194.google.com [209.85.223.194]) by lists.denx.de (Postfix) with ESMTPS id 080F9C21F2C for ; Mon, 18 Sep 2017 13:36:33 +0000 (UTC) Received: by mail-io0-f194.google.com with SMTP id d16so1093413ioj.2 for ; Mon, 18 Sep 2017 06:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8zANgsFgFeXefouAmNBhC7dTu6MEv4+WxxdwiVHIUew=; b=JsjJHqv7CY3+rJuooQNOXqnYqMKrAo7h1BoTVQ4tFZPB/Ttw2TxTj4ce13MfF4b17g vxUr1ZJoK7eSxrnW5rkWDKy7Nl2Y4x4E+/SeAn+Pr0kYemf0PRv0he94SMQlcOLZfu3Q z+ohHjZQByUMSwp7czlfoyi1hk3h2a66fvW8A8Q2t3F8FvWiWuIJCnNKrs0VaVTcqtdf VZ3muNRREEhP1G7b0OLjz0Gz/wI7D6pxLSkabuDze2SkEHFw4CYl3GFJ8/cDWGMaha7+ 7rJ+X1p/kIH4I65DpbkZDY+a7sltFx2dOMHRAZAZaZdTE/8cHZazk9u8xFoCvqvbL3Ac 9DGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8zANgsFgFeXefouAmNBhC7dTu6MEv4+WxxdwiVHIUew=; b=Q6lm+px2mKWWRDuPlnymho3shA22Nh2kIxyw6X+kbaJMWJCpsGXqVR+k/OByZU7aCa PXMFiO77sscnT0od/Z2WAJOmPGjxS/lmVXKcwtnDgQOheU/Q/OqTM+LL5shLTQb1jPyE bG5TRp0k21/kDNn73YVh0uyR37VwfnOMZ9wMDyihDjFqRvLABpxqyZzzXUcsdsiir/uj kxqiZFNjaRCQjh5+HHf1YZ1Qa9G5QfNNgo2ENX61WFcbN+0aAmMBmsYdQBxrfbHimueA 6lusxXPbquCaUcSjm+P3uQzm8P2VEpHMnicl7LMafKBW/cSSbKtMmq+1QDzCI5UYN8Nb Bq1g== X-Gm-Message-State: AHPjjUgJ/cl09TzXWIuVxeuK6HAt1f9UiPq3aJ4x3y/nia1KlbEnCfZS mhwWwYzty/LcxA== X-Google-Smtp-Source: AOwi7QCvd+XyypWm6/yCj5i3vQ6h7TpzR3bcvTbf0i/advB90J4vrLFvkk75qFKnsAN6yNwNfh45zQ== X-Received: by 10.107.68.6 with SMTP id r6mr17283272ioa.282.1505741791971; Mon, 18 Sep 2017 06:36:31 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id 193sm2528740ion.83.2017.09.18.06.36.30 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 06:36:31 -0700 (PDT) From: Bin Meng To: Marek Vasut , U-Boot Mailing List Date: Mon, 18 Sep 2017 06:40:39 -0700 Message-Id: <1505742050-5697-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1505742050-5697-1-git-send-email-bmeng.cn@gmail.com> References: <1505742050-5697-1-git-send-email-bmeng.cn@gmail.com> Cc: Stefan Roese Subject: [U-Boot] [PATCH 03/14] usb: xhci: Don't assume LS/FS devices are always behind a HS hub X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present xHCI driver assumes LS/FS devices are attached directly to a HS hub. If they are connected to a LS/FS hub, the driver will fail to perform the USB enumeration process on such devices. This is fixed by looking from the device itself all the way up to the HS hub where the TT that serves the device is located. Signed-off-by: Bin Meng Reviewed-by: Stefan Roese Tested-by: Stefan Roese --- drivers/usb/host/xhci-mem.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index d5eab3a..84982a9 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -786,12 +786,22 @@ void xhci_setup_addressable_virt_dev(struct xhci_ctrl *ctrl, #ifdef CONFIG_DM_USB /* Set up TT fields to support FS/LS devices */ if (speed == USB_SPEED_LOW || speed == USB_SPEED_FULL) { - dev = dev_get_parent_priv(udev->dev); - if (dev->speed == USB_SPEED_HIGH) { - hub = dev_get_uclass_priv(udev->dev); + struct udevice *parent = udev->dev; + + dev = udev; + do { + port_num = dev->portnr; + dev = dev_get_parent_priv(parent); + if (usb_hub_is_root_hub(dev->dev)) + break; + parent = dev->dev->parent; + } while (dev->speed != USB_SPEED_HIGH); + + if (!usb_hub_is_root_hub(dev->dev)) { + hub = dev_get_uclass_priv(dev->dev); if (hub->tt.multi) slot_ctx->dev_info |= cpu_to_le32(DEV_MTT); - slot_ctx->tt_info |= cpu_to_le32(TT_PORT(udev->portnr)); + slot_ctx->tt_info |= cpu_to_le32(TT_PORT(port_num)); slot_ctx->tt_info |= cpu_to_le32(TT_SLOT(dev->slot_id)); } }