Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp352829pxb; Thu, 14 Jan 2021 07:31:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxealNXGo/T3mTTEUTJigsx9IkDSW50Mcl5X+5D9bVvls+GA038AvD8O8BY2pI+TZOvyBXM X-Received: by 2002:a17:906:591a:: with SMTP id h26mr5563042ejq.174.1610638278047; Thu, 14 Jan 2021 07:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610638278; cv=none; d=google.com; s=arc-20160816; b=YmIsLezcbERK5pbtKGxJ8xJz4Hs5sRblLKmmSjCRo5NzHZv4/KcfuN9SGZz1xxz3Xw 9F+IqwZnWMsb4Hza3SeYaczIm3rvWM6DaTVVpeaHnI04+oCsD+XGY6RIsXYvqJzsb5ar 7rW/T0R/nrw925XCsParZvQyUaD4ZnsUIcjwfpc+MtglGBe3Ya9+bLKAl9ILFF+K5kF8 h69UlXPpX9+SUDbSxG1ROo1eygjo6XO5A+yT6zm7K/eRbtRk/O/QbV33F5xU50CoA9Kj XLBv2xtJEQi+qEfxrmlAall6hDiE5qbk3bBpNej4VO/64DO839UFGe9iJL82AfGXuke+ Te/w== 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=6AHB9ne7WJYQOIuGS9Ei+KEOmgpCUHnwGd1YIysgAnE=; b=0+zNHjzJMy4nvAP3PEmffxJx0j02w2I5X8ASb0Dzukk3QuuA/EG0q8bZEcE6mM1tlq 4zSI+mapwVxXCIeBz50g/lta5UjOxIWxMP88rQp5yARgB3ury4Vd7dENiPpBcpJ8cNUY tv/IGu1oOKsxRHmHSBSefwdqUDm8IAAobD97As1EQ+Xu7vtDHAAzlv/Ia0UP8e/XPUP/ pP9qFs5uOeh79WyZNTTsFcpBJVE0/uAgYrtOvSp1Kz7UEhPbiKeqFvyfoni52cDWQEjk psKgqmopTS+8uM7nJj/UNFNO8JUbaCdrjef3TOXiqCu3aPi+AqYklgwWexUIpfL08rI3 bEBg== 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 15si2402697ejg.14.2021.01.14.07.30.52; Thu, 14 Jan 2021 07:31:18 -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 S1729338AbhANP3b (ORCPT + 99 others); Thu, 14 Jan 2021 10:29:31 -0500 Received: from mga14.intel.com ([192.55.52.115]:7044 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbhANP3a (ORCPT ); Thu, 14 Jan 2021 10:29:30 -0500 IronPort-SDR: /biz+3lnOHLOpJ4URRA8JMMHPSrlCC5lcxktsKDv7tfJ2VSvCqrFp/F5kvXeuWYgpXIbS63TkX c6/iCXRx96GA== X-IronPort-AV: E=McAfee;i="6000,8403,9864"; a="177604671" X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="177604671" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jan 2021 07:28:43 -0800 IronPort-SDR: t3gUSsbPz4eDs4XJpMxRkNzkvPA3g4Cay+7UOr6avSj8H+sFzbFlU6QOv5GOq1tqGA7EBwKFxH 6Stg8Dmhsclw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,347,1602572400"; d="scan'208";a="568193613" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by orsmga005.jf.intel.com with ESMTP; 14 Jan 2021 07:28:40 -0800 From: Muhammad Husaini Zulkifli To: ulf.hansson@linaro.org, broonie@kernel.org, lgirdwood@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, adrian.hunter@intel.com, michal.simek@xilinx.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: andriy.shevchenko@intel.com, Rashmi.A@intel.com, mahesh.r.vaidya@intel.com, muhammad.husaini.zulkifli@intel.com Subject: [PATCH v1 5/9] firmware: keembay: Add support for Trusted Firmware Service call Date: Thu, 14 Jan 2021 23:26:56 +0800 Message-Id: <20210114152700.21916-6-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210114152700.21916-1-muhammad.husaini.zulkifli@intel.com> References: <20210114152700.21916-1-muhammad.husaini.zulkifli@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Andy Shevchenko --- include/linux/firmware/intel/keembay.h | 82 ++++++++++++++++++++++++++ 1 file changed, 82 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..f5a8dbfdb63b --- /dev/null +++ b/include/linux/firmware/intel/keembay.h @@ -0,0 +1,82 @@ +/* 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 KEEMBAY_IOV_1_8V_uV 1800000 +#define KEEMBAY_IOV_3_3V_uV 3300000 + +#define KEEMBAY_SET_SD_VOLTAGE_ID 0xFF26 +#define KEEMBAY_GET_SD_VOLTAGE_ID 0xFF2A + +#define ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + ARM_SMCCC_OWNER_SIP, \ + KEEMBAY_SET_SD_VOLTAGE_ID) + +#define ARM_SMCCC_SIP_KEEMBAY_GET_SD_VOLTAGE \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + ARM_SMCCC_OWNER_SIP, \ + KEEMBAY_GET_SD_VOLTAGE_ID) + +#define KEEMBAY_REG_NUM_CONSUMERS 2 + +struct keembay_reg_supply { + struct regulator *consumer; +}; + +#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_set_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); + + return res.a0; +} + +static inline int keembay_get_io_rail_supplied_voltage(void) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_invoke(ARM_SMCCC_SIP_KEEMBAY_GET_SD_VOLTAGE, &res); + + return res.a1; +} +#else +static inline int keembay_set_io_rail_supplied_voltage(int volt) +{ + return -ENODEV; +} + +static inline int keembay_get_io_rail_supplied_voltage(void) +{ + return -ENODEV; +} +#endif + +#endif /* __FIRMWARE_KEEMBAY_SMC_H__ */ -- 2.17.1