RE: [PATCH v4 1/2] usb: dwc3: core: add support for RTK SoC custom's global register start address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux