|
@@ -27,6 +27,7 @@
|
|
|
#include <plat/omap_hwmod.h>
|
|
|
#include <plat/omap_device.h>
|
|
|
#include <plat/omap-pm.h>
|
|
|
+#include <plat/common.h>
|
|
|
|
|
|
#include "control.h"
|
|
|
|
|
@@ -172,3 +173,37 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
+
|
|
|
+#define MAX_MODULE_SOFTRESET_WAIT 10000
|
|
|
+int omap_dss_reset(struct omap_hwmod *oh)
|
|
|
+{
|
|
|
+ struct omap_hwmod_opt_clk *oc;
|
|
|
+ int c = 0;
|
|
|
+ int i, r;
|
|
|
+
|
|
|
+ if (!(oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)) {
|
|
|
+ pr_err("dss_core: hwmod data doesn't contain reset data\n");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
|
|
|
+ if (oc->_clk)
|
|
|
+ clk_enable(oc->_clk);
|
|
|
+
|
|
|
+ omap_test_timeout((omap_hwmod_read(oh, oh->class->sysc->syss_offs)
|
|
|
+ & SYSS_RESETDONE_MASK),
|
|
|
+ MAX_MODULE_SOFTRESET_WAIT, c);
|
|
|
+
|
|
|
+ if (c == MAX_MODULE_SOFTRESET_WAIT)
|
|
|
+ pr_warning("dss_core: waiting for reset to finish failed\n");
|
|
|
+ else
|
|
|
+ pr_debug("dss_core: softreset done\n");
|
|
|
+
|
|
|
+ for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++)
|
|
|
+ if (oc->_clk)
|
|
|
+ clk_disable(oc->_clk);
|
|
|
+
|
|
|
+ r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0;
|
|
|
+
|
|
|
+ return r;
|
|
|
+}
|