From: Matthias Kaehlcke <mka@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Felipe Balbi <balbi@kernel.org>
Cc: devicetree@vger.kernel.org, Peter Chen <peter.chen@kernel.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Bastien Nocera <hadess@hadess.net>,
Ravi Chandra Sadineni <ravisadineni@chromium.org>,
Michal Simek <michal.simek@xilinx.com>,
Douglas Anderson <dianders@chromium.org>,
Roger Quadros <rogerq@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Stephen Boyd <swboyd@chromium.org>,
Matthias Kaehlcke <mka@chromium.org>,
Dmitry Osipenko <digetx@gmail.com>,
Fabio Estevam <festevam@gmail.com>
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 [thread overview]
Message-ID: <20210813125146.v16.6.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> (raw)
In-Reply-To: <20210813195228.2003500-1-mka@chromium.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 <mka@chromium.org>
---
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 <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/usb/onboard_hub.h>
#include <linux/usb/phy.h>
#include <linux/slab.h>
#include <linux/acpi.h>
@@ -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
next prev parent reply other threads:[~2021-08-13 19:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-13 19:52 [PATCH v16 0/7] usb: misc: Add onboard_usb_hub driver Matthias Kaehlcke
2021-08-13 19:52 ` [PATCH v16 1/7] " Matthias Kaehlcke
2021-11-11 23:31 ` Doug Anderson
2021-11-16 2:08 ` Matthias Kaehlcke
2021-08-13 19:52 ` [PATCH v16 2/7] of/platform: Add stubs for of_platform_device_create/destroy() Matthias Kaehlcke
2021-08-13 19:52 ` [PATCH v16 3/7] ARM: configs: Explicitly enable USB_XHCI_PLATFORM where needed Matthias Kaehlcke
2021-08-26 6:45 ` Roger Quadros
2021-08-26 7:56 ` Krzysztof Kozlowski
2021-08-13 19:52 ` [PATCH v16 4/7] arm64: defconfig: Explicitly enable USB_XHCI_PLATFORM Matthias Kaehlcke
2021-08-26 6:46 ` Roger Quadros
2021-08-13 19:52 ` [PATCH v16 5/7] usb: Specify dependencies on USB_XHCI_PLATFORM with 'depends on' Matthias Kaehlcke
2021-08-26 6:46 ` Roger Quadros
2021-11-11 23:48 ` Doug Anderson
2021-11-16 18:07 ` Matthias Kaehlcke
2021-08-13 19:52 ` Matthias Kaehlcke [this message]
2021-10-20 13:05 ` [PATCH v16 6/7] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Mathias Nyman
2021-10-20 20:27 ` Matthias Kaehlcke
2021-10-20 20:37 ` Alan Stern
2021-10-20 21:01 ` Matthias Kaehlcke
2021-10-20 21:57 ` Alan Stern
2021-08-13 19:52 ` [PATCH v16 7/7] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
2021-09-21 17:08 ` [PATCH v16 0/7] usb: misc: Add onboard_usb_hub driver Matthias Kaehlcke
2021-10-14 21:38 ` Doug Anderson
2021-10-15 6:39 ` Greg Kroah-Hartman
2021-10-19 16:04 ` Fabrice Gasnier
2021-10-19 22:10 ` Matthias Kaehlcke
2021-10-20 6:21 ` Michal Simek
2021-10-20 17:41 ` Matthias Kaehlcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210813125146.v16.6.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid \
--to=mka@chromium.org \
--cc=balbi@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=digetx@gmail.com \
--cc=festevam@gmail.com \
--cc=frowand.list@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hadess@hadess.net \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=michal.simek@xilinx.com \
--cc=peter.chen@kernel.org \
--cc=ravisadineni@chromium.org \
--cc=robh+dt@kernel.org \
--cc=rogerq@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).