usb: mtu3: make the reference clock optional
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 7 Feb 2017 06:13:32 +0000 (14:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2017 06:44:52 +0000 (07:44 +0100)
Make the reference clock optional for DTS backward compatibility
and ignore the error if it does not exist.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/mtu3/mtu3_plat.c

index 19a345d6687dca7f1391ad33f0496da47e951692..c3125da66bab7d98ef80211025cb30b434bf6d45 100644 (file)
@@ -225,10 +225,17 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
                return PTR_ERR(ssusb->sys_clk);
        }
 
+       /*
+        * reference clock is usually a "fixed-clock", make it optional
+        * for backward compatibility and ignore the error if it does
+        * not exist.
+        */
        ssusb->ref_clk = devm_clk_get(dev, "ref_ck");
        if (IS_ERR(ssusb->ref_clk)) {
-               dev_err(dev, "failed to get ref clock\n");
-               return PTR_ERR(ssusb->ref_clk);
+               if (PTR_ERR(ssusb->ref_clk) == -EPROBE_DEFER)
+                       return -EPROBE_DEFER;
+
+               ssusb->ref_clk = NULL;
        }
 
        ssusb->num_phys = of_count_phandle_with_args(node,