msm: qdss: move clk management to separate file
Change-Id: Iabf9f649edb2558a73d9e82a01bdd846178e6144
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index dac36bb..ec15245 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -49,7 +49,7 @@
msm-etm-objs := etm.o
obj-$(CONFIG_MSM_ETM) += msm-etm.o
-obj-$(CONFIG_MSM_QDSS) += qdss-etb.o qdss-tpiu.o qdss-funnel.o qdss-ptm.o
+obj-$(CONFIG_MSM_QDSS) += qdss.o qdss-etb.o qdss-tpiu.o qdss-funnel.o qdss-ptm.o
quiet_cmd_mkrpcsym = MKCAP $@
cmd_mkrpcsym = $(PERL) $(srctree)/$(src)/mkrpcsym.pl $< $@
diff --git a/arch/arm/mach-msm/qdss-ptm.c b/arch/arm/mach-msm/qdss-ptm.c
index 00d46ee..66d4555 100644
--- a/arch/arm/mach-msm/qdss-ptm.c
+++ b/arch/arm/mach-msm/qdss-ptm.c
@@ -27,15 +27,9 @@
#include <linux/wakelock.h>
#include <linux/pm_qos_params.h>
#include <asm/atomic.h>
-#include <mach/rpm.h>
-#include "rpm_resources.h"
#include "qdss.h"
-#define QDSS_CLK_ON_DBG 0x1
-#define QDSS_CLK_ON_HSDBG 0x2
-#define QDSS_CLK_OFF 0x0
-
#define ptm_writel(ptm, cpu, val, off) \
__raw_writel((val), ptm.base + (SZ_4K * cpu) + off)
#define ptm_readl(ptm, cpu, off) \
@@ -189,34 +183,6 @@
static struct ptm_ctx ptm;
-int qdss_clk_enable(void)
-{
- int ret;
-
- struct msm_rpm_iv_pair iv;
- iv.id = MSM_RPM_ID_QDSS_CLK;
- iv.value = QDSS_CLK_ON_DBG;
- ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
- if (WARN(ret, "qdss clks not enabled (%d)\n", ret))
- goto err_clk;
-
- return 0;
-
-err_clk:
- return ret;
-}
-
-void qdss_clk_disable(void)
-{
- int ret;
- struct msm_rpm_iv_pair iv;
-
- iv.id = MSM_RPM_ID_QDSS_CLK;
- iv.value = QDSS_CLK_OFF;
- ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
- WARN(ret, "qdss clks not disabled (%d)\n", ret);
-}
-
/* ETM clock is derived from the processor clock and gets enabled on a
* logical OR of below items on Krait (pass2 onwards):
* 1.CPMR[ETMCLKEN] is 1
diff --git a/arch/arm/mach-msm/qdss.c b/arch/arm/mach-msm/qdss.c
new file mode 100644
index 0000000..7fdc4d3
--- /dev/null
+++ b/arch/arm/mach-msm/qdss.c
@@ -0,0 +1,59 @@
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <mach/rpm.h>
+
+#include "rpm_resources.h"
+#include "qdss.h"
+
+enum {
+ QDSS_CLK_OFF,
+ QDSS_CLK_ON_DBG,
+ QDSS_CLK_ON_HSDBG,
+};
+
+
+int qdss_clk_enable(void)
+{
+ int ret;
+
+ struct msm_rpm_iv_pair iv;
+ iv.id = MSM_RPM_ID_QDSS_CLK;
+ iv.value = QDSS_CLK_ON_DBG;
+ ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
+ if (WARN(ret, "qdss clks not enabled (%d)\n", ret))
+ goto err_clk;
+
+ return 0;
+
+err_clk:
+ return ret;
+}
+
+void qdss_clk_disable(void)
+{
+ int ret;
+ struct msm_rpm_iv_pair iv;
+
+ iv.id = MSM_RPM_ID_QDSS_CLK;
+ iv.value = QDSS_CLK_OFF;
+ ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, &iv, 1);
+ WARN(ret, "qdss clks not disabled (%d)\n", ret);
+}
diff --git a/arch/arm/mach-msm/qdss.h b/arch/arm/mach-msm/qdss.h
index fef9460..c883000 100644
--- a/arch/arm/mach-msm/qdss.h
+++ b/arch/arm/mach-msm/qdss.h
@@ -64,6 +64,8 @@
void tpiu_disable(void);
void funnel_enable(uint8_t id, uint32_t port_mask);
void funnel_disable(uint8_t id, uint32_t port_mask);
+int qdss_clk_enable(void);
+void qdss_clk_disable(void);
#ifdef CONFIG_MSM_JTAG
extern void msm_jtag_save_state(void);