Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1940057pxb; Mon, 18 Jan 2021 04:12:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8h6Z3Z/CfmnJTbYhNoYYOFCPtjBfIUYJwZv4MwDi0e2TexMlHubJfGBSi+/TUUGrd4OFi X-Received: by 2002:a17:906:3781:: with SMTP id n1mr17050664ejc.296.1610971924600; Mon, 18 Jan 2021 04:12:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610971924; cv=none; d=google.com; s=arc-20160816; b=j5012jxq1CJjrf3z9il3fK+tBKbVe2VBRDjFPjp8/ZlNesLXYHAV1Rur+veZTk/vPL oGitzCRKnCRv9E+aiweF1CAN/4jAjn3qOL0deHYbxBN5qBwHjmv2TDmLh/DEphrNVdL1 nf1Y+11uwG+nR+t4wu1z21ws8NM1KgixiNkaKU9SflB4hQAt7MYxPcUHMf81B0jaLTFt pVYi+6UFrLdVQvtXL2vUDNiVB+Ssjf/Hg6MIt+XHniwpUWw5MQPHSsS38OkyvJ4kHzMQ Dh4W1nuiXWIS/VZMF6EVZyFED8BNAEC5MAMSvMJMLfq5w8Lca8P+auib5vPL1ezFudOC ehBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=az18oYlQs8RPXnyLtpr+a4ZJ76/eVysG4ixnfJBk4Nk=; b=SdLG3c1W6qqgo+SdVfEIWgj8NVvShB3d/iKB10WvhCME2K4QIllowllaH64nTK4lsp mjhAQ1r7GpbUxa4HNhffNCBBQRn4XUhyb5r8v+vPLkL4oAgL0rL2y1fR59wgoP9pUNLI QRhpsg6AjpkfhKS/I8MOhTGFUeQoFxAbmrF5P27SC42WMp0OWq30j7D4CTqe+bxtz936 +oOIx+vhLQXf/CbcMHLnDnYpB6f1qCxBQChqA5T4APoika8zgrZao+tQV9yuknSqJq1R HOD8tadknH1h5GSUW83SMlnvnrqoognWISClfNdofWwojD+GCqbooyNoyXiFBldqPzjx JkAA== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si6895521ejf.621.2021.01.18.04.11.40; Mon, 18 Jan 2021 04:12:04 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403964AbhARMGN (ORCPT + 99 others); Mon, 18 Jan 2021 07:06:13 -0500 Received: from foss.arm.com ([217.140.110.172]:34258 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403824AbhARMCe (ORCPT ); Mon, 18 Jan 2021 07:02:34 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E77A31B; Mon, 18 Jan 2021 04:01:37 -0800 (PST) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 39A3F3F719; Mon, 18 Jan 2021 04:01:35 -0800 (PST) Date: Mon, 18 Jan 2021 12:01:32 +0000 From: Cristian Marussi To: "Zulkifli, Muhammad Husaini" Cc: Sudeep Holla , Mark Brown , "ulf.hansson@linaro.org" , "lgirdwood@gmail.com" , "robh+dt@kernel.org" , "devicetree@vger.kernel.org" , "Hunter, Adrian" , "michal.simek@xilinx.com" , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Shevchenko, Andriy" , "A, Rashmi" , "Vaidya, Mahesh R" Subject: Re: [PATCH v1 5/9] firmware: keembay: Add support for Trusted Firmware Service call Message-ID: <20210118120132.GC25035@e120937-lin> References: <20210114152700.21916-1-muhammad.husaini.zulkifli@intel.com> <20210114152700.21916-6-muhammad.husaini.zulkifli@intel.com> <20210114164811.GG4854@sirena.org.uk> <20210115185803.infufa4thlffagxk@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi sorry I'm a bit late on this. On Mon, Jan 18, 2021 at 10:28:33AM +0000, Zulkifli, Muhammad Husaini wrote: > Hi Sudeep and Mark, > > Thanks for the review. I replied inline. > > >-----Original Message----- > >From: Sudeep Holla > >Sent: Saturday, January 16, 2021 2:58 AM > >To: Mark Brown > >Cc: Zulkifli, Muhammad Husaini ; > >ulf.hansson@linaro.org; lgirdwood@gmail.com; robh+dt@kernel.org; > >devicetree@vger.kernel.org; Hunter, Adrian ; > >michal.simek@xilinx.com; linux-mmc@vger.kernel.org; linux- > >kernel@vger.kernel.org; Shevchenko, Andriy > >; A, Rashmi ; Vaidya, > >Mahesh R ; Sudeep Holla > > > >Subject: Re: [PATCH v1 5/9] firmware: keembay: Add support for Trusted > >Firmware Service call > > > >On Thu, Jan 14, 2021 at 04:48:11PM +0000, Mark Brown wrote: > >> On Thu, Jan 14, 2021 at 11:26:56PM +0800, Muhammad Husaini Zulkifli > >wrote: > >> > Export inline function to encapsulate AON_CFG1 for controling the > >> > I/O Rail supplied voltage levels which communicate with Trusted Firmware. > >> > >> Adding Sudeep for the SMCCC bits, not deleting any context for his > >> benefit. > >> > > > >Thanks Mark for cc-ing me and joining the dots. I completely forgot about that > >fact that this platform was using SCMI using SMC as transport. Sorry for that and > >it is my fault. I did review the SCMI/SMC support for this platform sometime in > >June/July last year and forgot the fact it is same platform when > >voltage/regulator support patches for SD/MMC was posted sometime later last > >year. I concentrated on SMCCC conventions and other details. > > Yes Sudeep. I redesigned the way I handle the smccc call. Previously it was handled directly in mmc driver. > After few discussion, we conclude to create an abstraction using regulator framework to encapsulate this smccc call > during set voltage operation. Using standard abstraction will make things easier for the maintainer. > > > > >[...] > > > >> > +#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_VOLTA > >GE, volt, > >> > +&res); > >> > >> There is a SCMI voltage domain protocol intended for just this use > >> case of controlling regulators managed by the firmware, why are you > >> not using that for these systems? See drivers/firmware/arm_scmi/voltage.c. > > From mmc maintainer's perspective, I should use the common modelling either using > regulator framework or pinctrl to perform voltage operation. Not just directly invoke > smccc call in the mmc driver. That is why I came up with this regulator driver to perform > voltage operation. > There is an SCMI regulator driver built on top of SCMIv3.0 Voltage Domain Protocol, so as long as your SCMI platform firmware support the new VD protocol you should be able to wire up a generic SCMI regulator in the DT (as described in the arm,scmi.txt bindings) and then just use the usual regulator framework ops with such SCMI regulator without the need to add a custom regulator using custom SMCCC calls). Thanks Cristian > >> > > > >Indeed. Please switch to using the new voltage protocol added for this without > >any extra code. You just need to wire up DT for this. > > May I know even if I wire up the DT, how should I call this from the mmc driver > For set/get voltage operation? Any example? > > > > >Just for curiosity, where is SCMI platform firmware implemented ? On Cortex- > >A, secure side or external processor. Does this platform run TF-A ? > > The KMB SCMI framework is implemented in secure runtime firmware (TF-A BL31). > Hopefully I am answering your question. > > > > >-- > >Regards, > >Sudeep