Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp769534pxy; Wed, 28 Apr 2021 13:55:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE+W6Q0L68asuFKj6jsj/nRydpKBp8toKMMFbRTEUecKNEo3PpJv81vQicOjM67vnuKld3 X-Received: by 2002:a17:906:5056:: with SMTP id e22mr31219197ejk.289.1619643331955; Wed, 28 Apr 2021 13:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619643331; cv=none; d=google.com; s=arc-20160816; b=sgbyXfD0INwX37lJ/iPFWyPsQZFZYFe+ttYFu56ZsUuZHUl6DcMuDtiHQhOAEtY4Vv jMgW/0hlvF518DqsW5RoDBhzxhWTxKu9y77Ls9FDsflVOI4LBAGyfqXLSl5nsGsTxcf4 HkvRqosz27+s7IzWMmn6GHIPJKUiYfn7wZcwobOKrhtOkv7blxDmknhyf6auZRRGRbnd 01M3x5LAgWvNg+D8dALat3ZkoCQGtQSJsPlbI0HMYF+vXo1iCSM4zP6zEyb6BRs9ZYzG lKoDIzbsmt3CMeiaJb1flgquS/SuP2Uw7vvPClG/ZvmnZaiOZ/t8r4RTXGAiajo5YYl3 tT8A== 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=JewEs2tV5gzRVg7T4CN2dfrhNEHaBUNm6fh+qnkrak4=; b=aRU8A3xbOE5AMpSQtSS0/l+3Jtn1b1lTKmTHljdCCaa3xEep8G7vHy487JFYoz/QVF kGRUon27ylZhStJS/La3SzL40Kio348jDMM6VdidhHza2Ba1313XHhhOnfzwdTVWdM/L Caf5C8NS293wYmfouB6gH2JWvcjZLdLdJdg3E5dVFgjEMNnGyIDhN+HZ1tzObUYdpEfi dmWig8pcd42FaA/z82jPSI+M6uBZ7+lJ/1eCKdJNf/Oxkuzm7XCZY44s0hFCAyOjzaAa DWV5Rh371+ueR67VWQK8B0OjKjVtDNqkU3cAP36eP4TffozdxPo9zIs+zUlmonl6gboc MDyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XCl0s7Eq; 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 hp6si1136096ejc.89.2021.04.28.13.55.07; Wed, 28 Apr 2021 13:55:31 -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=XCl0s7Eq; 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 S243709AbhD1Smg (ORCPT + 99 others); Wed, 28 Apr 2021 14:42:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243708AbhD1Sm3 (ORCPT ); Wed, 28 Apr 2021 14:42:29 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27AFBC061573 for ; Wed, 28 Apr 2021 11:41:44 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id b14-20020a17090a6e0eb0290155c7f6a356so2485584pjk.0 for ; Wed, 28 Apr 2021 11:41:44 -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=JewEs2tV5gzRVg7T4CN2dfrhNEHaBUNm6fh+qnkrak4=; b=XCl0s7Eqigekg60CNXBBoKtGPRYwWSy6HJzODNJee1xEPVC1XnIBB5ARNdvOdYoYqn NJgMLh/5XESFikD7bEqRSvvWAdJRmG+Py8yqRlx0wgBDOtQfMDKaoZJswD8OHVkARuSF nTgUriQ4A223f9Dh8YwCzC+Ccxbd4ItQJx784= 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=JewEs2tV5gzRVg7T4CN2dfrhNEHaBUNm6fh+qnkrak4=; b=WmIXe5rEubW2bcasXbUbby/oFXLec8S4i87huqp1FacKEUVJoal1B8Mtu6CZhw2hUN Q/eXBMpcsb3/7sm0s3lvm807K9avvuc0wFhqEAkgEGvqHFkgCvX8fgzWgzXryEgfvVVQ nx6J53zA+4yCc36Lz3CzeWeL3kRPhwWo8nhVui9XLNAPLiuIq8xKaT2Ug5My9eBFp2wK wdrMHwrc0h3tPFdYlevejXZNjmqUjDDMcS1NiPFpIQ6vU6r0iCP5TqVXHL6gOJ41HxtZ qtjdrAQM6XKAB297jTVFnl8NdBM3knAqyIlpf/Aqiucq0deqBHn1Wv29cCGYq13LhAXi 8iZg== X-Gm-Message-State: AOAM531wSc8lQ/m1pcURuhAXNDPx9CD6zf32hS1Iu0ZLQhL+PHTzeImx l5PfDTzkVCpz0T+ElFCeWGZy/A== X-Received: by 2002:a17:90a:e649:: with SMTP id ep9mr3605487pjb.8.1619635303695; Wed, 28 Apr 2021 11:41:43 -0700 (PDT) Received: from localhost ([2620:15c:202:201:4c1a:a0a7:2b43:81b0]) by smtp.gmail.com with UTF8SMTPSA id c13sm374859pgw.42.2021.04.28.11.41.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Apr 2021 11:41:43 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand Cc: linux-kernel@vger.kernel.org, Ravi Chandra Sadineni , Michal Simek , Bastien Nocera , linux-usb@vger.kernel.org, Douglas Anderson , Krzysztof Kozlowski , Stephen Boyd , devicetree@vger.kernel.org, Peter Chen , Matthias Kaehlcke , Mathias Nyman Subject: [PATCH v8 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Wed, 28 Apr 2021 11:41:31 -0700 Message-Id: <20210428114109.v8.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210428184132.2184997-1-mka@chromium.org> References: <20210428184132.2184997-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 v8: - none 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.1.498.g6c1eba8ee3d-goog