Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3875183pxf; Tue, 6 Apr 2021 02:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz70G8mKUl4gBuG9GJXVnTlYG1Jww5lGUkhFmaLRVz9T9embU5SFhnHZLxmVBCEAtY6NLJB X-Received: by 2002:a92:cda4:: with SMTP id g4mr23854203ild.208.1617701116947; Tue, 06 Apr 2021 02:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617701116; cv=none; d=google.com; s=arc-20160816; b=s0tonIigIREZPRSlIDvYli/aJrls2K+8xK42L0lopw1IExYBZMqoZuQoEsRDgNOeVh 2nTjgM3gP5WgrT7EA74T/p1CEw0CFol6g0m6KYRg9fF3mCNW1kbXvGbLbi7v3av7pkX+ MfI8ZgXStYBtswAl+kotbTJZNgj+AFGz3IEUiSRICNt77N8bPZK+TA8LUzfDOX+je4Mm wxEi9X2JM6b8h3YtbQGqwJRFXoUVtUDnOoEnBQlR1oEKcQR7u6W8WN2jTXQmakdt9GaA 6KxWJOdUDAVz2rlvmnnE1NXmcCVeC1uYuyF7Jh/m3h2DtaRmYtfc9yERwK2mTUqYTmuk MVCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=phmSYqCi7mknHFm/KEUrvvrrvKp87F1PLLd2ohbWer0=; b=aBduR4HYq3MXtgOPFvFl8boJt8mD0UffXuJEbW0/sWLHChvbM2VB8TQlDpcm+GbshG WsDkmgMJAWmsLEy+7h9qCPub/9BFYULPM6zt0dJ7oBVlRTBPrd0PtSHYB7hYEC7SXlq1 IKRBgMCcxM/UD9MnjHFoDtI7w82Ir76eqqwdZ3G1JGjEsNaiNoFKAmkkMBKaE2Sp93FV bUN3efrp1/Gp295Sxslbos5clv27VKIlB6QyaZKWIh1n/0zeUoUjWcnIiC1C1VdrDnGA gkDQ7nBWvtwOOZBFeIFOdA1OHQumuPAj0yoEqXd6qd9HJMZmHvdagPXJ4g/QJZV0/wv9 Rijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Bxew4BZa; 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 p12si5746195ios.6.2021.04.06.02.25.04; Tue, 06 Apr 2021 02:25: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=Bxew4BZa; 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 S240877AbhDEUSt (ORCPT + 99 others); Mon, 5 Apr 2021 16:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240766AbhDEUSg (ORCPT ); Mon, 5 Apr 2021 16:18:36 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A71FBC0617A9 for ; Mon, 5 Apr 2021 13:18:27 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id i190so607959pfc.12 for ; Mon, 05 Apr 2021 13:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=phmSYqCi7mknHFm/KEUrvvrrvKp87F1PLLd2ohbWer0=; b=Bxew4BZaVIb/CcsXTp3cHQMwuxLv24nehxixcLowRwatyS6BltOCsORKpKFH+CiA3I QOxQ/TLddPQ4SK07LmBHRLXCbtiCrOr0VeDLNcw+bozvTh5jBr+pjf/o1HgTPmPftuxm XFyXvVmvuHKiCL1i+/4e9sSA5pvER1jWuvSJU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=phmSYqCi7mknHFm/KEUrvvrrvKp87F1PLLd2ohbWer0=; b=mfMpzVPEMrEeiNoDzBmqZHztAKRxKE4fCp6Rb4WnBo2ei/7XLEGFlC8LMhJ0WONALN bpQJUt8jLQii8ppArelmpNYjURld3SYdXvxTzPk9zCWJMiDhyHFgFdUpADeXWmddwi4Z DXoML7Jz9ZcS2ETYWUJVzkBBTssSMNQWmnuKHdWkK+XcFC4eDHkanMDImLzFqIDpTXjF Y3nQEOTfe/J3fl7ZjLSpzWlCPCTj75Y5f92csAtZXr6k2NfIgcIUHOkD0QdFPeOYEz8H +h3n0LkrxBbja9qYYpXzM32+okXYVkFQFPuxVghx2rZAF7Iz3VF6kTc99YYhCQa5wN3N 0YCQ== X-Gm-Message-State: AOAM530rZs1L0Qwd9EhjwZHkrq2IxWbQkU8inhCbGFG0UaIC6gTMtD75 BVNm3aEgBTARTHnTq+IH+Oykqw== X-Received: by 2002:a63:cc:: with SMTP id 195mr24247056pga.282.1617653907297; Mon, 05 Apr 2021 13:18:27 -0700 (PDT) Received: from localhost ([2620:15c:202:201:455e:b8cf:5939:67da]) by smtp.gmail.com with UTF8SMTPSA id x1sm256458pje.40.2021.04.05.13.18.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Apr 2021 13:18:26 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Douglas Anderson , Peter Chen , Michal Simek , linux-usb@vger.kernel.org, Ravi Chandra Sadineni , Bastien Nocera , devicetree@vger.kernel.org, Stephen Boyd , Matthias Kaehlcke , Mathias Nyman Subject: [PATCH v6 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Mon, 5 Apr 2021 13:18:16 -0700 Message-Id: <20210405124900.v6.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog In-Reply-To: <20210405201817.3977893-1-mka@chromium.org> References: <20210405201817.3977893-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v7: - none Changes in v6: - none 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 c1edcc9b13ce..9c0fb7e8df1f 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 @@ -195,6 +196,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()) @@ -374,6 +376,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)) { + struct platform_device *pdev; + + pdev = of_platform_device_create(np, NULL, NULL); + if (pdev) + hcd->onboard_hub_dev = &pdev->dev; + else + xhci_warn(xhci, "failed to create onboard hub platform device\n"); + } + return 0; @@ -420,6 +433,9 @@ static int xhci_plat_remove(struct platform_device *dev) usb_remove_hcd(hcd); usb_put_hcd(shared_hcd); + if (hcd->onboard_hub_dev) + of_platform_device_destroy(hcd->onboard_hub_dev, NULL); + clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); usb_put_hcd(hcd); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 96281cd50ff6..d02a508e19b0 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -225,6 +225,8 @@ struct usb_hcd { * (ohci 32, uhci 1024, ehci 256/512/1024). */ + struct device *onboard_hub_dev; + /* The HC driver's private data is stored at the end of * this structure. */ -- 2.31.0.208.g409f899ff0-goog