@@ -60,23 +60,34 @@ static void __init usb_musb_pm_init(void)
dev_set_name(dev, "musb_hdrc");
otg_clk = clk_get(dev, "ick");
+ if (IS_ERR(otg_clk)) {
+ printk(KERN_WARNING "%s: Unable to get clock for MUSB.\n",
+ __func__);
+ goto out0;
+ }
- if (otg_clk && clk_enable(otg_clk)) {
+ if (clk_enable(otg_clk)) {
printk(KERN_WARNING
"%s: Unable to enable clocks for MUSB, "
"cannot reset.\n", __func__);
- } else {
- /* Reset OTG controller. After reset, it will be in
- * force-idle, force-standby mode. */
- __raw_writel(OTG_SYSC_SOFTRESET, otg_base + OTG_SYSCONFIG);
-
- while (!(OTG_SYSS_RESETDONE &
- __raw_readl(otg_base + OTG_SYSSTATUS)))
- cpu_relax();
+ goto out1;
}
- if (otg_clk)
- clk_disable(otg_clk);
+ /* Reset OTG controller. After reset, it will be in
+ * force-idle, force-standby mode. */
+ __raw_writel(OTG_SYSC_SOFTRESET, otg_base + OTG_SYSCONFIG);
+
+ while (!(OTG_SYSS_RESETDONE &
+ __raw_readl(otg_base + OTG_SYSSTATUS)))
+ cpu_relax();
+
+ clk_disable(otg_clk);
+
+out1:
+ clk_put(otg_clk);
+
+out0:
+ iounmap(otg_base);
}
void usb_musb_disable_autoidle(void)