Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1937540pxb; Mon, 18 Jan 2021 04:08:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9xS7l5Ssd5gFImGvF0ShJpsw6J77NCfNBWGj+vnvga+FKGkZ4WPMJ6nLkEk7qmUYaoezV X-Received: by 2002:a17:906:6bca:: with SMTP id t10mr8011267ejs.35.1610971685456; Mon, 18 Jan 2021 04:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610971685; cv=none; d=google.com; s=arc-20160816; b=vjdpT4emmTBjNg3CmkNybEmCB0UFSCwkK/xaTlCbGKSGdKg1o3WGSHgfHk0F63g4fE vSsCJwoIvf6DHEUD4XUm0Y2PNXkuZnlKuqYmgjublZEJmRw4IrOmsnqYTrCdt6VF8vg5 dFOjY9ikGEPAX86wmoKYxHnzxOm5OIl8duEmdD36B/V5fs8ywzUei6cEJctSQMAilQwV uB6TXAQ1pbElaFBBaKSIHEhPJct+91mqv0u4D4T3J6FwboNQwiM+owSPBRtfKsS7wyxt kU+qXYLD68/t4oz2xZVDZGOkNChsIbGnZjiIlQnM7W/VuUk4zPzmDt3pCsNX2nk1LGmF Snwg== 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=1ixELFKUdY8zJiTowSCeH43hCFQh8c0viIsEpkJMjmg=; b=GL722dUTZ0Oto65oQ75ObH6V2R3zwyphVUtXUbSX2dn2H+4rARpAveiE3qJhNFKU/d pBfcBLwtdJBWws4ItFXul8SK3mfhh/3hCKZ23bDaf7VL+rfXLmMTu3av1k+dJJuQI6Qr ZONTD7fKyvjr9HVeeOu/o4/+oAufdA+Oo1+xXueseFMP28itud21wzg3+n41mMsYsmER nTzgDacbQBdKJKKSe0xipEW+CykFjGx1P9ogds7HBgDnzkp6iWA6pyan90tsJb/qnrz3 KHdLPLhmBM6jUjsf9NY7pIFKXtJhQ6+iA9csFz0mHn5jY0dCXmznHYjLkGpkTWcxpeOD W32A== 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 b7si2530007edr.115.2021.01.18.04.07.41; Mon, 18 Jan 2021 04:08:05 -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 S2403828AbhARMEb (ORCPT + 99 others); Mon, 18 Jan 2021 07:04:31 -0500 Received: from foss.arm.com ([217.140.110.172]:34146 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390943AbhARL4X (ORCPT ); Mon, 18 Jan 2021 06:56:23 -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 ABEB331B; Mon, 18 Jan 2021 03:55:35 -0800 (PST) Received: from bogus (unknown [10.57.35.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 948B53F719; Mon, 18 Jan 2021 03:55:33 -0800 (PST) Date: Mon, 18 Jan 2021 11:55:31 +0000 From: Sudeep Holla To: "Zulkifli, Muhammad Husaini" Cc: 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" , "i A, Rashmi" , Cristian Marussi , "Vaidya, Mahesh R" Subject: Re: [PATCH v1 5/9] firmware: keembay: Add support for Trusted Firmware Service call Message-ID: <20210118115531.er5tih7k2faig5cr@bogus> 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: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > That's correct. Since the platform uses SCMI and SCMI spec[1] supports Voltage protocol and there is upstream driver[2] to support it, I see no point in duplicating the support with another custom/non-standard solution. > >> > > > >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? > Mark has already pointed you to the binding document[3] > > > >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. > Yes, it should be easy to extend the implementation and add support for voltage protocol. If you still face any issues, please ask any queries on the list cc-ing me and Cristian Marussi(cc-ed) -- Regards, Sudeep [1] https://developer.arm.com/documentation/den0056/latest [2] drivers/firmware/arm_scmi/voltage.c + drivers/regulator/scmi-regulator.c [3] Documentation/devicetree/bindings/arm/arm,scmi.txt