All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Stanley Chang <stanley_chang@realtek.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6] usb: dwc3: core: add support for realtek SoCs custom's global register start address
Date: Thu, 11 May 2023 00:35:08 +0000	[thread overview]
Message-ID: <20230511003436.k3advl65gtabu7rx@synopsys.com> (raw)
In-Reply-To: <20230505025104.18321-1-stanley_chang@realtek.com>

On Fri, May 05, 2023, Stanley Chang wrote:
> The Realtek RTD SoCs were designed with the global register address
> offset at 0x8100. The default address offset is constant at
> DWC3_GLOBALS_REGS_START (0xc100). Therefore, add a check if the
> compatible name of the parent is realtek,rtd-dwc3, then global
> register start address will remap to 0x8100.
> 
> Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> ---
>  v5 to v6 change:
> Change the compatible name to avoid using the wildcard.
> 
>  v4 to v5 change:
> Use the compatible name of the parent to match this special offset.
> 
>  v3 to v4 change:
> Use the compatible name to specify the global register address offset.
> If the compatible name is "snps,dwc3-rtk-soc", then the offset use 0x8100.
> Otherwise, the offset is default value 0xc100.
> 
>  v2 to v3 change:
> 1.  Fix the dtschema validation error.
> 
>  v1 to v2 change:
> 1. Change the name of the property "snps,global-regs-starting-offset".
> 2. Adjust the format of comment.
> 3. Add initial value of the global_regs_starting_offset
> 4. Remove the log of dev_info.
> ---
>  drivers/usb/dwc3/core.c | 11 +++++++++++
>  drivers/usb/dwc3/core.h |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 0beaab932e7d..278cd1c33841 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1800,6 +1800,17 @@ static int dwc3_probe(struct platform_device *pdev)
>  	dwc_res = *res;
>  	dwc_res.start += DWC3_GLOBALS_REGS_START;
>  
> +	if (dev->of_node) {
> +		struct device_node *parent = of_get_parent(dev->of_node);
> +
> +		if (of_device_is_compatible(parent, "realtek,rtd-dwc3")) {
> +			dwc_res.start -= DWC3_GLOBALS_REGS_START;
> +			dwc_res.start += DWC3_RTK_RTD_GLOBALS_REGS_START;
> +		}
> +
> +		of_node_put(parent);
> +	}
> +
>  	regs = devm_ioremap_resource(dev, &dwc_res);
>  	if (IS_ERR(regs))
>  		return PTR_ERR(regs);
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index d56457c02996..1968638f29ed 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -84,6 +84,8 @@
>  #define DWC3_OTG_REGS_START		0xcc00
>  #define DWC3_OTG_REGS_END		0xccff
>  
> +#define DWC3_RTK_RTD_GLOBALS_REGS_START	0x8100
> +
>  /* Global Registers */
>  #define DWC3_GSBUSCFG0		0xc100
>  #define DWC3_GSBUSCFG1		0xc104
> -- 
> 2.34.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      parent reply	other threads:[~2023-05-11  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  2:50 [PATCH v6] usb: dwc3: core: add support for realtek SoCs custom's global register start address Stanley Chang
2023-05-06  1:38 ` Thinh Nguyen
2023-05-06  4:14   ` Stanley Chang[昌育德]
2023-05-11  0:35 ` Thinh Nguyen [this message]

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=20230511003436.k3advl65gtabu7rx@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stanley_chang@realtek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.