[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221206-dwc2-gadget-dual-role-v2-1-0de821615dd3@theobroma-systems.com>
Date: Fri, 16 Dec 2022 17:29:28 +0100
From: Quentin Schulz <foss+kernel@...il.net>
To: Minas Harutyunyan <hminas@...opsys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Quentin Schulz <foss+kernel@...il.net>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Bin Yang <yangbin@...k-chips.com>,
Quentin Schulz <quentin.schulz@...obroma-systems.com>
Subject: [PATCH v2 1/2] usb: dwc2: allow platforms to prevent core phy initialisation
From: Quentin Schulz <quentin.schulz@...obroma-systems.com>
Some USB PHYs need to be controlled dynamically on some platforms.
Let's allow platforms to define whether they should prevent core PHY
initialization by providing a "shadow" value to HCD's
skip_phy_initialization flag before HCD is actually created (e.g. from
a dwc2_set_*_params callback).
Signed-off-by: Quentin Schulz <quentin.schulz@...obroma-systems.com>
---
drivers/usb/dwc2/core.h | 6 ++++++
drivers/usb/dwc2/hcd.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 40cf2880d7e5..6aa9aeb374eb 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -423,6 +423,10 @@ enum dwc2_ep0_state {
* 0 - No
* 1 - Yes
*
+ * @hcd_skip_phy_initialization: Shadow value of HCD skip_phy_initialization
+ * flag.
+ * See include/linux/usb/hcd.h for documentation.
+ *
* The following parameters may be specified when starting the module. These
* parameters define how the DWC_otg controller should be configured. A
* value of -1 (or any other out of range value) for any parameter means
@@ -499,6 +503,8 @@ struct dwc2_core_params {
u32 g_tx_fifo_size[MAX_EPS_CHANNELS];
bool change_speed_quirk;
+
+ unsigned hcd_skip_phy_initialization:1;
};
/**
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 657f1f659ffa..e2fa9a491cab 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -5315,6 +5315,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
if (!IS_ERR_OR_NULL(hsotg->uphy))
otg_set_host(hsotg->uphy->otg, &hcd->self);
+ hcd->skip_phy_initialization = hsotg->params.hcd_skip_phy_initialization;
+
/*
* Finish generic HCD initialization and start the HCD. This function
* allocates the DMA buffer pool, registers the USB bus, requests the
--
2.38.1
Powered by blists - more mailing lists