[PATCH 2/4] usb: chipidea: usbmisc: s32g: Add a REINIT_DURING_RESUME flag

Frank Li Frank.li at nxp.com
Wed May 28 14:27:00 PDT 2025


On Wed, May 28, 2025 at 10:57:20PM +0300, Dan Carpenter wrote:
> From: Ghennadi Procopciuc <ghennadi.procopciuc at nxp.com>
>
> The s32g2 and s32g3 chips will need to re-initialize in the resume path.
> Add a REINIT_DURING_RESUME flag which will trigger the reinitialization.

why power_lost_check() doesn't work for you?

Frank
>
> Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc at nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
>  drivers/usb/chipidea/usbmisc_imx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 118b9a68496b..95759a4ec60c 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -155,6 +155,9 @@
>  					 BLKCTL_OTG_VBUS_WAKEUP_EN | \
>  					 BLKCTL_OTG_DPDM_WAKEUP_EN)
>
> +/* Flags for 'struct imx_usbmisc' */
> +#define REINIT_DURING_RESUME	BIT(1)
> +
>  struct usbmisc_ops {
>  	/* It's called once when probe a usb device */
>  	int (*init)(struct imx_usbmisc_data *data);
> @@ -171,6 +174,7 @@ struct usbmisc_ops {
>  	/* It's called when system resume from usb power lost */
>  	int (*power_lost_check)(struct imx_usbmisc_data *data);
>  	void (*vbus_comparator_on)(struct imx_usbmisc_data *data, bool on);
> +	u32 flags;
>  };
>
>  struct imx_usbmisc {
> @@ -1266,6 +1270,9 @@ int imx_usbmisc_resume(struct imx_usbmisc_data *data, bool wakeup)
>
>  	usbmisc = dev_get_drvdata(data->dev);
>
> +	if ((usbmisc->ops->flags & REINIT_DURING_RESUME) && usbmisc->ops->init)
> +		usbmisc->ops->init(data);
> +
>  	if (usbmisc->ops->power_lost_check)
>  		ret = usbmisc->ops->power_lost_check(data);
>  	if (ret > 0) {
> --
> 2.47.2
>



More information about the linux-arm-kernel mailing list