Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp650482pxu; Tue, 1 Dec 2020 23:06:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxizA27IIv8kuSbXVHLtuGPB/w+Up1ZZ2gaWXffYhym8QKs2BmulyaZL+eJn4v3M2SwMQAw X-Received: by 2002:a05:6402:b8e:: with SMTP id cf14mr1303038edb.86.1606892777499; Tue, 01 Dec 2020 23:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606892777; cv=none; d=google.com; s=arc-20160816; b=PoewXQOCmZNXv9mrO3HhsVUdp3Knq2JMlCVyYayXF+6btHUBE0spMxaEZSerKj5EXI zE7mWG9R1OJrwdyWh/UwV9yqUzCOtPcu5AKGgWISegfNfMYjaIaM4sr7UZ+CWkXjMx+9 y3dmP4RF1nwQe7Wjj+eCqi41pe4GcPCVR6p0TeTpfkm2pzX7QutSHYB/yUpqiRIOm/Z7 CjAxUW4Y/fVYCWawlnLc6WKAaUHdxHZCvT+Mc/3Th8UK6FlcAIz7y8dMDVDKW/mGP3Ng LS7UyjZ/D5NFulV7K4s3MqPfGh0SYEcfzqCYQPXQnn+wmiUpQD8XRw0tc10/ij6k0Ui8 bYMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=8rwBqeL/EQAAhfw8330Za2yyccBBQ/R/QWn/uCE+UVM=; b=ZrEb3rMdCT3sU5yoxwlHXRkV68wJNy87eF4dPzBKbJluhSDiAxepIzyQ9JiIAGTXjA 2F0+glexdbRQv4DT7P8z7mt61oUPPI1Uw91fSAotuHDwkXQ+qv3tVev1C+jdbRt1+x6o CJP8/jJLTs7UAkfvCrosypnagucpXUVXxVJtmZus6YrBsj5oBDlR4phNETEYSiz67Lfl xZyG2AwN74lb28q/Xe02E1fVufiy7bZdmhG/fNzMuXZidd0Ee3RuWj/WCpGoqRXfIU+O vSOqsD3WAugh+OeS0QhfqcsS7kKO4BgH8NIV8dM8+A1XYUntJrNk+VA6FcDoH1hqoKFg TQZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go40si354174ejc.141.2020.12.01.23.05.53; Tue, 01 Dec 2020 23:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387592AbgLBHDY (ORCPT + 99 others); Wed, 2 Dec 2020 02:03:24 -0500 Received: from mga11.intel.com ([192.55.52.93]:44053 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387511AbgLBHDX (ORCPT ); Wed, 2 Dec 2020 02:03:23 -0500 IronPort-SDR: gi3F/nHIkVLVGvxzwGKumLfWf1ijjD3JdGFA+/BDFLmILerdpCaMuKUkqGQft75Ye1BT616/UY /hQIjy7fHreQ== X-IronPort-AV: E=McAfee;i="6000,8403,9822"; a="169461819" X-IronPort-AV: E=Sophos;i="5.78,386,1599548400"; d="scan'208";a="169461819" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 23:02:40 -0800 IronPort-SDR: xGCi6diPNCBrGM35qkldCzqGw+ThAG9oKKVcLhKfCinmU4DENwHx9uBRVI+YMEwOty3TCYAgVY aEJKlbsDk4fA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,386,1599548400"; d="scan'208";a="481430026" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by orsmga004.jf.intel.com with ESMTP; 01 Dec 2020 23:02:38 -0800 From: muhammad.husaini.zulkifli@intel.com To: ulf.hansson@linaro.org, adrian.hunter@intel.com, michal.simek@xilinx.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: andriy.shevchenko@intel.com, lakshmi.bai.raja.subramanian@intel.com, wan.ahmad.zainie.wan.mohamad@intel.com, muhammad.husaini.zulkifli@intel.com, mgross@linux.intel.com Subject: [PATCH v6 2/4] firmware: keembay: Add support for Trusted Firmware Service call Date: Wed, 2 Dec 2020 23:02:02 +0800 Message-Id: <20201202150205.20150-3-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202150205.20150-1-muhammad.husaini.zulkifli@intel.com> References: <20201202150205.20150-1-muhammad.husaini.zulkifli@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Muhammad Husaini Zulkifli Export inline function to encapsulate AON_CFG1 for controling the I/O Rail supplied voltage levels which communicate with Trusted Firmware. Signed-off-by: Muhammad Husaini Zulkifli Acked-by: Michal Simek Acked-by: Sudeep Holla --- include/linux/firmware/intel/keembay.h | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 include/linux/firmware/intel/keembay.h diff --git a/include/linux/firmware/intel/keembay.h b/include/linux/firmware/intel/keembay.h new file mode 100644 index 000000000000..b5e3e490807e --- /dev/null +++ b/include/linux/firmware/intel/keembay.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Intel Keembay SOC Firmware API Layer + * + * Copyright (C) 2020, Intel Corporation + * + * Author: Muhammad Husaini Zulkifli + */ + +#ifndef __FIRMWARE_KEEMBAY_SMC_H__ +#define __FIRMWARE_KEEMBAY_SMC_H__ + +#include + +/* + * This file defines an API function that can be called by a device driver in order to + * communicate with Trusted Firmware - A profile(TF-A) or Trusted Firmware - M profile (TF-M). + */ + +#define KEEMBAY_SET_1V8_IO_RAIL 1 +#define KEEMBAY_SET_3V3_IO_RAIL 0 + +#define IOV_1V8 1800000 +#define IOV_3V3 3300000 + +#define ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + ARM_SMCCC_OWNER_SIP, \ + 0xFF26) + +#if IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) +/* + * Voltage applied on the IO Rail is controlled from the Always On Register using specific + * bits in AON_CGF1 register. This is a secure register. Keem Bay SOC cannot exposed this + * register address to the outside world. + */ +static inline int keembay_io_rail_supplied_voltage(int volt) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_invoke(ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE, volt, &res); + if ((int)res.a0 < 0) + return -EINVAL; + + return 0; +} +#else +static inline int keembay_io_rail_supplied_voltage(int volt) +{ + return -ENODEV; +} +#endif +#endif /* __FIRMWARE_KEEMBAY_SMC_H__ */ -- 2.17.1