From patchwork Fri Jun 4 21:41:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 454491 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=-19.1 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, USER_AGENT_GIT 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 D1197C4743E for ; Fri, 4 Jun 2021 21:41:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBC4F613EC for ; Fri, 4 Jun 2021 21:41:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231626AbhFDVnK (ORCPT ); Fri, 4 Jun 2021 17:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbhFDVnE (ORCPT ); Fri, 4 Jun 2021 17:43:04 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 690D4C0617A6 for ; Fri, 4 Jun 2021 14:41:17 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 6so8888968pgk.5 for ; Fri, 04 Jun 2021 14:41:17 -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=cb8MKJzTDoaj8WiPaa35LEcoEg4Drs9vV0lgWkDtDAo=; b=QVZ4rAfi8C5Ki+5xWVj1CwGynxccuyQcHJneYbyKvKxu1OI93FK+6Kg+/DR/7gbjDA zh59GaAysCTFJ51ScCtozx8PQ4ViIb7IwRYl7rOqIYkHa+2G9m5U19TpTHLBACrLUtRD p4630iYKmKM/m4L9LxKEKFreT43h6HKoN4zJM= 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=cb8MKJzTDoaj8WiPaa35LEcoEg4Drs9vV0lgWkDtDAo=; b=CkHIQeaYUGUE7VhGR5BNGwTUKIOuiusFsPvq6ogLcpwX3hnupJsPTekgTaWBogGUVv NYIhTnXidp0H8UqbcNzXaw59TrdRM36ZpmzcOH+RIlNL/9xIV36ep1l27POCY+/ad33O y3qPZ2rd+ydnaYCYIs34LnJCXY8CnHauVOaPinwkD5E9+smEmcZfh9lBNL/lVo0mjMEa wZ/m0nvKUXepxma4pyT+7T09T0+XmOfqDXRXo3mtwFOQMHvQMzTwTt4HM7V9rXVIkwxN dKfmpYdfa8B89dc5JhvI4McWtOZCpmGETAX85JVOLq2B8s6/11xx6akDSrWCp3nO0OK7 5IFA== X-Gm-Message-State: AOAM530aNcO6UXfTq+2WxgWerut3jYngpMeWqMoh9ZTMiTZqjqYG6erm T1+lBTuyoJuHXhzHhTO1/4PhBw== X-Google-Smtp-Source: ABdhPJxO45TRA3vR8JSzcoH+gsoFwveRpeyt/ffdpKxCxP9fKAm1XpW7U5WeidBdo3AQBixHz3EItw== X-Received: by 2002:a65:5a47:: with SMTP id z7mr6970405pgs.400.1622842876818; Fri, 04 Jun 2021 14:41:16 -0700 (PDT) Received: from localhost ([2620:15c:202:201:1cfa:4a0b:c513:8c09]) by smtp.gmail.com with UTF8SMTPSA id w125sm2432309pfw.214.2021.06.04.14.41.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jun 2021 14:41:16 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman Cc: Michal Simek , Ravi Chandra Sadineni , linux-usb@vger.kernel.org, Bastien Nocera , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , devicetree@vger.kernel.org, Peter Chen , Stephen Boyd , Douglas Anderson , Matthias Kaehlcke , Colin Ian King , Dmitry Osipenko , Fabio Estevam , Masahiro Yamada Subject: [PATCH v11 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Fri, 4 Jun 2021 14:41:00 -0700 Message-Id: <20210604144027.v11.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog In-Reply-To: <20210604214101.3363525-1-mka@chromium.org> References: <20210604214101.3363525-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Call onboard_hub_create/destroy_pdevs() from _probe()/_remove() to create/destroy platform devices for onboard USB hubs that may be connected to the root hub of the controller. These functions are a NOP unless CONFIG_USB_ONBOARD_HUB=y/m. Also add a field to struct xhci_hcd to keep track of the onboard hub platform devices that are owned by the xHCI. Signed-off-by: Matthias Kaehlcke --- Changes in v11: - use onboard_hub_create/destroy_pdevs() to support multiple onboard hubs that are connected to the same root hub - moved field/list to keep track of platform devices from struct usb_hcd to struct xhci_hcd - updated commit message Changes in v10: - none Changes in v9: - added dependency on USB_ONBOARD_HUB (or !!USB_ONBOARD_HUB) to USB_XHCI_PLATFORM Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - patch added to the series drivers/usb/host/Kconfig | 1 + drivers/usb/host/xhci-plat.c | 6 ++++++ drivers/usb/host/xhci.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index df9428f1dc5e..46818b232204 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -54,6 +54,7 @@ config USB_XHCI_PCI_RENESAS config USB_XHCI_PLATFORM tristate "Generic xHCI driver for a platform device" select USB_XHCI_RCAR if ARCH_RENESAS + depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB help Adds an xHCI host driver for a generic platform device, which provides a memory space and an irq. diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c1edcc9b13ce..ee98a3671619 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 @@ -374,6 +375,9 @@ static int xhci_plat_probe(struct platform_device *pdev) */ pm_runtime_forbid(&pdev->dev); + INIT_LIST_HEAD(&xhci->onboard_hub_devs); + onboard_hub_create_pdevs(hcd->self.root_hub, &xhci->onboard_hub_devs); + return 0; @@ -420,6 +424,8 @@ static int xhci_plat_remove(struct platform_device *dev) usb_remove_hcd(hcd); usb_put_hcd(shared_hcd); + onboard_hub_destroy_pdevs(&xhci->onboard_hub_devs); + clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); usb_put_hcd(hcd); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2595a8f057c4..52d9b28745de 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1919,6 +1919,8 @@ struct xhci_hcd { struct dentry *debugfs_slots; struct list_head regset_list; + struct list_head onboard_hub_devs; + void *dbc; /* platform-specific data -- must come last */ unsigned long priv[] __aligned(sizeof(s64));