From patchwork Fri Dec 18 02:42:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fan.chen@mediatek.com X-Patchwork-Id: 58631 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp752615lbb; Thu, 17 Dec 2015 18:59:25 -0800 (PST) X-Received: by 10.98.13.84 with SMTP id v81mr1730793pfi.120.1450407564808; Thu, 17 Dec 2015 18:59:24 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id tw2si20555032pab.238.2015.12.17.18.59.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Dec 2015 18:59:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9lFH-0001aI-Ar; Fri, 18 Dec 2015 02:58:15 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a9l2c-00037Q-Qd; Fri, 18 Dec 2015 02:45:31 +0000 X-Listener-Flag: 11101 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1534741929; Fri, 18 Dec 2015 10:44:46 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Fri, 18 Dec 2015 10:44:44 +0800 From: Fan Chen To: Sascha Hauer , Matthias Brugger , Lorenzo Pieralisi , Mark Rutland Subject: [PATCH 1/4] soc: Mediatek: Create Mediatek SIP call Date: Fri, 18 Dec 2015 10:42:28 +0800 Message-ID: <1450406551-1741-2-git-send-email-fan.chen@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1450406551-1741-1-git-send-email-fan.chen@mediatek.com> References: <1450406551-1741-1-git-send-email-fan.chen@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151217_184511_661661_AD637D1A X-CRM114-Status: GOOD ( 18.11 ) X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Liao , Koro Chen , linux-kernel@vger.kernel.org, Weiyi Lu , Pawel Moll , Ian Campbell , Catalin Marinas , Will Deacon , Flora Fu , Daniel Kurtz , "yt.lee" , Fan Chen , devicetree@vger.kernel.org, Rob Herring , linux-mediatek@lists.infradead.org, Kumar Gala , Yingjoe Chen , Eddie Huang , jens.wiklander@linaro.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Create a generic interface for issuing SIP Service calls which are specified in ARM SMC CALLING CONVENTION. Signed-off-by: Fan Chen --- 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 -- 1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 +#include + +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*/