U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Kongyang Liu <seashell11234455@gmail.com>
Cc: u-boot@lists.denx.de, Jonas Karlman <jonas@kwiboo.se>,
	Lukasz Majewski <lukma@denx.de>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Simon Glass <sjg@chromium.org>,
	Teik Heng Chong <teik.heng.chong@intel.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 1/2] usb: dwc2: Extract USB DWC2 register definitions
Date: Sun, 30 Jun 2024 04:49:10 +0200	[thread overview]
Message-ID: <197c6afd-b917-4e8e-ac5e-07f4fcf38117@denx.de> (raw)
In-Reply-To: <CAOKwTdqeppqngwX2PFx7vLtnbv=hbfkL3cmW3nwRNa9psnWtsA@mail.gmail.com>

On 6/27/24 1:33 PM, Kongyang Liu wrote:
> Marek Vasut <marex@denx.de> 于2024年6月23日周日 07:49写道:
>>
>> 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 <seashell11234455@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(&regs->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.
> 
> This patch only extracts the common parts of the host mode and gadget
> mode, without any code refactoring. Could you please describe more clearly
> how the patch should be split?

Sure, sorry for being unclear. There seems to be multiple types of 
changes that are combined in this patch:

1) Structure reorganization:
-	writel(DIEPMSK_INIT, &reg->diepmsk);
+	writel(DIEPMSK_INIT, &reg->device_regs.diepmsk);

2) Structure rename:
-	reg = (struct dwc2_usbotg_reg *)pdata->regs_otg;
+	reg = (struct dwc2_core_regs *)pdata->regs_otg;

3) Conversion from (1 << n) to BIT(n)
4) Macro rename:
5) Moving code around between files:
#define DWC2_HWCFG4_IDDIG_FILT_EN			(1 << 20)
#define GHWCFG4_IDDIG_FILT_EN			BIT(20)

It would be good to have those as separate patches (one type of clean up 
change per patch), otherwise it is really hard to review such a combined 
patch.

Thanks !

  reply	other threads:[~2024-06-30  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 14:22 [PATCH 0/2] usb: dwc2: Refactor and update USB DWC2 driver Kongyang Liu
2024-05-22 14:22 ` [PATCH 1/2] usb: dwc2: Extract USB DWC2 register definitions Kongyang Liu
2024-06-22 23:14   ` Marek Vasut
2024-06-27 11:33     ` Kongyang Liu
2024-06-30  2:49       ` Marek Vasut [this message]
2024-05-22 14:22 ` [PATCH 2/2] usb: dwc2: Update reset method for host and device mode Kongyang Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=197c6afd-b917-4e8e-ac5e-07f4fcf38117@denx.de \
    --to=marex@denx.de \
    --cc=jonas@kwiboo.se \
    --cc=lukma@denx.de \
    --cc=mkorpershoek@baylibre.com \
    --cc=seashell11234455@gmail.com \
    --cc=sjg@chromium.org \
    --cc=teik.heng.chong@intel.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox