Merge 5.18-rc5 into usb-next
[linux-2.6-microblaze.git] / drivers / usb / dwc3 / core.c
index 364c645..2345a54 100644 (file)
@@ -275,7 +275,8 @@ int dwc3_core_soft_reset(struct dwc3 *dwc)
 
        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
        reg |= DWC3_DCTL_CSFTRST;
-       dwc3_writel(dwc->regs, DWC3_DCTL, reg);
+       reg &= ~DWC3_DCTL_RUN_STOP;
+       dwc3_gadget_dctl_write_safe(dwc, reg);
 
        /*
         * For DWC_usb31 controller 1.90a and later, the DCTL.CSFRST bit
@@ -1377,10 +1378,10 @@ static void dwc3_get_properties(struct dwc3 *dwc)
        u8                      lpm_nyet_threshold;
        u8                      tx_de_emphasis;
        u8                      hird_threshold;
-       u8                      rx_thr_num_pkt_prd;
-       u8                      rx_max_burst_prd;
-       u8                      tx_thr_num_pkt_prd;
-       u8                      tx_max_burst_prd;
+       u8                      rx_thr_num_pkt_prd = 0;
+       u8                      rx_max_burst_prd = 0;
+       u8                      tx_thr_num_pkt_prd = 0;
+       u8                      tx_max_burst_prd = 0;
        u8                      tx_fifo_resize_max_num;
        const char              *usb_psy_name;
        int                     ret;
@@ -1735,21 +1736,44 @@ static int dwc3_probe(struct platform_device *pdev)
                /*
                 * Clocks are optional, but new DT platforms should support all
                 * clocks as required by the DT-binding.
+                * Some devices have different clock names in legacy device trees,
+                * check for them to retain backwards compatibility.
                 */
                dwc->bus_clk = devm_clk_get_optional(dev, "bus_early");
                if (IS_ERR(dwc->bus_clk))
                        return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
                                             "could not get bus clock\n");
 
+               if (dwc->bus_clk == NULL) {
+                       dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk");
+                       if (IS_ERR(dwc->bus_clk))
+                               return dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
+                                                    "could not get bus clock\n");
+               }
+
                dwc->ref_clk = devm_clk_get_optional(dev, "ref");
                if (IS_ERR(dwc->ref_clk))
                        return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
                                             "could not get ref clock\n");
 
+               if (dwc->ref_clk == NULL) {
+                       dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk");
+                       if (IS_ERR(dwc->ref_clk))
+                               return dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
+                                                    "could not get ref clock\n");
+               }
+
                dwc->susp_clk = devm_clk_get_optional(dev, "suspend");
                if (IS_ERR(dwc->susp_clk))
                        return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
                                             "could not get suspend clock\n");
+
+               if (dwc->susp_clk == NULL) {
+                       dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk");
+                       if (IS_ERR(dwc->susp_clk))
+                               return dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
+                                                    "could not get suspend clock\n");
+               }
        }
 
        ret = reset_control_deassert(dwc->reset);