Browse Source

waterDataStatistics alarmDataOperation.c 朱涛 commit at 2020-11-03

朱涛 4 years ago
parent
commit
5de58d3644
1 changed files with 55 additions and 0 deletions
  1. 55 0
      waterDataStatistics/databaseOperation/alarmDataOperation.c

+ 55 - 0
waterDataStatistics/databaseOperation/alarmDataOperation.c

@@ -1302,3 +1302,58 @@ static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap
 {
 	struct omap_hwmod_ocp_if *os;
 	struct omap_hwmod_addr_space *mem;
+	int found = 0, i = 0;
+
+	os = _find_mpu_rt_port(oh);
+	if (!os || !os->addr)
+		return NULL;
+
+	do {
+		mem = &os->addr[i++];
+		if (mem->flags & ADDR_TYPE_RT)
+			found = 1;
+	} while (!found && mem->pa_start != mem->pa_end);
+
+	return (found) ? mem : NULL;
+}
+
+/**
+ * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG
+ * @oh: struct omap_hwmod *
+ *
+ * Ensure that the OCP_SYSCONFIG register for the IP block represented
+ * by @oh is set to indicate to the PRCM that the IP block is active.
+ * Usually this means placing the module into smart-idle mode and
+ * smart-standby, but if there is a bug in the automatic idle handling
+ * for the IP block, it may need to be placed into the force-idle or
+ * no-idle variants of these modes.  No return value.
+ */
+static void _enable_sysc(struct omap_hwmod *oh)
+{
+	u8 idlemode, sf;
+	u32 v;
+	bool clkdm_act;
+	struct clockdomain *clkdm;
+
+	if (!oh->class->sysc)
+		return;
+
+	/*
+	 * Wait until reset has completed, this is needed as the IP
+	 * block is reset automatically by hardware in some cases
+	 * (off-mode for example), and the drivers require the
+	 * IP to be ready when they access it
+	 */
+	if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
+		_enable_optional_clocks(oh);
+	_wait_softreset_complete(oh);
+	if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
+		_disable_optional_clocks(oh);
+
+	v = oh->_sysc_cache;
+	sf = oh->class->sysc->sysc_flags;
+
+	clkdm = _get_clkdm(oh);
+	if (sf & SYSC_HAS_SIDLEMODE) {
+		clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
+		if (clkdm_act && !(oh->class->sysc->idlemodes &