Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1687692pxb; Wed, 10 Feb 2021 14:22:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/D/9q80w1Xf6geS2PRnyZeyEQrWURrj9xRdmvqINIFyHQlB2gd5fE7raA8xlJw+5Tv4cR X-Received: by 2002:a05:6402:3553:: with SMTP id f19mr5363235edd.271.1612995738684; Wed, 10 Feb 2021 14:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995738; cv=none; d=google.com; s=arc-20160816; b=HOSHAGzD+ofsFWn11hSCGotFkV7sodGyCkG+/DuG3Lyv/fnC4WEr6vAYsFxKYn6C0A 5X09Xl7kvFwu9J4D1gfaXGA/BA6lsjwt3KwFQCAL/UwHlPgrj9upn9+yF5Ss3Rip9HQo e+9WhxYpl8FMAMzv1MXKqtTV/dtQX6kWfi3Yv+VMKZnJVA1YfAJTP0K8fpbz84XcRFOP nnaHWAUMoLaDmHOBQZ/Pmenx2TAAKeRRMZUBgORra+vZw+//gFBr9bhHpE+lIifzjs2x lmIb5FM32S3v3d1x7951uh4jn0HeeO03w9O1R56sknf6NRZe8gUylzbCPv8jDiw0KezY BL4A== 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=Z0iXqoizGv91iyESBFZbI0I06iIFsCEP1OVkjYLnlPA=; b=YK1VWtTsX3kLXRVhxCxXthEr/IwGSY4eG+/3QQsfS9wgX3qPj4VjTDlYtXjTLpqJs9 cORMeoOF3baYM5/Q4cfjdSW6DKpSia1DAMCE5iHVcpP0N0O4Z2T/ijPXMq6QKyKAoqqu ALCFNln5/BsZANSufk1y1Vfes3utV1JuJ4VVoNOaGiW3K34z1RQKDSrAf8j9MWSpsDDM z+Hvi/6yasGSUP+Z0URTgN14b/1xmj1/oLaiwvkXVQtJ86LpWsvqRJjdAzCur0APSone BEtPOuj190KwGpqCm7274WzlPIIZNKUeTMVGko9XiHh6trMnVDEIlFDfIMfd8J3Vuvs4 NkTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Miw6iK6/"; 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 y13si2504401edm.557.2021.02.10.14.21.53; Wed, 10 Feb 2021 14:22:18 -0800 (PST) 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="Miw6iK6/"; 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 S231193AbhBJWVD (ORCPT + 99 others); Wed, 10 Feb 2021 17:21:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232045AbhBJWVB (ORCPT ); Wed, 10 Feb 2021 17:21:01 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C13C061756 for ; Wed, 10 Feb 2021 14:20:21 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id 18so2236727pfz.3 for ; Wed, 10 Feb 2021 14:20:21 -0800 (PST) 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=Z0iXqoizGv91iyESBFZbI0I06iIFsCEP1OVkjYLnlPA=; b=Miw6iK6/OvFwa7tHc1eUpNg6VrNTbW9r3+7lFtnixy33N4q94B2iBjswjV3wBykU+9 ALEKv76fL34vruF33g+D41IBv44wlvAt10T8XyC5qGgJs8raPOoYzpHkzWAbN+6O1wb1 TdWa81hT2enNnkZBd/NAxbY2WoMWr4M5R7if0= 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=Z0iXqoizGv91iyESBFZbI0I06iIFsCEP1OVkjYLnlPA=; b=fzAO+hG0S/Z3t4zukn7yoksMECIPT+R3yqtcu6et9QY8Vt3tDbz7OuufFiM838JCM/ CvDD00j+1ctSej8SMOslZqIoi6nQbUF+SPbdZeVK4iI2Y+8i/pwHp4cknQHtTbNSQHYL 9gIARot45eleoKeZ031suI+a+dF+s2eiZVo2mad4ZRPjzGY7pNAXwDSCEt4AVUexr481 7eldfWC44iUgnWghQBuJwKIaSoj7OjPnw6Q7hEswSXWaPkMmOVfRQ8gEG+Yx/UmN76xG YOPGUUXH4r6+/BxIetC1eVetHZ6WjSkadJL38vZnQE7dp0YjktRsLzUlxYGGV0ZMsBWy x8Mg== X-Gm-Message-State: AOAM5330y8AcIe7P1PRBPNXO5zrjEWq2GB7aXSDIlrMMiSIKLax74buX YHOGAHgLAT9Y5WmbHtcfLxjQuA== X-Received: by 2002:a63:ec0e:: with SMTP id j14mr5132698pgh.62.1612995621142; Wed, 10 Feb 2021 14:20:21 -0800 (PST) Received: from localhost ([2620:15c:202:1:d8e6:826a:fc50:2158]) by smtp.gmail.com with UTF8SMTPSA id q15sm2804340pfk.181.2021.02.10.14.20.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Feb 2021 14:20:20 -0800 (PST) Date: Wed, 10 Feb 2021 14:20:18 -0800 From: Matthias Kaehlcke To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Peter Chen , Stephen Boyd , Alan Stern , Ravi Chandra Sadineni , Bastien Nocera , linux-kernel@vger.kernel.org, Douglas Anderson , linux-usb@vger.kernel.org, Mathias Nyman Subject: Re: [PATCH v5 3/4] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Message-ID: References: <20210210171040.684659-1-mka@chromium.org> <20210210091015.v5.3.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> <20210210210645.xapaua7djdsvr3ca@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210210210645.xapaua7djdsvr3ca@kozik-lap> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Krzysztof, On Wed, Feb 10, 2021 at 10:06:45PM +0100, Krzysztof Kozlowski wrote: > On Wed, Feb 10, 2021 at 09:10:38AM -0800, Matthias Kaehlcke wrote: > > Check during probe() if a hub supported by the onboard_usb_hub > > driver is connected to the controller. If such a hub is found > > create the corresponding platform device. This requires the > > device tree to have a node for the hub with its vendor and > > product id (which is not common for USB devices). Further the > > platform device is only created when CONFIG_USB_ONBOARD_HUB=y/m. > > > > Signed-off-by: Matthias Kaehlcke > > --- > > > > Changes in v5: > > - patch added to the series > > > > drivers/usb/host/xhci-plat.c | 16 ++++++++++++++++ > > include/linux/usb/hcd.h | 2 ++ > > 2 files changed, 18 insertions(+) > > > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > > index 4d34f6005381..e785fa109eea 100644 > > --- a/drivers/usb/host/xhci-plat.c > > +++ b/drivers/usb/host/xhci-plat.c > > @@ -15,6 +15,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -184,6 +185,7 @@ static int xhci_plat_probe(struct platform_device *pdev) > > int ret; > > int irq; > > struct xhci_plat_priv *priv = NULL; > > + struct device_node *np; > > > > > > if (usb_disabled()) > > @@ -356,6 +358,17 @@ static int xhci_plat_probe(struct platform_device *pdev) > > */ > > pm_runtime_forbid(&pdev->dev); > > > > + np = usb_of_get_device_node(hcd->self.root_hub, hcd->self.busnum); > > + if (np && of_is_onboard_usb_hub(np)) { > > This looks hackish... what if later we have something else than hub? > Another if()? > > What if hub could be connected to something else than XHCI controller? In earlier versions this was standalone driver, which was more flexible and didn't require cooperation from the XHCI driver: https://lore.kernel.org/patchwork/patch/1313001/ Rob Herring raised objections about the DT bindings, since the USB hub would be represented twice in the DT, once in the USB hierachry (with an explicit node or implicitly) plus a node for the platform device for the new driver: https://lore.kernel.org/patchwork/patch/1305395/ https://lore.kernel.org/patchwork/patch/1313000/ Alan Stern suggested to create the platform device in the XHCI platform driver: https://lore.kernel.org/patchwork/patch/1313000/#1510227 I wasn't super happy about involving xhci-plat, but at least the code is minimal and all the device specific stuff is handled by the onboard_usb_hub driver. If you have better suggestions that might satisfy all parties please let us know :) Matthias