]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
dwc3: dwc3-of-simple: Move ioremap calls into probe
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Tue, 18 Apr 2017 15:51:14 +0000 (21:21 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 19 Apr 2017 09:31:12 +0000 (11:31 +0200)
Currently ioremap_resource & ioremap_release of USB vendor specific
control regions are being done in dwc3_enable_hw_coherency() when
CCI is enabled. These USB vendor specific regions has the PIPE3
control registers, which needs to be configured everytime to get
proper connect/disconnect events. Because of this reason moving the
ioremap_resource into probe.

Note:
This patch is a temporary workaround which is done to set pipe signals
without effecting usb cci and this will be redesigned. this change will
get it into v2017.1 and expected to change once the proper solution is
available.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/dwc3-of-simple.c

index 5811d0a9830751dd1c48889b17a8172d5a360154..09a95566d8e3cad55e8cd5f7f7b4950b2f031bc6 100644 (file)
@@ -44,6 +44,7 @@ struct dwc3_of_simple {
        struct device           *dev;
        struct clk              **clks;
        int                     num_clocks;
+       void __iomem            *regs;
 };
 
 int dwc3_enable_hw_coherency(struct device *dev)
@@ -52,30 +53,17 @@ int dwc3_enable_hw_coherency(struct device *dev)
 
        if (of_device_is_compatible(node, "xlnx,zynqmp-dwc3")) {
                struct platform_device *pdev_parent;
-               struct resource *res;
+               struct dwc3_of_simple *simple;
                void __iomem *regs;
                u32 reg;
-               int ret;
 
                pdev_parent = of_find_device_by_node(node);
-               res = platform_get_resource(pdev_parent,
-                                           IORESOURCE_MEM, 0);
-               if (!res) {
-                       dev_err(dev, "missing memory resource\n");
-                       return -ENODEV;
-               }
-
-               regs = devm_ioremap_resource(&pdev_parent->dev, res);
-               if (IS_ERR(regs)) {
-                       ret = PTR_ERR(regs);
-                       return ret;
-               }
+               simple = platform_get_drvdata(pdev_parent);
+               regs = simple->regs;
 
                reg = readl(regs + XLNX_USB_COHERENCY);
                reg |= XLNX_USB_COHERENCY_ENABLE;
                writel(reg, regs + XLNX_USB_COHERENCY);
-
-               devm_ioremap_release(&pdev_parent->dev, res);
        }
 
        return 0;
@@ -146,6 +134,18 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
 
                struct device_node      *child;
                char                    *soc_rev;
+               struct resource         *res;
+               void __iomem            *regs;
+
+               res = platform_get_resource(pdev,
+                                           IORESOURCE_MEM, 0);
+
+               regs = devm_ioremap_resource(&pdev->dev, res);
+               if (IS_ERR(regs))
+                       return PTR_ERR(regs);
+
+               /* Store the usb control regs into simple for further usage */
+               simple->regs = regs;
 
                /* read Silicon version using nvmem driver */
                soc_rev = zynqmp_nvmem_get_silicon_version(&pdev->dev,