Skip to content

Commit 38d6e60

Browse files
MikeLooijmansgregkh
authored andcommitted
usb: dwc3: xilinx: Prevent spike in reset signal
The "reset" GPIO controls the RESET signal to an external, usually ULPI PHY, chip. The original code path acquires the signal in LOW state, and then immediately asserts it HIGH again, if the reset signal defaulted to asserted, there'd be a short "spike" before the reset. Here is what happens depending on the pre-existing state of the reset signal: Reset (previously asserted): ~~~|_|~~~~|_______ Reset (previously deasserted): _____|~~~~|_______ ^ ^ ^ A B C At point A, the low going transition is because the reset line is requested using GPIOD_OUT_LOW. If the line is successfully requested, the first thing we do is set it high _without_ any delay. This is point B. So, a glitch occurs between A and B. Requesting the line using GPIOD_OUT_HIGH eliminates the A and B transitions. Instead we get: Reset (previously asserted) : ~~~~~~~~~~|______ Reset (previously deasserted): ____|~~~~~|______ ^ ^ A C Where A and C are the points described above in the code. Point B has been eliminated. The issue was found during code inspection. Also remove the cryptic "toggle ulpi .." comment. Fixes: ca05b38 ("usb: dwc3: xilinx: Add gpio-reset support") Cc: stable <stable@kernel.org> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20250318064518.9320-1-mike.looijmans@topic.nl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a105989 commit 38d6e60

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/usb/dwc3/dwc3-xilinx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,13 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data)
207207

208208
skip_usb3_phy:
209209
/* ulpi reset via gpio-modepin or gpio-framework driver */
210-
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
210+
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
211211
if (IS_ERR(reset_gpio)) {
212212
return dev_err_probe(dev, PTR_ERR(reset_gpio),
213213
"Failed to request reset GPIO\n");
214214
}
215215

216216
if (reset_gpio) {
217-
/* Toggle ulpi to reset the phy. */
218-
gpiod_set_value_cansleep(reset_gpio, 1);
219217
usleep_range(5000, 10000);
220218
gpiod_set_value_cansleep(reset_gpio, 0);
221219
usleep_range(5000, 10000);

0 commit comments

Comments
 (0)