Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1480794pxb; Wed, 10 Feb 2021 09:15:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzefu0lS9UPzpsjw0TXcEsd3/cxIe4vwF6If2z7FRqjzJ/hdklpre0cbrTUNF+ALv3f9AT8 X-Received: by 2002:a17:906:aec6:: with SMTP id me6mr3864156ejb.163.1612977301483; Wed, 10 Feb 2021 09:15:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612977301; cv=none; d=google.com; s=arc-20160816; b=TQnQdtYJH3w7jVy4tgJvFMlDbIQxiuxT9RlpTCArWK8fdF89xxWnV64lB+DHU0Hk8z J41oTUsjsZGoWL3zI3wgcXZC78ukuWRQX/TokziwI5wBJzH2X6WzITPDwxyAnaLI6OZC qHef4yxoUkM/FlQkbHvKhaGgmwRlC3Gq6v+te7U8ylMH9Lw8xc74//81nNn6urlptUAu h2spfGLT/Ehpb07wrnd8ls1MUxKn583QZey/IvSIOez0kun4oYW7YY2Psu4gqQPeSm0/ 3ANoYzTn5FEan4jSo4/CYu4IjxY7NOI3GgzXDVvYicZ85flSwtx931K4VKMkB/LHZSRP EmBQ== 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=/N1dRUXzM9/JUnFq9Pnug/RkqUAq6HP4wYrIBCKV8U8=; b=iAa7KqPgyafXFdEqykB1sfBUR981oaJIyMgy6g0BJpygaSr6ZwhYWDg4vbCePkuj1U DmK+qoRJk1W+ws87hk1/d/23j6U6gjob4tKyP3tHdbS+4cDpW7kuXwBqdFBpRAojTwfA DWgvsUZwra9e+Xlf8SJeVr50F4QVwVxYxYLFBoXT0D2cJBMzrRXtteTwp3I9wQOdMsWl d5Dz+INWvoc7mq+TXvhzRe78fmMPm6M8qVzu818Gx+4DaLTzW/YVwPAA76IOtTMQNJP+ sV2QTkeiu9CDgbiZvZ+EKUCYmxBvxsPRS4qvEGd4rK5C3GmVOAuVR0CPYz52C2zUq2nX inCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d+dSLiyq; 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 m10si1671351edc.111.2021.02.10.09.14.37; Wed, 10 Feb 2021 09:15:01 -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=d+dSLiyq; 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 S232323AbhBJRMx (ORCPT + 99 others); Wed, 10 Feb 2021 12:12:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbhBJRMP (ORCPT ); Wed, 10 Feb 2021 12:12:15 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524ACC061797 for ; Wed, 10 Feb 2021 09:10:56 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id b8so1539633plh.12 for ; Wed, 10 Feb 2021 09:10:56 -0800 (PST) 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=/N1dRUXzM9/JUnFq9Pnug/RkqUAq6HP4wYrIBCKV8U8=; b=d+dSLiyqzCEaPidb2aOKZIvp0lhsfcdHvEI9OxD73mTRni5bYCIvAQtYXgtb1ivtzO sx7oFWVXUwn6DYZHEGe4Ps2/cIj1IciaGkKZt3OLhjCMnCt4PfXf7uh+tzJ0UxvxzOPO D37EBzitIYaYY961sgDmE5k6/+UXes3738IGQ= 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=/N1dRUXzM9/JUnFq9Pnug/RkqUAq6HP4wYrIBCKV8U8=; b=A+pBuwl5cxM1oYjtqF2+oa5L1BQsbBIE5gPwhD4se9pBLUdsoyOzWQ+Zp2THHTRTcV YjnsYgDqOvmnt9kGh0cC/azovu3yExkxsQlkyyoArQhEkaE9/onj9n6iW1cNxnY98UKm EymAN1bjmbfkPJnu/b8M6lMpZswJ7f1gm/g2pimqaKPciYas26iM6fnGxzo+j9VW4W3D f/I2ly3/B5t4Zdzx55SBdKw8YVZVU30vBIGSnbvUAKb/3ZY0NRXjYwjEC6aFP5uth0oE Rq/FF4QAfE00eTUaGZpBjoVpp79q7QUWGVq3blgbW6FtW0cyHudNjeYg8MpN4rZ4tkmk qXoQ== X-Gm-Message-State: AOAM533aI62m+6CcdXI/NEPtAGuFiAHUo+JyjVmf+NMmZUNZCezQi22S MatU5qDasxG+pJWuslVhUgwaJA== X-Received: by 2002:a17:903:22c2:b029:dd:f952:e341 with SMTP id y2-20020a17090322c2b02900ddf952e341mr3845981plg.67.1612977055912; Wed, 10 Feb 2021 09:10:55 -0800 (PST) Received: from localhost ([2620:15c:202:1:d8e6:826a:fc50:2158]) by smtp.gmail.com with UTF8SMTPSA id l25sm2787647pff.105.2021.02.10.09.10.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Feb 2021 09:10:55 -0800 (PST) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Rob Herring , Frank Rowand Cc: 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, Krzysztof Kozlowski , Matthias Kaehlcke , Mathias Nyman Subject: [PATCH v5 3/4] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Wed, 10 Feb 2021 09:10:38 -0800 Message-Id: <20210210091015.v5.3.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog In-Reply-To: <20210210171040.684659-1-mka@chromium.org> References: <20210210171040.684659-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 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)) { + 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; @@ -402,6 +415,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.30.0.478.g8a0d178c01-goog