]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
clk: zynqmp: Add basic clk read/ write functions
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Fri, 19 Aug 2016 19:36:41 +0000 (01:06 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 22 Aug 2016 09:42:33 +0000 (11:42 +0200)
Add the basic clk read and write apis.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
include/linux/clk/zynqmp.h [new file with mode: 0644]

diff --git a/include/linux/clk/zynqmp.h b/include/linux/clk/zynqmp.h
new file mode 100644 (file)
index 0000000..0fe12aa
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2016 Xilinx Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_CLK_ZYNQMP_H_
+#define __LINUX_CLK_ZYNQMP_H_
+
+#include <linux/spinlock.h>
+#include <linux/soc/xilinx/zynqmp/pm.h>
+
+static inline u32 zynqmp_pm_mmio_readl(void __iomem *reg)
+{
+       u32 val;
+       int ret;
+
+       ret = zynqmp_pm_mmio_read((u32)(ulong)reg, &val);
+       if (ret)
+               pr_err("Read failed\n");
+       return val;
+}
+
+static inline int zynqmp_pm_mmio_writel(u32 val, void __iomem *reg)
+{
+       int ret;
+
+       ret = zynqmp_pm_mmio_write((u32)(ulong)reg, 0xffffffff, val);
+       if (ret)
+               pr_err("Write failed\n");
+       return ret;
+}
+#endif