Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp67129pxk; Mon, 5 Oct 2020 18:02:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpBjPWfbp35mzIucY7XUCCCxsaoOk9xnn0iQrlZcrnOPClq2IEAktjZLuJpSqc7M1skS0u X-Received: by 2002:a17:906:8297:: with SMTP id h23mr2422316ejx.383.1601946136862; Mon, 05 Oct 2020 18:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601946136; cv=none; d=google.com; s=arc-20160816; b=qJ6SySlXU/1LNxNJJb+hRTHqjas/T7nZusvGpG1AiT+Ocaot7xSnly9LK/TpEcOCNw l8Ui0mU5ugC0Mf3Fdu68zXjFvvaRTvYBx8tOU5cJI438TIVEPs1mqjPwW6rlxBs5B9/h o5N1fvo+BOqX+wlgBtouWU/FwlcOwveKASBCOgGrvOtBUAe12rHPjQ4YMn1Gj8t3adOe pFSPrDqp0BuYCXVehpJWrQ85E8ei5Mm/teO53qnjKgL9JAWGSc5fey/K2iA+HckeNDVA n3mi/kSsKBR0gSppCTcvcBNiWvCNrfpxddX4nsaEx20Pjuo6R6+xOpoea/bmas97TWRG OpkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LDiL+GXcnPC606XYr7MZfMGhMR75HAM4qMR2Sb0HfTA=; b=r/EIehrHgDfkEGB0bQwGWp5f+HcwjMvvBnBCn475BmQWERDkaRCA3Pw30MFO7HCL1o KIdqrDz5R3ptN7Cb7H+lHBkGP7Ld+vXRccJPscrX7/qyQ0VP6mrLtky76RuxgWxYu3YW IFx1BZ1vlv4Ob9yVCJVG7WIU2QciJqyRIrN6YipxKC/wKw+F59RAzJg80jG9NqnEwKSB i0wBjRzcuMNOrwKQKgn6IzWrA0IZ4GtTd5HA8eMH4A5IuEbqZZCbIRud2kh9ffKbqzdn 4a7Y/aHiXf3+YpqIhzkvFOdrqQj6FqpVfqAQtNKTPik9V7pHsIw+cXaReqOs+nfXBccZ iq7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=S3+AkSBW; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id se8si959124ejb.251.2020.10.05.18.01.54; Mon, 05 Oct 2020 18:02:16 -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=@chromium.org header.s=google header.b=S3+AkSBW; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727038AbgJEX3Y (ORCPT + 99 others); Mon, 5 Oct 2020 19:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbgJEX3X (ORCPT ); Mon, 5 Oct 2020 19:29:23 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA819C0613A7 for ; Mon, 5 Oct 2020 16:29:23 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id 7so6912092pgm.11 for ; Mon, 05 Oct 2020 16:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LDiL+GXcnPC606XYr7MZfMGhMR75HAM4qMR2Sb0HfTA=; b=S3+AkSBWwtsQFNLy3uqVSP4lipkdUBVRg1fZvuI5ASskDWc2bz8zQcXURV/gyyVd2i vCCJ0EkMb4ZYUbTCpoPqKRx371Np+eC+HrxiMq7wW4K1kmXE0czvamT2Y1iSPvlqtZgk 79ARQ2WII4davW3ztGI790WmwW24Xb6hWeYug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LDiL+GXcnPC606XYr7MZfMGhMR75HAM4qMR2Sb0HfTA=; b=rleX/YexhYrBbHJEmE3P40I0g151GReDjUMYwkjP4IhtC6dXFgN6QU8yMwIugccAgt DzKKt6jEpvIqWYjJyoTOOKk0WQff0+4N7LaEiZ7Gw7/8wP5AR+igvFYczL7a9S0bQBbt +xNKluiJ8V06aK5JNT0A3RjBTazA6vxhfr4woAweQZBB1P7dRfzMwqbA+xjiCd4+Z8Ps mZ1RArvDB/McQvP9czwQUtFuJutaGOdpZLTIjvqXw+rS9dIlLGGLJDMmUmHdkBSjSpVu PjhdM6rIHhaceMdrFkdPm8E17W4RVTm8OrsKD0v4zscmjRIqRQB12DKS2qPr9yoHpE3v 7dVg== X-Gm-Message-State: AOAM532oz8DWaMDvwO0Z6xE1/GG7FmMTfUW1hKkqPQlioP8GA4J25nZB rKBTykng8iNItmGScykmvnIJpA== X-Received: by 2002:aa7:9823:0:b029:150:a96f:c8b7 with SMTP id q3-20020aa798230000b0290150a96fc8b7mr1883651pfl.34.1601940563110; Mon, 05 Oct 2020 16:29:23 -0700 (PDT) Received: from localhost ([2620:15c:202:1:f693:9fff:fef4:e70a]) by smtp.gmail.com with ESMTPSA id y16sm1105109pfb.154.2020.10.05.16.29.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Oct 2020 16:29:22 -0700 (PDT) Date: Mon, 5 Oct 2020 16:29:21 -0700 From: Matthias Kaehlcke To: Rob Herring Cc: Alan Stern , Doug Anderson , Greg Kroah-Hartman , Frank Rowand , "linux-kernel@vger.kernel.org" , Linux USB List , Bastien Nocera , Stephen Boyd , Ravi Chandra Sadineni , Krzysztof Kozlowski , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Peter Chen Subject: Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete onboard USB hubs Message-ID: <20201005232921.GC4135817@google.com> References: <20201002183633.GA296334@rowland.harvard.edu> <20201003124142.GA318272@rowland.harvard.edu> <20201005160655.GA4135817@google.com> <20201005161527.GI376584@rowland.harvard.edu> <20201005191812.GB4135817@google.com> <20201005193611.GA389867@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 02:59:04PM -0500, Rob Herring wrote: > On Mon, Oct 5, 2020 at 2:36 PM Alan Stern wrote: > > > > On Mon, Oct 05, 2020 at 12:18:12PM -0700, Matthias Kaehlcke wrote: > > > On Mon, Oct 05, 2020 at 12:15:27PM -0400, Alan Stern wrote: > > > > The conclusion is that we need to have code that is aware of some > > > > detailed needs of a specific device but is not part of the device's > > > > driver. I'm not sure what the best way to implement this would be. > > > > > > Wouldn't it be possible to load the module when the DT specifies that > > > the device exists? For USB the kernel would need the VID/PID to identify > > > the module, these could be extracted from the compatible string. > > > > Loading a driver module whenever DT says a device exists? Not a bad > > idea. I don't know what would be involved, but no doubt it is possible. > > MODULE_DEVICE_TABLE mostly as I mentioned in my other reply. > > > Note that, except for a few special cases, the kernel identifies the > > appropriate driver for USB hubs not by the VID/PID but instead by the > > device class or interface class. I suppose the compatible string could > > include that information too? > > We can go back to 1998 OpenFirmware and it's already there[1]. > 'usb,class9' for a hub. There's a few other variations defined. That should work if the initialization is simple enough that the info in the device tree is sufficient (e.g. switching a single regulator on), otherwise a device specific compatible string would be needed. > > > Having the initialization code outside of the driver could lead to code > > > duplication, since the driver might want to power the device down in > > > certain situations (e.g. system suspend). > > > > True. On the other hand, how common do you think it would be for > > drivers not to want to mess with the power settings? > > I think in that case you'd generally want firmware to enable things > and the kernel then does no power control. > > We have ~1500 boards using DT and maybe ~10 with USB devices described > in DT. So the whole thing is not common to begin with. It's probably not very common, but might be more common than the DT suggests. Many devices probably don't specify their hub(s) or other USB devices explicitly when the initialization is done in firmware. In case a generic solution for all types of devices and busses is not required we would still need a driver to address at least the conditional power down of a hub during system suspend. Doug summarized the state of the discussion about the bindings for hubs (https://lore.kernel.org/patchwork/patch/1313000/#1511757) maybe we should continue from there?