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

Thinh Nguyen Thinh.Nguyen at synopsys.com
Tue Sep 22 18:48:32 PDT 2026


On Tue, Sep 15, 2026, 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 <royalnet026 at gmail.com> # Orange Pi 5 Plus
> Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>
> ---
>  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);
> 
> -- 
> 2.53.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen at synopsys.com>

Thanks,
Thinh


More information about the linux-arm-kernel mailing list