linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: fan.chen@mediatek.com (Fan Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] soc: Mediatek: Create Mediatek SIP call
Date: Fri, 18 Dec 2015 10:42:28 +0800	[thread overview]
Message-ID: <1450406551-1741-2-git-send-email-fan.chen@mediatek.com> (raw)
In-Reply-To: <1450406551-1741-1-git-send-email-fan.chen@mediatek.com>

Create a generic interface for issuing SIP Service calls
which are specified in ARM SMC CALLING CONVENTION.

Signed-off-by: Fan Chen <fan.chen@mediatek.com>
---
 drivers/soc/mediatek/Kconfig         |    8 ++++++++
 drivers/soc/mediatek/Makefile        |    1 +
 drivers/soc/mediatek/mtk-sip.c       |   28 ++++++++++++++++++++++++++++
 include/linux/soc/mediatek/mtk-sip.h |   17 +++++++++++++++++
 4 files changed, 54 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-sip.c
 create mode 100644 include/linux/soc/mediatek/mtk-sip.h

diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index 9d50682..65c1323 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -29,3 +29,11 @@ config MTK_SCPSYS
 	help
 	  Say yes here to add support for the MediaTek SCPSYS power domain
 	  driver.
+
+config MTK_SIP
+        bool "Mediatek SIP Support"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	depends on HAVE_SMCCC
+	help
+	Say yes here to add support for the MediaTek SIP call.
+
diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
index 12998b0..67077dc 100644
--- a/drivers/soc/mediatek/Makefile
+++ b/drivers/soc/mediatek/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
+obj-$(CONFIG_MTK_SIP) += mtk-sip.o
diff --git a/drivers/soc/mediatek/mtk-sip.c b/drivers/soc/mediatek/mtk-sip.c
new file mode 100644
index 0000000..882617f
--- /dev/null
+++ b/drivers/soc/mediatek/mtk-sip.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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/arm-smccc.h>
+#include <linux/soc/mediatek/mtk-sip.h>
+
+int mtk_sip_simple_call(unsigned long func_id,
+			unsigned long a1,
+			unsigned long a2,
+			unsigned long a3)
+{
+	struct smccc_res res;
+
+	smccc_smc(func_id, a1, a2, a3, 0, 0, 0, 0, &res);
+
+	return res.a0;
+}
+
diff --git a/include/linux/soc/mediatek/mtk-sip.h b/include/linux/soc/mediatek/mtk-sip.h
new file mode 100644
index 0000000..dce1818
--- /dev/null
+++ b/include/linux/soc/mediatek/mtk-sip.h
@@ -0,0 +1,17 @@
+#ifndef __SOC_MEDIATEK_MTKSIP_H
+#define __SOC_MEDIATEK_MTKSIP_H
+
+#ifdef CONFIG_MTK_SIP
+int mtk_sip_simple_call(unsigned long func_id,
+			unsigned long a1,
+			unsigned long a2,
+			unsigned long a3);
+#else
+static inline int mtk_sip_simple_call(unsigned long func_id,
+				      unsigned long a1,
+				      unsigned long a2,
+				      unsigned long a3)
+{       return -EOPNOTSUPP; }
+#endif
+
+#endif /*__SOC_MEDIATEK_MTKSIP_H*/
-- 
1.7.9.5

  reply	other threads:[~2015-12-18  2:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18  2:42 [PATCH 0/4] mediatek: Add cpuidle cluster sleep support for MT8173 Fan Chen
2015-12-18  2:42 ` Fan Chen [this message]
2015-12-18  2:42 ` [PATCH 2/4] soc: mediatek: To move power control logic to ARM TF Fan Chen
2015-12-18  2:42 ` [PATCH 3/4] arm64: dts: mediatek: Add cluster sleep support on MT8173 Fan Chen
2015-12-18  2:42 ` [PATCH 4/4] arm64: dts: mediatek: Improve cpuidle latency " Fan Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450406551-1741-2-git-send-email-fan.chen@mediatek.com \
    --to=fan.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).