Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp89054img; Wed, 20 Mar 2019 14:51:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbfgYr3loVJaKf5TIkGEUTopyhKn5CAxW5gzILEfW+y8Yf7T/wHDAaJOJ3jFAggKA9dyLi X-Received: by 2002:a17:902:a81:: with SMTP id 1mr16010plp.308.1553118663030; Wed, 20 Mar 2019 14:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553118663; cv=none; d=google.com; s=arc-20160816; b=sv8Olsyuyb8TJAFxyYKLRrk0KczDH7vuGp5tbP93lnfTZzQ4Eda33TqlKL+C65mR7v rjMxypRGSuWY4eJHdpteJ0z9xDH4t+ARVtzbsterlMJX6Z/txUV1gmdaMq8G1QcGfMfu MtHMXxw2ZezySWt9eHPP6uJoECY5yCb4l5EJdFm4JMAAjucFe5Er67Los/SXN/QcDisu s2OOiuJhv65SIzFgPHnkYShugw0ZmXO2D40yQNHH/7OiSFOR28DwAldQzymcqJEa+wvz cX2JDyvxyO0wQA5tZCTp9jiN/ld1rplt0qBLKCa4GUWrxqebzqA9Z+7Nd4/AU9iPUsi8 r4Uw== 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=og98OQD0MFrXjQhrvWCzzD31iNovzuI0BMrb4Ibebk8=; b=grDbuv5WA1j21ny/Ew30w2VhR1WeaCEmugY3+QWzHWNPJOCzDOYTPdk+2qgM1XWiyq Vtt8lNmr3TTkR/gjoDYDXEFzOIe2mrOxjc/KUb6x7leVyCEtw8OigYSInbZyCK5ZTbyP 8pUe+RT3zzdH4+7h/g2+58DXMR3KiDAmz5Z6clS9bSWbYTkUxoJXNFgtIPr/m8NLD5TW aZDDXNBiv92rsO47pNbbjDW/ZlFpkE29DBRsOKTiTZECId7uexfhQz+Rgm1Oc7WtqDJd 5onoxOlYNHB/QA4ILb2EwiNYRdnySKg7WLQkoOkhXM1GdoZLzjDb7+bRL8jYK1tO0JG0 LxvQ== 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 d4si2488567pgk.501.2019.03.20.14.50.47; Wed, 20 Mar 2019 14:51:03 -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 S1727575AbfCTVuF (ORCPT + 99 others); Wed, 20 Mar 2019 17:50:05 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:45914 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727116AbfCTVuF (ORCPT ); Wed, 20 Mar 2019 17:50:05 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gportay) with ESMTPSA id 2DCB72817E9 Date: Wed, 20 Mar 2019 17:50:13 -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 , Rob Herring , linux-kernel@vger.kernel.org, Chanwoo Choi , Kyungmin Park , MyungJoo Ham , Klaus Goger , 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: <20190320215013.43zgvyn5frnb3yud@archlinux.localdomain> References: <20190319181323.22804-1-gael.portay@collabora.com> <20190319181323.22804-4-gael.portay@collabora.com> <20190320003352.GN112750@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190320003352.GN112750@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 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. Also, the call takes around 300us. > > ... > > @@ -334,6 +357,34 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) > > return ret; > > } > > > > + /* Try to find the optional reference to the pmu syscon */ > > + node = of_parse_phandle(np, "rockchip,pmu", 0); > > + if (node) { > > The 'optional' part doesn't seem to be accurate: according to the > binding (https://lore.kernel.org/patchwork/patch/1052322/) the > property is required and the code below assumes that data->regmap_pmu > is set. > Indeed. > > + data->regmap_pmu = syscon_node_to_regmap(node); > > + if (IS_ERR(data->regmap_pmu)) > > + return PTR_ERR(data->regmap_pmu); > > + } > > + > > + /* Get DDR type */ > > nit: the comment doesn't add much value, thanks to good variable > naming this is evident from the code. > > > + regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); > > + ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) & > > + RK3399_PMUGRF_DDRTYPE_MASK; > > + > > + /* Get the odt_dis_freq parameter in function of the DDR type */ > > nit: ditto > > (if you prefer to keep these comments I'm not opposed to keeping them, > but I don't think they are needed) > I will remove all the comments in the v3. > Cheers > > Matthias > > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip Regards, Ga?l