Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3063744pxk; Mon, 7 Sep 2020 02:00:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxt691riZBhQsLbn7y/yKp6hnCGelCGlvjRI1HJjeTTjXDN+I0cVaTVIUZ6+xIb4tzgr/O X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr21454732edt.186.1599469243091; Mon, 07 Sep 2020 02:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599469243; cv=none; d=google.com; s=arc-20160816; b=j3++iECSH+SD0+G+drakFqFx5ybfewR/2g4z/McL3YDllW6dvQ7MqVtEjZOQ87TCzt ytY7WVQGXt3xGqaykGQ5avQJjjTAPvitpkpqjDUpfuKkWepIf4tNJwsblXntTccpkxDG gwaesMx0tLTHPXR4vpNozv85+2UH4PVYys3FIYSoe9CE1FEMKupTrMYAAxCXhKJAonRQ 5IwZltziM/Kd9c+pJJbQhQGSuvzMTkpVCir7v7dI3VWhv5CK/FsEH5X+jhs8bIcEuKsB 5FQ+2TzmilpXRxcWqKrmdR95futd+blUcESRZoHqGPQEuk6Bx6w0yueYnZRUHxLvDOky Sy4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=NPu83n18eUWOYpHbYTl7Ayra0VWy1PJnb+/c14e0kJU=; b=ROkvLpEZ9SP7j8hKbzrw4xhf7KAbnY7Mpg+OQ1aL8949WeKxBCQHYq5ZMJ3c7a+7sL /PQCROi9+Kihtr+XIXNU+wQACySEOGg1+78X+FygprnFxUNkOwFbmuZkyE84fNta2PVy IH/trgbFjU03z7jxnhjc51kMcyvSJ/IWiuGO9ntYJRxq8a0hu/0CO9twLjZfzPDvDWdC 4Gn9IJS9bAK5nFeFY6tQAWuErC322YxPXGWwhE+pyZiYTCbE2MnXGwPvfd/jkz6qE3dk Tdi05ANa9Qc4pLAMMbiOoOIjQklpkRN0EYvL+uI4Hp2Xpz8+/ofWtK510Fl1okOKlh48 LT5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=k7Tw9jr7; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si10429018eji.313.2020.09.07.02.00.20; Mon, 07 Sep 2020 02:00:43 -0700 (PDT) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=k7Tw9jr7; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728284AbgIGI6j (ORCPT + 99 others); Mon, 7 Sep 2020 04:58:39 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:40996 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728292AbgIGI6Y (ORCPT ); Mon, 7 Sep 2020 04:58:24 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0878wIkg058766; Mon, 7 Sep 2020 03:58:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1599469098; bh=NPu83n18eUWOYpHbYTl7Ayra0VWy1PJnb+/c14e0kJU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=k7Tw9jr7NzsQrTJ1MZ04dyzaJ2WUrc9Lbjw3JZU1TljcQx4ZbF8edBsYQg4qIeWQi YBONgxTyVV/cJ9TRYoMPxTgwoGMcpdlOcjaH6uj6e/B/bnrx3vXmznJsO0ZRl1ly/w nyicv8BVmS0yjqSFMyqDSsaAGqcxHdoqDWb0VrzA= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0878wIYc095061 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 7 Sep 2020 03:58:18 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 7 Sep 2020 03:58:18 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 7 Sep 2020 03:58:18 -0500 Received: from sokoban.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0878wBau040828; Mon, 7 Sep 2020 03:58:17 -0500 From: Tero Kristo To: , , CC: , Subject: [PATCH 3/3] clk: keystone: sci-clk: add 10% slack to set_rate Date: Mon, 7 Sep 2020 11:57:40 +0300 Message-ID: <20200907085740.1083-4-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200907085740.1083-1-t-kristo@ti.com> References: <20200907085740.1083-1-t-kristo@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, we request exact clock rates from the firmware to be set with set_rate. Due to some rounding errors and internal functionality of the firmware itself, this can fail. Thus, add some slack to the set_rate functionality so that we are always guaranteed to pass. The firmware always attempts to use frequency as close to the target freq as possible despite the slack given here. Signed-off-by: Tero Kristo --- drivers/clk/keystone/sci-clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c index b6477b08af04..aaf31abe1c8f 100644 --- a/drivers/clk/keystone/sci-clk.c +++ b/drivers/clk/keystone/sci-clk.c @@ -221,7 +221,8 @@ static int sci_clk_set_rate(struct clk_hw *hw, unsigned long rate, struct sci_clk *clk = to_sci_clk(hw); return clk->provider->ops->set_freq(clk->provider->sci, clk->dev_id, - clk->clk_id, rate, rate, rate); + clk->clk_id, rate / 10 * 9, rate, + rate / 10 * 11); } /** -- 2.17.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki