Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2951611imm; Thu, 24 May 2018 19:45:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZNUqVKkm9DH1Bqqtohmfc6ERIbuVk+sMVjgleageXCbUZPuNv0mgpyTNUQHKYDW5FeA1S X-Received: by 2002:a17:902:7288:: with SMTP id d8-v6mr632759pll.218.1527216341421; Thu, 24 May 2018 19:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216341; cv=none; d=google.com; s=arc-20160816; b=HrcD0YZTkp9LYG8PTBkZ3djWXFUrK3mJ1snZ6fg0dpSO9ZgYP5pQfr0JbxOICfypwX 2HBb75hYJ/qKnEIQWwMSogXZAXlFn4Q3EuPsVNkSG2KLACChVZD5f48xYTq/zwBTGwrf oXsJ+20BbqkX7VSMABuAkumVS8azE6uO47jfAkJrh1mFNlK1jJEJ207QmTYVAUCnEiCL qoDUB30yedIRr+xxoVVGq6qAgYa6Dwki+KElFM2cvwgXUw1JmFJVisKZ/ALTq2jowXMZ rjEVT8+tNPgYZDtlM27fCDs5bPSU5KQHibK1xzoT8OMUT3p+OKT+Wt2U1HET4QiaCaLl aNZw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=i55HR6h2fZxDcxNrM4epAaP/EnlD2mWeL8yw+waKqHk=; b=BI4+ygIL60/cHJ7EDqx1V5dF6E/YyB4zMRy34cxbp7uiCFNAdVd1jr1CkiUctwYK5e 8JT6iMWdA0la0MCCwgzDlK5y1F7g9FwmJOr+M9PXnl5+tjdTCBkyUIR78PYKuLSccXVN 9MzRvvhlY48KtnVEHaYWQPDpAEebzGOcxxPv+eslO4TLaCn+OiAZw3Y+YDq2NxggeIGH 5mcYfL734rX1pJrykhJRiQRRWfhHGhiW2lAushuYz3s8SbyRMxBOZE72TWPd61o6G9fW +WYA19D+B3RzufUCPAx+DNvQBKsHZvIUXnfSdaN4/CWSJk2Olrcq+1ae4PjIyA2/6/4m Po4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PPuABRGR; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si15119390pgt.114.2018.05.24.19.45.26; Thu, 24 May 2018 19:45:41 -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; dkim=pass header.i=@chromium.org header.s=google header.b=PPuABRGR; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034666AbeEXWFU (ORCPT + 99 others); Thu, 24 May 2018 18:05:20 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38108 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966031AbeEXWFS (ORCPT ); Thu, 24 May 2018 18:05:18 -0400 Received: by mail-pg0-f67.google.com with SMTP id n9-v6so1371404pgq.5 for ; Thu, 24 May 2018 15:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=i55HR6h2fZxDcxNrM4epAaP/EnlD2mWeL8yw+waKqHk=; b=PPuABRGRE+ZeiJQZg3SXe4bI7ewa4YX10Fe5qPeYlVIuo7YjefBi01w9Oi4B0FFNQf mn8VrdHpTvFczBebWwMKXUSi8xuAy71Nhml8EOE4Jd1tsmLbdsF7PsL95OxTyyZ2eFsM qZ/f7gBvtjLk7SN4y7nsvb0B6+mUasAhppiT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=i55HR6h2fZxDcxNrM4epAaP/EnlD2mWeL8yw+waKqHk=; b=quQafoupNFfTe2fYb1R8BFv2Zzrv/9GwI4VjHfTSw9dG1QEWIJxyo9xQfhV3P4S+Oi f+doCgGjVdCZIh/3vk+nyeeaMWXtFF5nxqHr2VZQB0iDzeYHs1KfbO9G+OMwn+yi6BZA +hbMGASsZuwMi9JGR1fnQt+P4D+BZHRojw6hD0GQYLdGqLciST9oqXCp/g/HTrZ4UZLL cFO7yv5IkUzkfZan3WE65qcRnHAxmFrui+BdTIqnLWM48IKIo/+lircR1Yu0tcVTQOlR CO74K1d//XGbsACwGkC+oVYgq3znmOf423WRUEvF3uo+34E8uXtMZs0rfDH2SDehDUsY 3obA== X-Gm-Message-State: ALKqPweO2z0XgXTH6pQ0yZC5LVvC/xRZ6teOLOOSiT3NQjrER88k/Ef9 QPLjyxmA9Cmm5tFymq/p7/0pB8qrQs8cwwvwFKsIk7e+ X-Received: by 2002:a65:4a46:: with SMTP id a6-v6mr7395089pgu.227.1527199517453; Thu, 24 May 2018 15:05:17 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:26c7:0:0:0:0 with HTTP; Thu, 24 May 2018 15:05:16 -0700 (PDT) In-Reply-To: <20180524162157.GA26662@kroah.com> References: <20180523021656.122455-1-drinkcat@chromium.org> <20180523163936.GE12456@kroah.com> <20180524162157.GA26662@kroah.com> From: Nicolas Boichat Date: Fri, 25 May 2018 06:05:16 +0800 Message-ID: Subject: Re: [PATCH] usb: hub: Per-port setting to use old enumeration scheme To: Greg Kroah-Hartman Cc: Alan Stern , linux-usb@vger.kernel.org, Mathias Nyman , Felipe Balbi , Eugene Korenevsky , Peter Chen , Daniel Drake , Joe Perches , Johan Hovold , Richard Leitner , lkml , Guenter Roeck 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 On Fri, May 25, 2018 at 12:21 AM, Greg Kroah-Hartman wrote: > On Thu, May 24, 2018 at 07:42:00AM +0800, Nicolas Boichat wrote: >> On Thu, May 24, 2018 at 12:39 AM, Greg Kroah-Hartman >> wrote: >> > On Wed, May 23, 2018 at 10:03:55AM -0400, Alan Stern wrote: >> >> On Wed, 23 May 2018, Nicolas Boichat wrote: >> >> >> >> > The "old" enumeration scheme is considerably faster (it takes >> >> > ~294ms instead of ~439ms to get the descriptor). >> >> > >> >> > It is currently only possible to use the old scheme globally >> >> > (/sys/module/usbcore/parameters/old_scheme_first), which is not >> >> > desirable as the new scheme was introduced to increase compatibility >> >> > with more devices. >> >> > >> >> > However, in our case, we care about time-to-active for a specific >> >> > USB device (which we make the firmware for), on a specific port >> >> > (that is pogo-pin based: not a standard USB port). This new >> >> > sysfs option makes it possible to use the old scheme on a single >> >> > port only. >> >> > >> >> > Signed-off-by: Nicolas Boichat >> >> > --- >> >> > >> >> > There are other "quirks" that we could add to reduce further >> >> > enumeration time (e.g. reduce USB debounce time, reduce TRSTRCY >> >> > to 10ms instead of 50ms as used currently), but the logic is quite >> >> > similar, so it'd be good to have this reviewed first. >> >> >> >> I'm not opposed to the idea in principle, although I don't like your >> >> implementation because it breaks the original old_scheme_first >> >> parameter. >> >> I don't think it breaks the original parameter? I mean, >> /sys/module/usbcore/parameters/old_scheme_first is still a global >> default, while bit 0 of /sys/bus/usb/devices/x/y/z/quirks becomes a >> port-specific override. >> >> >> Let's see what some other people think. >> >> >> >> Yours is a rather special case, because you know exactly what device >> >> will be attached to a specific port. Still, I can see that sort of >> >> thing happening in constrained and special-purpose settings. >> >> >> >> How do you arrange to set the new quirk before the device is >> >> discovered? >> > >> > Yeah, this last question is what I had when looking at this. Or does it >> > not matter at first boot and only matters for wake-up? >> >> It does not matter on boot, we have plenty of time to enumerate the >> device. We use USB (auto-)suspend and remote wake, so no >> re-enumeration there either. It only matters on unplug/replug where >> the device needs to be re-enumerated. > > How does this device get unplugged/replugged if it is connected directly > to the device? It is external. Essentially, this is a tablet with a detachable keyboard/touchpad. The interface between tablet and base is USB, over pogo pins. The port is non-standard (pogo, not normal USB), and we fully control the firmware on the base side as well, which allows us to take shortcuts like this: we know exactly what device will be connected on that port. >> Somewhere in an init script, we would do this (we know in advance that >> usb1 port2 is the bus/port where we have our pogo-pin USB interface, >> so we can hard-code the path): >> echo 1 > /sys/bus/usb/devices/usb1/1-0:1.0/usb1-port2/quirks >> >> We could try to add ACPI support (just like connect_type), but we >> don't strictly need it for our application. > > Isn't there an "internal" ACPI flag for USB ports, or is that > what connect_type is? Why wouldn't that work here instead? What we may need here is something like "external but non-standard, so we can ignore compatibility constraints when enumerating"... Thanks,