浏览代码

waterDataStatisticsCrossAssociation rtuDataOperation.c 李欣儒 commit at 2020-11-05

李欣儒 4 年之前
父节点
当前提交
0302caff30
共有 1 个文件被更改,包括 51 次插入0 次删除
  1. 51 0
      waterDataStatisticsCrossAssociation/databaseOperation/rtuDataOperation.c

+ 51 - 0
waterDataStatisticsCrossAssociation/databaseOperation/rtuDataOperation.c

@@ -270,3 +270,54 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 		/* Static mapping, never released */
 		timer->io_base = ioremap(mem.start, mem.end - mem.start);
 	}
+
+	if (!timer->io_base)
+		return -ENXIO;
+
+	/* After the dmtimer is using hwmod these clocks won't be needed */
+	timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh));
+	if (IS_ERR(timer->fclk))
+		return -ENODEV;
+
+	/* FIXME: Need to remove hard-coded test on timer ID */
+	if (gptimer_id != 12) {
+		struct clk *src;
+
+		src = clk_get(NULL, fck_source);
+		if (IS_ERR(src)) {
+			r = -EINVAL;
+		} else {
+			r = clk_set_parent(timer->fclk, src);
+			if (IS_ERR_VALUE(r))
+				pr_warn("%s: %s cannot set source\n",
+					__func__, oh->name);
+			clk_put(src);
+		}
+	}
+
+	omap_hwmod_setup_one(oh_name);
+	omap_hwmod_enable(oh);
+	__omap_dm_timer_init_regs(timer);
+
+	if (posted)
+		__omap_dm_timer_enable_posted(timer);
+
+	/* Check that the intended posted configuration matches the actual */
+	if (posted != timer->posted)
+		return -EINVAL;
+
+	timer->rate = clk_get_rate(timer->fclk);
+	timer->reserved = 1;
+
+	return r;
+}
+
+static void __init omap2_gp_clockevent_init(int gptimer_id,
+						const char *fck_source,
+						const char *property)
+{
+	int res;
+
+	clkev.errata = omap_dm_timer_get_errata();
+
+	/*