linux-usb.vger.kernel.org archive mirror
 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>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Felipe Balbi <balbi@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] usb: dwc3: core: add support for RTK SoC custom's global register start address
Date: Wed, 3 May 2023 22:37:11 +0000	[thread overview]
Message-ID: <20230503223704.c3kccy74o7h3iawx@synopsys.com> (raw)
In-Reply-To: <05bcd78a37e945528ec68592eb73d755@realtek.com>

On Wed, May 03, 2023, Stanley Chang[昌育德] wrote:
> Hi Thinh,
> 
> > I think you're overcomplicating things here.
> > 
> > Can we just match using compatible string as mentioned before? I believe I
> > suggested to use that before but I think you had issue we getting it because it's
> > from the parent device?
> > 
> > Did you try this?
> > 
> >         dwc_res.start = DWC3_RTK_ABC_GLOBAL_OFFSET;
> > 
> >         if (dev->of_node) {
> >                 struct device_node *parent =
> > of_get_parent(dev->of_node);
> > 
> >                 if (of_device_is_compatible(parent, "your-compatible"))
> >                         dwc_res.start =
> > DWC3_RTK_ABC_GLOBAL_OFFSET;
> > 
> >                 of_node_put(parent);
> >         }
> 
> This is a good idea. Thanks for your suggestion.
> This patch works fine and it is simply. 
> For the compatible name, I use that "realtek,rtd1xxx-dwc3". 
> rtd1xxx is the name of SoCs, for rtd129x, rtd139x, rtd16xx, ... etc.
> Do you have any concern?

I think it's fine.

> 
> New patch as follows
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 0beaab932e7d..cd4b69541776 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,rtd1xxx-dwc3")) {
> +                       dwc_res.start -= DWC3_GLOBALS_REGS_START;
> +                       dwc_res.start += RTK_RTD1XXX_DWC3_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..db48aae211be 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 RTK_RTD1XXX_DWC3_GLOBALS_REGS_START    0x8100

Let's keep consistent with the DWC3_ prefix. Something like this:

#define DWC3_RTK_RTD1XXX_GLOBAL_REGS_START 0x8100

> +
>  /* Global Registers */
>  #define DWC3_GSBUSCFG0         0xc100
>  #define DWC3_GSBUSCFG1         0xc104
> 

Thanks,
Thinh

  reply	other threads:[~2023-05-03 22:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02  5:04 [PATCH v4 1/2] usb: dwc3: core: add support for RTK SoC custom's global register start address Stanley Chang
2023-05-02  5:04 ` [PATCH v4 2/2] dt-bindings: usb: snps,dwc3: Add the compatible name 'snps,dwc3-rtk-soc' Stanley Chang
2023-05-02  7:40   ` Krzysztof Kozlowski
2023-05-02  8:05     ` Stanley Chang[昌育德]
2023-05-02  8:44       ` Krzysztof Kozlowski
2023-05-02  8:56         ` Stanley Chang[昌育德]
2023-05-02 10:15           ` Krzysztof Kozlowski
2023-05-02 10:37             ` Stanley Chang[昌育德]
2023-05-02 19:27               ` Krzysztof Kozlowski
2023-05-03  3:14                 ` Stanley Chang[昌育德]
2023-05-02 22:36 ` [PATCH v4 1/2] usb: dwc3: core: add support for RTK SoC custom's global register start address Thinh Nguyen
2023-05-02 22:39   ` Thinh Nguyen
2023-05-03  3:08   ` Stanley Chang[昌育德]
2023-05-03 22:37     ` Thinh Nguyen [this message]
2023-05-04  3:28       ` Stanley Chang[昌育德]

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=20230503223704.c3kccy74o7h3iawx@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh+dt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).