On 5/22/24 4:22 PM, Kongyang Liu wrote: Hi,
sorry for the late reply.
diff --git a/drivers/usb/common/dwc2_core.c b/drivers/usb/common/dwc2_core.c new file mode 100644 index 0000000000..2fa11fd59d --- /dev/null +++ b/drivers/usb/common/dwc2_core.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2024, Kongyang Liu <seashell11234...@gmail.com> + */ + +#include <linux/bitfield.h> +#include <linux/errno.h> +#include <linux/io.h> +#include <wait_bit.h> + +#include "dwc2_core.h" + +void dwc2_flush_tx_fifo(struct dwc2_core_regs *regs, const int num) +{ + int ret; + + log_debug("Flush Tx FIFO %d\n", num); + + /* Wait for AHB master IDLE state */ + ret = wait_for_bit_le32(®s->global_regs.grstctl, GRSTCTL_AHBIDLE, true, 1000, false);
Just a quick design point, would it be possible to split this patch into two, one which adds this .global_regs and changes the code accordingly, and another which does the code refactoring/move ? That would make it easier to review.