Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2392847imu; Thu, 24 Jan 2019 12:00:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Jp3meHBE7benQ9Gw+DX5JxvOu0ERrB2TCw0BjLGJ2X+Togapvvt6oJA3CE4lrGwwMfN3P X-Received: by 2002:a17:902:2006:: with SMTP id n6mr8058134pla.66.1548360036777; Thu, 24 Jan 2019 12:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360036; cv=none; d=google.com; s=arc-20160816; b=Ao/xHfgesZF7XWKZWh9bf3J0QRAowuZsiNkHukNl66WKeLYPnTXDINrcGFCabfh72X O3gd4I3o5a0Ke/gzQk1XEbb+xi+PT+MMVh3/yA7smWo5uvC+3foclmEAIua4yqi25S6h qpMf0zRT3no4eH+VgfuAe5+6mFSgcEtGPuYChDh5JvZX79o4dGfre39vAeYZYM8Xxju3 icRi2+fWr6IzvYEc3nNaEr9QgqLiR7amz+rdYNv8VV562f3dZlvuIsCMatc6bdp1F9/U IQ5UuYWglELN2Gnllmiralpfzbr7oE9ScX1dAQC41cbZfGgSY6Fqvw8CoK4zz4JRSQAl 8MoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=sBQTRwy1k6AUlgJMaAh9mgm/SJufzBGbT3FHuN2+L2uRV+tQ3EGrDDLuW+0/5zcAhy PGYPWakFAYbBnqTF66sX7NIWzpSNI2iFhAcSDPYizPV93pbiv898bAJ1nrOEo2GEvKGo QfhgWtOktf3nP4px0tTBMDCU8tqBCgfwXmodC/yJBf+IjTM1jWQbEMYYjcsv6N14z22v /STfFx0c3J2uJ+LcEax+YPXm5andnCnQORZEVJzqWZKkNjPjMS3GnYmG5pQJqOuEHTr9 VJ5iNVUyCAGSMYdGzOiC6WcMew1pLRrIJzVIaIUOeCd2c5hFjCbCiESPYWndwM7DDSC3 dn1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jl0+3mCU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si20712290pgi.308.2019.01.24.12.00.20; Thu, 24 Jan 2019 12:00:36 -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=@amarulasolutions.com header.s=google header.b=jl0+3mCU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732269AbfAXUAQ (ORCPT + 99 others); Thu, 24 Jan 2019 15:00:16 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:47076 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732233AbfAXUAN (ORCPT ); Thu, 24 Jan 2019 15:00:13 -0500 Received: by mail-pg1-f196.google.com with SMTP id w7so3111231pgp.13 for ; Thu, 24 Jan 2019 12:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=jl0+3mCU+nCI7YGq+itsqShkC/SfgVti3hEQ1ulSvukcgTB3ChDjHL1au/xyTtFmei gQYNExKO3Imrr0vQPZTTFzsBWG6MQKp50I0UaMarYeGQsx7pcN3ZG13p/jAWqjEKAxqo po5DR55psBPduQb+2DpXUqolNrzeewmlxyKzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=qBtuGq2jnWJr5AFVIBU/q9C9N0+y+VugCh4dpGUL5F4SMvIkAEX10rpKe8EusYu08P mOHXhPvueO5e3ari86XyTW+RG3hnD5RhkUTLYcEsnt+vHsnQdchcVz0WfiEqHz4HzNTE ZRMiEM+bNgp/rfMpjG35WPIROXVUAc4JKQaS3Q0ULGSUYxBUN7xnPiolr0NR0U+hDhKQ y94W58/BBOPbPzLZLZgdQHEC5GY3csq8V5uT75tsx7XA862cKxhrID2iCbgMH36MMUnn DYQ3KcvEoWGOTMn4KDYOpENAO6E7JCTroEz7CK+dw4J5L1GJ5ns8D0WZ/hZExIJ3ZvOh RKUg== X-Gm-Message-State: AJcUukchPtDJxeOozg8M2D4rnTkl3MXMwsmi03br8VcvgKQYrdfjXQiL mkmgUFfjJxmrJV2sA3uR+sIWrQ== X-Received: by 2002:a62:3943:: with SMTP id g64mr7995857pfa.114.1548360012725; Thu, 24 Jan 2019 12:00:12 -0800 (PST) Received: from localhost.localdomain ([115.97.179.75]) by smtp.gmail.com with ESMTPSA id x11sm61637003pfe.72.2019.01.24.12.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 12:00:12 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v6 10/22] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Date: Fri, 25 Jan 2019 01:28:48 +0530 Message-Id: <20190124195900.22620-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190124195900.22620-1-jagan@amarulasolutions.com> References: <20190124195900.22620-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some NKM PLLs doesn't work well when their output clock rate is set below certain rate. So, add support for minimal rate for relevant PLLs. Signed-off-by: Jagan Teki Acked-by: Stephen Boyd --- drivers/clk/sunxi-ng/ccu_nkm.c | 5 +++++ drivers/clk/sunxi-ng/ccu_nkm.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 841840e35e61..096ff4f4839a 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -125,6 +125,11 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) rate *= nkm->fixed_post_div; + if (rate < nkm->min_rate) { + rate = nkm->min_rate; + return rate; + } + ccu_nkm_find_best(*parent_rate, rate, &_nkm); rate = *parent_rate * _nkm.n * _nkm.k / _nkm.m; diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h index cc6efb70a102..ff5bd00f429f 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -35,6 +35,7 @@ struct ccu_nkm { struct ccu_mux_internal mux; unsigned int fixed_post_div; + unsigned int min_rate; struct ccu_common common; }; -- 2.18.0.321.gffc6fa0e3