Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp359312pxb; Thu, 19 Aug 2021 00:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPwXOkiTOZ09ijZciHcpitf9RZo1Ooal4uu0rBAOGivi7TpSDbtgbQV23yKLktwTFcx81o X-Received: by 2002:a17:906:1994:: with SMTP id g20mr6310191ejd.397.1629359781962; Thu, 19 Aug 2021 00:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629359781; cv=none; d=google.com; s=arc-20160816; b=weTzQcLH1gTDfg2pjThBqGj/5gr1ejvbwBDsqWyJdWgAqYsu9ai0JVfmMHTMgGBkCo 0p8N971D5zK0yoIpNCLHuzVwFxB5K4foCAwzCnUQPO4BljExlwLHctdPq5E7dzDDMrz2 zrA51geMpXI9Dd1NiOQcp2nXsN5+UBmfS6+RP03FebjP2lp4tOYhmzJ6sv2I5B2/xWif 9Gpy1Tt3JYxp1VwordYd8gzFGQhETyRiVhTN7GrzQSuLo5WupOyUakwlCKA6NB4WmXPN 4ChwPhiHPJkCRUYOkPdN3s6ts941Z6jNIfDqWovDPMFpvRjojVosdjgZfZzvvOVfPJUT Fs1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:cc:to:subject:from :dkim-signature; bh=g3NA6TAPmHsiOTu/kQX02ombBmyI8/kC8+scYqlO3kY=; b=a+0jedg0yIb91lAWDL1XJkZz5r7iElpjQ6DDDoDzo1batfvVtODiG5XvZw4WpZ+YEa Ujp7l9181uWxMGAnro1s2WoAw6NgqirlJ8oDEt6vvGtgJEGuOwnZkfQNZINBIx0TAwAB +v0qOelvNnTlFASbNU6JEH203QSqxXRup65h16zw+e58x2SG3iL/M37H8BKCp6P4pUv2 GTgJdapH26Y3LHwWkGyALrptRj9htWzDzXE8QQ8pmht5FGK2EZ4pRsGIbeJOrAF1MK7n Wc/N1a7UYk6CbFKYqqtdOIHjRt9s93EBjk/6mJPwnz1PIt5p0CFc0Dnrihwl/7E9xGih cAFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=W04yU6PK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl18si2836276ejc.160.2021.08.19.00.55.57; Thu, 19 Aug 2021 00:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=W04yU6PK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236379AbhHSHy5 (ORCPT + 99 others); Thu, 19 Aug 2021 03:54:57 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:57896 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbhHSHy5 (ORCPT ); Thu, 19 Aug 2021 03:54:57 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 17J7sHph119008; Thu, 19 Aug 2021 02:54:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1629359657; bh=g3NA6TAPmHsiOTu/kQX02ombBmyI8/kC8+scYqlO3kY=; h=From:Subject:To:CC:Date; b=W04yU6PKB7X++RGrH1xa4JXi8RGK7JPiZ75OIxCeyh8XDpCfa1MnW2KBmBis9LN+S PQyn48urUa1Hy7eYxD0k/ore2Gt8m6AYc0Em+5vO+NeFGt9RYWWlWIS1k0GXbxvreD i33WBZLrpK4a7VrhH+p3CWIJXKBvFIjbg9U25NLk= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 17J7sHSj120360 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 19 Aug 2021 02:54:17 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 19 Aug 2021 02:54:17 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 19 Aug 2021 02:54:17 -0500 Received: from [10.250.232.210] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 17J7sEnS054719; Thu, 19 Aug 2021 02:54:15 -0500 From: Kishon Vijay Abraham I Subject: [QUERY] Cold plugged USB device to Inateck PCIE USB card is not detected To: Mathias Nyman , , Greg Kroah-Hartman , Alan Stern CC: Kishon Vijay Abraham I , "linux-kernel@vger.kernel.org" , Lokesh Vutla Message-ID: <772e4001-178e-4918-032c-6e625bdded24@ti.com> Date: Thu, 19 Aug 2021 13:24:08 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, I was trying to test PCIe USB card (Inateck) connected to AM64 EVM and J7200 EVM. Inateck uses Renesas uPD720201 USB3 host controller. So if I connect USB pendrive and then boot the board (cold plug), I don't see the pendrive getting detected. But if I remove and plug it again, it gets detected. For the cold plug case, I see this message "usb usb1-port3: couldn't allocate usb_device" It actually fails in xhci_alloc_dev()->xhci_queue_slot_control()->queue_command()->XHCI_STATE_HALTED I'm not familiar with xhci but it looks like port event is invoked before the controller is fully initialized (?). I tried the following hack which kind of changes the sequence where xhci_start() and xhci_run_finished() is invoked before port_event() and with that I could see the pendrive enumerate successfully in cold plug case. diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 228e3d4e1a9f..d19f27c46c6f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1077,7 +1077,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) INIT_DELAYED_WORK(&hub->init_work, hub_init_func2); queue_delayed_work(system_power_efficient_wq, &hub->init_work, - msecs_to_jiffies(delay)); + msecs_to_jiffies(150)); /* Suppress autosuspend until init is done */ usb_autopm_get_interface_no_resume( Irrespective of the delay the port status looks correct and the modified delay only helps to change the flow. Adding other prints and delays also change the sequence and seems to detect the connected pendrive. Can someone provide hints on how to fix this properly? Thanks in advance! Regards Kishon