[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250821222842.fqrxjp56czc7ubok@synopsys.com>
Date: Thu, 21 Aug 2025 22:28:46 +0000
From: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To: Sven Peter <sven@...nel.org>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Felipe Balbi <balbi@...nel.org>,
Janne Grunau <j@...nau.net>, Alyssa Rosenzweig <alyssa@...enzweig.io>,
Neal Gompa <neal@...pa.dev>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"asahi@...ts.linux.dev" <asahi@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"linux-phy@...ts.infradead.org" <linux-phy@...ts.infradead.org>
Subject: Re: [PATCH RFC 05/22] usb: dwc3: apple: Do not use host-vbus-glitches
workaround
On Thu, Aug 21, 2025, Sven Peter wrote:
> From: Janne Grunau <j@...nau.net>
>
> It results in SErrors during init presumedly because MMIO accesses fail
> while certain parts are shutdown.
>
> Signed-off-by: Janne Grunau <j@...nau.net>
> Signed-off-by: Sven Peter <sven@...nel.org>
> ---
> drivers/usb/dwc3/core.c | 1 +
> drivers/usb/dwc3/core.h | 2 ++
> drivers/usb/dwc3/host.c | 5 ++++-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 26aa507a738f001409a97ef563c6561433a1cac5..8d2dc7fa18114102cc8893c4ca0e745e16f30754 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2273,6 +2273,7 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
>
> dwc->dr_mode = USB_DR_MODE_OTG;
> dwc->role_switch_reset_quirk = true;
> + dwc->no_early_roothub_poweroff = true;
> }
> }
>
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index 38f32f2a6193c1b2662ab4f38f4d20cf4b0e198d..3c3a36ec37345b2f9e71444ba3b90b52dbd24443 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -1155,6 +1155,7 @@ struct dwc3_scratchpad_array {
> * @susphy_state: state of DWC3_GUSB2PHYCFG_SUSPHY + DWC3_GUSB3PIPECTL_SUSPHY
> * before PM suspend.
> * @role_switch_reset_quirk: set to force reinitialization after any role switch
> + * @no_early_roothub_poweroff: set to skip early root hub port power off
> * @imod_interval: set the interrupt moderation interval in 250ns
> * increments or 0 to disable.
> * @max_cfg_eps: current max number of IN eps used across all USB configs.
> @@ -1394,6 +1395,7 @@ struct dwc3 {
> unsigned susphy_state:1;
>
> unsigned role_switch_reset_quirk:1;
> + unsigned no_early_roothub_poweroff:1;
>
> u16 imod_interval;
>
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index f7a71e6f9d80aca632f1f970d900a3de8a76f0a7..f7c3a0fc5fe258705311f89c1ba11ff599c01afe 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -134,8 +134,11 @@ int dwc3_host_init(struct dwc3 *dwc)
> /*
> * Some platforms need to power off all Root hub ports immediately after DWC3 set to host
> * mode to avoid VBUS glitch happen when xhci get reset later.
> + * On Apple platforms we must not touch any MMIO yet because dwc3
> + * will not work correctly before its PHY has been initialized.
This doesn't make sense, the phy should've been initialized by this
point. We already access MMIO before this. Even your [PATCH RFC 7/22]
attempts to access MMIO before this, yet accessing here causes problem.
Do we know when the phy get initialized then?
BR,
Thinh
> */
> - dwc3_power_off_all_roothub_ports(dwc);
> + if (!dwc->no_early_roothub_poweroff)
> + dwc3_power_off_all_roothub_ports(dwc);
>
> irq = dwc3_host_get_irq(dwc);
> if (irq < 0)
>
> --
> 2.34.1
>
>
Powered by blists - more mailing lists