Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp1075254pxb; Fri, 13 Aug 2021 12:55:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTHo30bLwDpQ0clgE0H4/sRSQmAYKgojpaMgk9pLtOPatOJzCnLBifl6k5vYDTdDKHdH92 X-Received: by 2002:a05:6638:15:: with SMTP id z21mr3796330jao.25.1628884529726; Fri, 13 Aug 2021 12:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628884529; cv=none; d=google.com; s=arc-20160816; b=Scnlv671lN9gZRFR8scFl86MJnSeByQ15F6O/xbXJiwIaInujzzosApGAMtUl44Ueq ArJ6u5C3pAyyPGAga/Xk4Dwqb3xdhWezspFsaH3BrAMlrg3Vj29f4G/lH1CLufcSZJOw chrUUYvIqxPLHTSLVa+3h+hJyYYaNPLXgRgAa3jVcV49uBlXLNGzoRudIbzX0UjobG2L rW7xkRMRPkl5VlR1LTxxI8EcRDI/mV6hi7MqZi1n5ATPzojCknzZCLKPnVYhv76edeQp BboZNGaNisgY4F8aMn5QhHFzvucZmaekZGzCG9Ftdqfc9EffcPOYv4D+RP744eW3T9dD w/KA== 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=k9Rmu3khB0kAKTqvY5KWNzvfUL1dPXP+fLP9201xmak=; b=uTAAXnpRFFkHHok80cuyL4la6s0IAfghuRdyOWuaj8qa+u5wmfFcRVwNLwDgbfEpzL BSp4pldg94oWVCeqLLaIxGizTLpNVf987nGGkzkYFfEaMfrQN/sEKwSjsd7moHuHFynP oLCPA4VIVu5sTfKeM9fTt7IWeuNNUJj06h+FkjowwYpHJpxuZfCSo8vIfYQEreSQlB6S 4T88S/v6uTDov6AmPhkjQ+YD0Ldt4MgHpEqdxLnov296UBCApaiOHAz24MvQkiznPTfM 0UYwkoOSi6g1HsNjByBO6JC/7cEwi+4FdVcoFCVoKchlHVoc/zMLtJw7GzM4Khk58n32 oN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=av8ZrIBv; 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 h4si2584382jam.30.2021.08.13.12.55.18; Fri, 13 Aug 2021 12:55:29 -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=av8ZrIBv; 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 S234240AbhHMTxa (ORCPT + 99 others); Fri, 13 Aug 2021 15:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbhHMTxT (ORCPT ); Fri, 13 Aug 2021 15:53:19 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38044C061292 for ; Fri, 13 Aug 2021 12:52:52 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id bo18so16972515pjb.0 for ; Fri, 13 Aug 2021 12:52:52 -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=k9Rmu3khB0kAKTqvY5KWNzvfUL1dPXP+fLP9201xmak=; b=av8ZrIBvUM9hRpZVFwbUKZwLn2rXRoaHSb4/HOsVGKL7qYduvlwoxVy31eMFlY2nci lG7Q8S9SSkYUFT4SnL56w4Dm69qWmAD0UAJ9ge/PeiX2Ie9l8KQA305+tM9dz2l3HTGO whRsW1NtjHNHSDHSt2CxTPksVISyHaWynR1GQ= 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=k9Rmu3khB0kAKTqvY5KWNzvfUL1dPXP+fLP9201xmak=; b=Vf5c+VAJ3lBNmlvAW3Pd0pv+hJbmu80914B1rIXEYVbdxMUXg7wTBqjX6zE/0RkEG5 23Ocd/M/8t0Wc0UdKTy86kkKLt3kc1na1goPIJ1oHf2/Y+oQSZ+RoGrJ1E9Mkhryokfi mLOUwUKKK0dJ9To7jwAlNWvx0miPpzBzPDzBhDm5K9UTgEAni5NNz7tmrB+IcsX8Rk8n t+GRY/dToakjgAFE4nOA/TGbfeZuoOMjKLkW264U8yioQhNhMlUedk4ATdkVZfGqBfWB Xf4rqbhkLeVlee0Z/q7x5KZ1UYtfFMwEofVZCBoWg9LTUJXsV91iUE1iZij8NH6v0Xyi nHfg== X-Gm-Message-State: AOAM533GC3wN60GYhQlBI9Aw107NTv3xRm2FIeS7N+Lm8LIjzbfHpgR4 whT3TguQYnQool09z3ISZTKNnw== X-Received: by 2002:a17:90b:4c8e:: with SMTP id my14mr3242709pjb.234.1628884371370; Fri, 13 Aug 2021 12:52:51 -0700 (PDT) Received: from localhost ([2620:15c:202:201:450d:9788:a70e:42d6]) by smtp.gmail.com with UTF8SMTPSA id x189sm3625510pfx.99.2021.08.13.12.52.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 12:52:51 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: devicetree@vger.kernel.org, Peter Chen , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bastien Nocera , Ravi Chandra Sadineni , Michal Simek , Douglas Anderson , Roger Quadros , Krzysztof Kozlowski , Stephen Boyd , Matthias Kaehlcke , Dmitry Osipenko , Fabio Estevam Subject: [PATCH v16 6/7] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Fri, 13 Aug 2021 12:52:27 -0700 Message-Id: <20210813125146.v16.6.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.33.0.rc1.237.g0d66db33f3-goog In-Reply-To: <20210813195228.2003500-1-mka@chromium.org> References: <20210813195228.2003500-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 v16: - none Changes in v15: - none Changes in v14: - none Changes in v13: - added comment for 'depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB' construct Changes in v12: - none 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 518c2312ef0c..099e9615919c 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 # if USB_ONBOARD_HUB=m, this can't be 'y' 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 3c7d281672ae..5ba01d5ccab8 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1923,6 +1923,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)); -- 2.33.0.rc1.237.g0d66db33f3-goog