From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3651C433E0 for ; Wed, 10 Feb 2021 22:21:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A58764E02 for ; Wed, 10 Feb 2021 22:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232097AbhBJWVC (ORCPT ); Wed, 10 Feb 2021 17:21:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbhBJWVB (ORCPT ); Wed, 10 Feb 2021 17:21:01 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D9BC061574 for ; Wed, 10 Feb 2021 14:20:21 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id z6so2247286pfq.0 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=GbpVrdjbvEVmoj/DFpKf/VVMkQV/S8wBKQ5sqWYQ8wuDYCPt4SyPyxtNJb8Zl7Qj+u eAc89QXjvRCnfNX+gnJtPzq1c3oXygJR930GW/njY/kCU2/RiJ+Ae6upgzqW4V0dCvFd 3fYI4mVUSSibgJmgk7B6SIPcPNCSHG2266y/tlfpDN6DknHe6rEaACuKKJiggH7be+Fm +WapsnYSx867pOh5v1CHEu0IxRZg2P/lLvyQjUjY7jWL2CP0padH1+ABNc898lao9qLL YwJG7F0afKUFc8QmpCGtNTUTlkr5jimihN2/T0nkknb/iW6kMQBoitec4uP0k5u3/6f1 g7Gw== X-Gm-Message-State: AOAM531fmms2vYSK4uCAp1FfUZWc5rVqd8wg5BdosZx6Aadova6ISJX6 0nnAKubrl9bbMRPJAc3PUW4hSg== X-Google-Smtp-Source: ABdhPJwxIyrwCZVepYfSfD+e4R52iXFCJYsOnislND8kiKov6V5bb2es7O8gG7efrH8gABeV3cGHXQ== 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: devicetree@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