Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3562352pxk; Mon, 5 Oct 2020 13:00:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyWMmCuNrBLEo3rZqBvOqhANoYbs8Q/YsIsCVNp2+8ErU1jzLzr76Fi5gZ1nUaKhq2VZb1 X-Received: by 2002:a17:906:e2d1:: with SMTP id gr17mr1437432ejb.433.1601928055955; Mon, 05 Oct 2020 13:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601928055; cv=none; d=google.com; s=arc-20160816; b=l71C6sp7GFiC4KjMpq/rv+rX4ir6Nrkz4a724kia2tvoL4GbP9c+odnRgu7IoJ+7IK rS9kMwpoRgOuBcjpTOThcHaHj3c336he1B82oeRcOKzAlT83huQsqz2vVGEUpXgjUOUe itiB8DT69dkzqO8iwUfBWy5G3aSWzZr7/gCFfpId1Epas4pN1NIy0IkGD6DTfgW8jaSI kbpsnC/EiJiRyptaGL0bdMR+wR5/oaP08e+CCVHIiKcG+568bX86J2rNakaVEMnTvj+N cZSVelrfvuUURIBeQP7KLkseSVLsA/HMHT6qnjLDh3hTYbf4Pv21w0v4pzG8O2BLhNXo BYLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WjQMKm2fvjfaIFEuXlj6/FboMCgSOe3WSKTL5MZrgic=; b=ApWj6bYPN99M+RoQ+1E9axMzH4tVgChL2QUlqMmNxsfdwFAkYupbA2yAd9Kem/ZS80 UDLLcKN8hTdvBoQuyCA4JeSZTQYfyF10tFNRGl9uKwfXq1J8wcYWxVVHOAbHxQWIlRFU 5vbJigxfq+IOeSM3WCQsxhSSw3s5qlGlzEh5NHtYZhkpH7JfQYNFbUxnmNO3aMUJzwkK 2A9lcKvoFQ0/tlwiQpxoU15yxECqF/A9RJ99TneA5nBtW9mYumlt3+DuxjvG2kJgQuXk msAbNjvXPHK52gF1X/yX8wEI/ezat9eAm7SzBRYeVA8uGLzamUfqZE3L53ygR4d10xqC GHQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NyeL888x; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss23si422569ejb.654.2020.10.05.13.00.32; Mon, 05 Oct 2020 13:00:55 -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=@kernel.org header.s=default header.b=NyeL888x; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729515AbgJET7S (ORCPT + 99 others); Mon, 5 Oct 2020 15:59:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:56946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729424AbgJET7R (ORCPT ); Mon, 5 Oct 2020 15:59:17 -0400 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 92FED2100A; Mon, 5 Oct 2020 19:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601927956; bh=lZLALtjavDkXurE9Is+8RTaRVsXxwohHJkUhoRrYMA8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NyeL888xOvfoVXZGiW1dPmrcZ9gswWQQqe+nc6Ex5K0Ie0kJXh7C32oTCfqyX1jLj gDVpFxS5geiuCdw89ui6zzL1ud1xBE2Etcw44DYvPOonUEY/wUGW18XykhmcUlcGvI QzHbNQMA+kHhTw1nen3JBk7XDTQLuSvDkQ80xYi4= Received: by mail-oi1-f169.google.com with SMTP id c13so9977640oiy.6; Mon, 05 Oct 2020 12:59:16 -0700 (PDT) X-Gm-Message-State: AOAM532P4DLmnUmg0MTCoe53dMKqrbVomTtC0ucHHynrD9ppiMS46hgx pZ1YaU9GqiE9PS3ABME9fhhg/nf0WlgLigsZYw== X-Received: by 2002:a54:4f89:: with SMTP id g9mr653207oiy.106.1601927955868; Mon, 05 Oct 2020 12:59:15 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20201005193611.GA389867@rowland.harvard.edu> From: Rob Herring Date: Mon, 5 Oct 2020 14:59:04 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete onboard USB hubs To: Alan Stern Cc: Matthias Kaehlcke , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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. Rob [1] https://www.devicetree.org/open-firmware/bindings/usb/usb-1_0.ps