lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 May 2023 03:08:52 +0000
From:   Stanley Chang[昌育德] 
        <stanley_chang@...ltek.com>
To:     Thinh Nguyen <Thinh.Nguyen@...opsys.com>
CC:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Felipe Balbi <balbi@...nel.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v4 1/2] usb: dwc3: core: add support for RTK SoC custom's global register start address

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?

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
+
 /* Global Registers */
 #define DWC3_GSBUSCFG0         0xc100
 #define DWC3_GSBUSCFG1         0xc104

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ