Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp140807img; Thu, 21 Mar 2019 16:11:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmKHA50lfZNbv6zN6PAhcqgQAEAmUGsTlMXzCD6qXNi3QuQbIVOYVOt4l85TMRjtPJ5mlq X-Received: by 2002:a63:f146:: with SMTP id o6mr5707032pgk.360.1553209903080; Thu, 21 Mar 2019 16:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553209903; cv=none; d=google.com; s=arc-20160816; b=bEpK6Ox8iHYAqp+WFmzt5qaWotE9ht5yTGdaVMX9chOen83FQWlC92Lln/cMUpZRnD VlBGTqDmjgO7qMrAaVaqvRg/QlmbMqHoEpdBIu+tb48Kn8m4+DRnixyPGW2neJr80NtO QV8ouwdVboPhKMUccu9v5s1r2C6vTWL57GxN+5CssaEIqRDVc48v5sQaizNWEto+XAGs YccO+fxshNjBcuDXeU4t9JzajkUSUKv0E+HPKe4fL18Q+TG4ePj2LRFuzxqIeupg+L+V R0R/Ru9O6MESeum0frZxU+wlCv3IIFb9es9Iv4PsRYQRBMh7MnrdnX8RoM6vW9qtoW/t ue6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OhLC0ynbPBLqgQkW+MMxp+ir55t0z+KzTujLWzgStMU=; b=RyB8umOhUyu2cA22O/PH5Pb6/RIXPXy5IzlAlyue9Q9H66RWWHlL/bgU1pqZpZOPF+ AZS50mEl2sQFrExZ4LZHrmU/nImKp3PMG9x0Y/KcMC9bfVO3WINTQ87wq7snSpFA3tcI 2EQ7OY1zWCGnF0Kt3MtBx6a58jgQ1doxdYiAOPDIk+kv/YzC/A8xkwHyMxYeY0dERDJv rmiRycMvmFg5ryymkcXnyln2sStXpxaQ6DRcyo4RK7CqoAJC8O1MwFp45rgRwDIINxEq fuemOeFABviwhQeJQ03G7EY3+pyIMerruMXCTCSWt/a8XnjdTandwMxEK6ReviVzN+PE rIAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si5006528pgo.80.2019.03.21.16.11.27; Thu, 21 Mar 2019 16:11:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727375AbfCUXKs (ORCPT + 99 others); Thu, 21 Mar 2019 19:10:48 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51566 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbfCUXKr (ORCPT ); Thu, 21 Mar 2019 19:10:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gportay) with ESMTPSA id DC14228198C Date: Thu, 21 Mar 2019 19:10:55 -0400 From: =?utf-8?B?R2HDq2w=?= PORTAY To: Matthias Kaehlcke Cc: Mark Rutland , devicetree@vger.kernel.org, Derek Basehore , Heiko Stuebner , linux-pm@vger.kernel.org, Brian Norris , Douglas Anderson , linux-kernel@vger.kernel.org, Chanwoo Choi , Kyungmin Park , Rob Herring , Klaus Goger , MyungJoo Ham , Enric Balletbo i Serra , linux-rockchip@lists.infradead.org, Randy Li , kernel@collabora.com, linux-arm-kernel@lists.infradead.org, Lin Huang Subject: Re: [PATCH v2 3/5] devfreq: rk3399_dmc: Pass ODT and auto power down parameters to TF-A. Message-ID: <20190321231055.j7z23f3k3rcngq4u@archlinux.localdomain> References: <20190319181323.22804-1-gael.portay@collabora.com> <20190319181323.22804-4-gael.portay@collabora.com> <20190320003352.GN112750@google.com> <20190320215013.43zgvyn5frnb3yud@archlinux.localdomain> <20190320220223.GP112750@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190320220223.GP112750@google.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Matthias, On Wed, Mar 20, 2019 at 03:02:23PM -0700, Matthias Kaehlcke wrote: > Hi Ga?l, > > On Wed, Mar 20, 2019 at 05:50:13PM -0400, Ga?l PORTAY wrote: > > Hi Matthias, > > > > On Tue, Mar 19, 2019 at 05:33:52PM -0700, Matthias Kaehlcke wrote: > > > ... > > > > @@ -95,6 +103,19 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, > > > > > > > > mutex_lock(&dmcfreq->lock); > > > > > > > > + if (target_rate >= dmcfreq->odt_dis_freq) > > > > + odt_enable = true; > > > > + > > > > + /* > > > > + * This makes a SMC call to the TF-A to set the DDR PD (power-down) > > > > + * timings and to enable or disable the ODT (on-die termination) > > > > + * resistors. > > > > + */ > > > > + arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, > > > > + dmcfreq->odt_pd_arg1, > > > > + ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, > > > > + odt_enable, 0, 0, 0, &res); > > > > > > Is it necessary/desirable to make this call for every frequency > > > change? IIUC it should be only needed when odt_enable changes and the > > > driver could track the state. If the DDR frequency doesn't change too > > > often and the overhead of the call is small it shouldn't be really > > > important though. > > > > > > > I will test your solution first to make sure there is no regression to > > run that call for frequency change only. > Oops, I wanted to say when odt_enable changes since last call. > If there is no frequency change the function returns at the > beginning. My suggestion was to only do the call when 'odt_enable' > changes, i.e. when a change (up or down) passes the 'odt_dis_freq' > threshold. > So, for a reason that I ignore, if we try to save unecessary calls to ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD (odt_enable has not changed since last call), we get stalled in the call to ROCKCHIP_SIP_CONFIG_SET_RAGE that follows. The function arm_smccc_smc never returns and the device hard hang. Thanks to your remark, I have also fixed an issue with the odt_dis_freq value. Its value is initialized to 0 in the probe function. Thus the odt_enable is always true (target_rate > 0). I moved its initialization after the timings are parsed from the device-tree; its value is now none zero (333000000 in my case). > > Also, the call takes around 300us. > > Thanks for the info! > > Matthias > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip Ga?l