Thread (17 messages) 17 messages, 4 authors, 6d ago

Re: [PATCH 3/5] usb: dwc3: core: add post PHY registration hook for platform glue

From: Krishna Kurapati <hidden>
Date: 2026-09-23 05:54:21
Also in: linux-phy, linux-rockchip, linux-usb, lkml


On 9/15/2026 8:47 PM, Sebastian Reichel wrote:
Add support for custom PHY handling steps in platform glue code
by adding a post registration hook. This will be used for handling
PHY reset notifications on the Rockchip platform.

Tested-by: Igor Paunovic <redacted> # Orange Pi 5 Plus
Signed-off-by: Sebastian Reichel <redacted>
Reviewed-by: Krishna Kurapati <redacted>
quoted hunk ↗ jump to hunk
---
  drivers/usb/dwc3/core.c | 2 +-
  drivers/usb/dwc3/core.h | 9 +++++++++
  2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 4b7132887a03..daf5aec07fbf 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1613,7 +1613,7 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
  		}
  	}
  
-	return 0;
+	return dwc3_post_phy_registration(dwc);
  }
  
  static int dwc3_core_init_mode(struct dwc3 *dwc)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 608daeb7ef10..e9d8df0a298e 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -995,10 +995,12 @@ struct dwc3_scratchpad_array {
   *				need to be passed on to glue layer
   * @pre_set_role: Notify glue of role switch notifications
   * @pre_run_stop: Notify run stop enable/disable information to glue
+ * @post_phy_registration: Called directly after PHY got registered
   */
  struct dwc3_glue_ops {
  	void	(*pre_set_role)(struct dwc3 *dwc, enum usb_role role);
  	void	(*pre_run_stop)(struct dwc3 *dwc, bool is_on);
+	int	(*post_phy_registration)(struct dwc3 *dwc);
  };
  
  /**
@@ -1655,6 +1657,13 @@ static inline void dwc3_pre_run_stop(struct dwc3 *dwc, bool is_on)
  		dwc->glue_ops->pre_run_stop(dwc, is_on);
  }
  
+static inline int dwc3_post_phy_registration(struct dwc3 *dwc)
+{
+	if (dwc->glue_ops && dwc->glue_ops->post_phy_registration)
+		return dwc->glue_ops->post_phy_registration(dwc);
+	return 0;
+}
+
  #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
  int dwc3_host_init(struct dwc3 *dwc);
  void dwc3_host_exit(struct dwc3 *dwc);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help