Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp658956imj; Wed, 13 Feb 2019 15:09:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IaLps47hrJGm8TuPYNsH89pSVtmukylK7KpKM4p7Dpa8gSoQVC/itVBDG6o0ONcY9Fs4DyN X-Received: by 2002:a63:1b49:: with SMTP id b9mr133336pgm.112.1550099364575; Wed, 13 Feb 2019 15:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550099364; cv=none; d=google.com; s=arc-20160816; b=lTOJPiWuPQN0gag3+rfYEOqmE7zqKZJ9snWoZtHL5SFoBbCRjt2zERnWbkP1mh3Yry CkpO2ECoTZLsa6/W2ddlzqwZaj6pBpoViTD7xI+MgpaL7VHXydZvojZ/1DWM36YjfhBQ VeopYFms0m8TGgbLFL1vdWpiO+5BDUpgovk/4txCppnZJ5QCZTQGhFrgte5ykZq9XFAi ouk6I8dTFAeU9ELvmnBkyPZKK2DXIhHhHZLP8CDnW52o5Oc1K5hoYGMlMhPdCee9zkyN Y2JTWv5A58ZEpIMlW963Dik5lUNwB4mmuhPiekdg3I0i+3I/pByjOs9wtxkKr2s7nB7U lh4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:from:cc:references:message-id :subject:user-agent:in-reply-to:to:content-transfer-encoding :mime-version:dkim-signature; bh=pEo+RVrH9wA5emzNlNTU+R3MY7Lk+ndErgpWoMolHBk=; b=WINoxuj6Zd4U1Wu/fNPxIi6X3EPWFtr9mYzeOI+TeajNqv9FKIKKe4HDXo97bF9Ym3 HcAs1oKhJevAvb/lgk/Sqdsmgdgll9Blcx0DX5lOeX7TAWWGMHERvUmO5RYMd58yBuI5 EbCV0GnR6EmNjQloevcs/Dl+bIAYTU7zAHDwPkDZLdavC5/RP/OF6GqFwMbrft/fC7DJ 9Uc/KhJdL8Bb4rJjft5yxYeTcMU1cDJXcpmYC0J7x+etRyo7WhNUfiiGkK+gMyiGUuXU fNc5BXsY1ABLsbeDtawsuFzAIPPnFg/dgyj02LhI5VhhAWsKhUMCQS0vdU7uzh2t8vnG HAcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oxJpZinK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si619668pfe.74.2019.02.13.15.09.08; Wed, 13 Feb 2019 15:09:24 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=oxJpZinK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390823AbfBMRm6 (ORCPT + 99 others); Wed, 13 Feb 2019 12:42:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:37294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730494AbfBMRm6 (ORCPT ); Wed, 13 Feb 2019 12:42:58 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A34D20700; Wed, 13 Feb 2019 17:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550079777; bh=8/a6GqEt6IT+kCPU/DD4c6vSzGl+dSgpHTaX8RXnqr4=; h=To:In-Reply-To:Subject:References:Cc:From:Date:From; b=oxJpZinKS2N45QtSrCM9rsIGt2314DzJ/uiBNjioVEzC7Ndm2NZxLbyQiaZHOAxIY 3SNsKq49ZQXqcjZUe4HcmiE085f2ytnPehwdBtc5ZpD/uO6yjMRJfVYSV+n9wRb+u3 ZEDxworNAcBcZ/x170y1BbLh1LjykvNTmDKeYpdo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: "devicetree@vger.kernel.org" , "festevam@gmail.com" , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , "linux-clk@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "mark.rutland@arm.com" , "mturquette@baylibre.com" , "robh+dt@kernel.org" , "s.hauer@pengutronix.de" , "shawnguo@kernel.org" , "viresh.kumar@linaro.org" , Aisheng Dong , Anson Huang , Daniel Baluta In-Reply-To: <1550073243-11242-2-git-send-email-Anson.Huang@nxp.com> User-Agent: alot/0.8 Subject: Re: [PATCH V3 2/2] clk: imx: scu: add cpu frequency scaling support Message-ID: <155007977634.115909.4465011219844819801@swboyd.mtv.corp.google.com> References: <1550073243-11242-1-git-send-email-Anson.Huang@nxp.com> <1550073243-11242-2-git-send-email-Anson.Huang@nxp.com> Cc: dl-linux-imx From: Stephen Boyd Date: Wed, 13 Feb 2019 09:42:56 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Anson Huang (2019-02-13 07:59:32) > @@ -145,6 +161,39 @@ static long clk_scu_round_rate(struct clk_hw *hw, un= signed long rate, > return rate; > } > =20 > +static bool clk_scu_atf_set_cpu_rate(struct clk_hw *hw, unsigned long ra= te) > +{ > + struct clk_scu *clk =3D to_clk_scu(hw); > + struct arm_smccc_res res; > + unsigned int cluster_id; > + int i; > + > + /* CPU frequency scaling can ONLY be done by ARM-Trusted-Firmware= */ > + if (clk->clk_type =3D=3D IMX_SC_PM_CLK_CPU) { > + for (i =3D 0; i < ARRAY_SIZE(imx_sc_cpufreq_data); i++) { > + if (!strcmp(clk_hw_get_name(hw), > + imx_sc_cpufreq_data[i].clk_name)) { > + cluster_id =3D imx_sc_cpufreq_data[i].clu= ster_id; > + break; > + } > + } Is there some reason why these clks can't be determined once at boot time? It would be a good idea to avoid doing any sort of string comparison here, instead just calling the right arm_smccc_smc with the right arguments based on code that registers those types of clks.