Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3603271pxk; Mon, 5 Oct 2020 14:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzidpoGVlNh9pNHrMyT79UmLYE8JIzy9Ofx58p9NrdJSNNBS4+O3Z53pj6D2/uMNMuliWfI X-Received: by 2002:a17:906:a848:: with SMTP id dx8mr1692064ejb.552.1601932440519; Mon, 05 Oct 2020 14:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601932440; cv=none; d=google.com; s=arc-20160816; b=ErNLN2LaDJM2TRQqxE6ZPnPCzPASQYtIoxlSuo0aCOxdXZGK4gPUEH2wrjCuDgK366 jhhJYKqpW7uq4tZyaGjFSShgS0TavT1tbGh7uIzi1C2YNWsJokb87hCXzlwnrz8V5NgA WizW6B5t8Y4ge4ohalnRNBcHPR65v11v6/gpH23rodZhkQkgdFsqG/37xwGpsQxT5g/o 4kpCJsqugkbDpl+HXc2F9NP7Sf4WFrRJL/94xI88AvPsKP81Vw7G8hmf5YhjyBMxkbaj HE0gdXX/kJFu5zYN4MTFH7s/wQeshrKKBFKgFmu5qgZNxvlbxqipXbEnAMG+1A86r9Ru UB1w== 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=3GA56NAT+rDqMXV6hlkrQNn+gOyv5hJPGyi8gBGz2Yw=; b=aTJkMMCcvbwqGmkqUZlD05WLRxEsEI92f0xuw8MzBr/hpGTccpUhyGtl3vhDhKRrhs 6I0EmLScV/r5ddZKCjRq9EAB05nS3L+nKNn7u+BmYzKcKR+tO4sHim+JVeOF4047L2XU 47WRaJuDYLTkNUeLihCUZLF31vODXR2OwehKHMbaEasfeUD9hD0Pffy7Ul/2NlLzVJjX 3rRr4/Ygv6CT0N5FI0O3nTU9V7MtTj5o7uTmWHR7GHXJlEaNsJDBrGOUJMgT9sqpUMGl Qc8tpgfrZKlYmbjBpHxoyeqbK5UyJEscXnXFD3gPIpK+x0n6p1zQ1XP83LQ84/lBHJxM uxMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q9MEsXX0; 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 r3si881191edx.238.2020.10.05.14.13.37; Mon, 05 Oct 2020 14:14:00 -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=Q9MEsXX0; 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 S1729282AbgJETSU (ORCPT + 99 others); Mon, 5 Oct 2020 15:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729271AbgJETSO (ORCPT ); Mon, 5 Oct 2020 15:18:14 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF957C0613A7 for ; Mon, 5 Oct 2020 12:18:14 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id t14so6613382pgl.10 for ; Mon, 05 Oct 2020 12:18:14 -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=3GA56NAT+rDqMXV6hlkrQNn+gOyv5hJPGyi8gBGz2Yw=; b=Q9MEsXX0361UUwV7RuVD/f0AKxW7z6wkFZdTRrgWCTYOfgH577knEikRgtzBHQjMjT npieQ9L0cO6YMbO9IpY6eJPPMihiD9dMciZQBeFIUd080itgkBLZ5bijX9xOlUr9LPPC w3wuJAbkk1nAMWytYU9SF4dfcGLrMkvFlZcAA= 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=3GA56NAT+rDqMXV6hlkrQNn+gOyv5hJPGyi8gBGz2Yw=; b=XWQy8ba48BD9V9NfbGGDFOg2wOV6UrahpctOTh/EtBYGkclOUhHVJscvHAWsXg4D5/ 7lBC3HW9wcHAZg5CcA4gmjdX905GwlJ0eg4hWlhxW18iwn6IGX2qke0UaM7Few1x3Zli /hEd0KYFT9PhDqE89176NVaxqv1cZk9htLmw1GPGhKtzN2q45B93sOyUCcTgeiQoNJFc OBmKG+RUCXx27y/Q6xDvPDoqArR1yy97buONuWnXpu0f8eA+usawivFBgDwyfjIM3htp BlXtIZzW6Sb6qudZaxbEEqBsn4Frnt3RdjSu+8mthVRJ4kqdB5d9blL3L+vaKqViDYHB cW1A== X-Gm-Message-State: AOAM53068FZnVq7pCvRxrUvdCkrtnMDhisStxmwuG2dZ36fsyg3rd/7O ZYRvidfv6m9ahEPhcbABo/2aZw== X-Received: by 2002:a63:d50a:: with SMTP id c10mr1007307pgg.26.1601925494272; Mon, 05 Oct 2020 12:18:14 -0700 (PDT) Received: from localhost ([2620:15c:202:1:f693:9fff:fef4:e70a]) by smtp.gmail.com with ESMTPSA id fv13sm334222pjb.50.2020.10.05.12.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Oct 2020 12:18:13 -0700 (PDT) Date: Mon, 5 Oct 2020 12:18:12 -0700 From: Matthias Kaehlcke To: Alan Stern Cc: Rob Herring , 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: <20201005191812.GB4135817@google.com> References: <20200930124915.GA1826870@google.com> <20201002183633.GA296334@rowland.harvard.edu> <20201003124142.GA318272@rowland.harvard.edu> <20201005160655.GA4135817@google.com> <20201005161527.GI376584@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201005161527.GI376584@rowland.harvard.edu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2020 at 12:15:27PM -0400, Alan Stern wrote: > On Mon, Oct 05, 2020 at 09:06:55AM -0700, Matthias Kaehlcke wrote: > > On Sat, Oct 03, 2020 at 08:41:42AM -0400, Alan Stern wrote: > > > The decision to enable the power regulator at system startup would be > > > kernel policy, not a part of the DT description. But there ought to be > > > a standard way of recognizing which resource requirements of this sort > > > should be handled at startup. Then there could be a special module (in > > > the driver model core? -- that doesn't really seem appropriate) which > > > would search through the whole DT database for resources of this kind > > > and enable them. > > > > This might work for some cases that only have a single resource or multiple > > resources but no timing/sequencing requirements. For the more complex cases > > it would probably end up in something similar to the pwrseq series > > (https://lore.kernel.org/patchwork/project/lkml/list/?series=314989&state=%2A&archive=both), > > which was nack-ed by Rafael, Rob also expressed he didn't want to go > > down that road. > > > > It seems to me that initialization of the resources needs to be done by > > the/a driver for the device, which knows about the sequencing requirements. > > Potentially this could be done in a pre-probe function that you brought up > > earlier. > > One of the important points of my suggestion was that the resource init > should be done _outside_ of the device's driver, precisely because the > driver module might not even be loaded until the resources are set up > and the device is discovered. > > 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. 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).