From patchwork Tue Nov 13 11:16:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 11 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id DBCC02E5422 for ; Tue, 13 Nov 2018 12:17:10 +0100 (CET) Received: by mail-pl1-f199.google.com with SMTP id 34-v6sf9269870plf.6 for ; Tue, 13 Nov 2018 03:17:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1542107829; cv=pass; d=google.com; s=arc-20160816; b=yWllG9Ebad2WBvLeOIuMQs7QsxLwhJi9gZTg4XvzdiMGdzl3s3SQtu2zKAHFJcvLKb YmNnY0qM5e3EwUMxLG9AHtv9WJ6T1WP8oin2BiKqOX0XqtHXdEV0mZj5VblTgXKoWg8y elbh0wBa4AnybeLaNiuBD0AbL9UPoomiZIeX58NXx/GCXryljH4Zum7/Ry0DR0K+d9bZ 8FNSJksuws07N6S1ulKdiA6l2h04mkDX0lCXKLZsaoEfFklxwMwtXajf7bTR7ysnfAQv gbhkoAutaO2ANKHFj7GwtSUuJQSHFtoXBVpEe1F6LKNxKkhcyQ411esLMmpmVPQ6GQSH Rh9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=A0taRxVkSufR3M5iB3XGMhob9rd41jDrdcV4m9KLQyXBQd79DstoDJcgWtwDBhpwHW /HVOUjr7v6QOEE6iC/pdkh2pEpOHUY3Q076OLSwLLX/CYGTpFmUA30hbMjTh9su3qdEG xIXWnHn4Tm9s7eAG9ZKQhfUm22ZoYmJYzfUIgzxuSj4Ov4WD7kD0CIgzM4U5XymL3jFh jQ2SzF9YwJSTIT1gAbM8MQLyLR20Zjd6R116xSdmFgvxWJqeS6imsWZGH90r6Om+AWIZ zEOb3cHYnAUHz6yyjEzFGbvVeFnPfzQpa4sJwM3Nji8ckgUiSQ0vpXu/W0TMR9kEaLeD chyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToJirpXf; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=QQTcBWHR4RzKUQ0A6UpOWDyUr1dPRXqp2XIxsO02hu6TIITnHRCLn21UXiFqHoH5B7 phCKj5LQMaowgiasUcmI6JFB3J35iDNf8r6eBbamFEnqtWNymL8HaH0BXJSKJbhjTKHb 9R1IGsSqpWUWrtM3wouuvTAl1Ud4wjsesOAzI= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=SbHaDHXknysm0ODThTu2H12MYPY7rgejHA7PuRv2MWzuM0ijDHrTmdP6wXKsDxlSor j30Kzegp5xCrZXfKcEhNGQuT57xt8EucXLYmrN2Nh5Ki3vrFjL4SLNHoBxDQWHmP6oY6 7WwPzwaEh15RWaiNkM5hF5VxwxmZGCo3Uk6QmkwKd14+7FfWA4/g6C66kWkpwGxFM5zb N1XgB7T08qqKGDcg0mo0fgkqFAL/Q3maTZf4lCZ4F2HJeY/LWDQEfAslQM7TCneI2G3T Bq9RV+5ym/SPzGsiBogLTd8JR08FbUV9MT/WNxvCQqg5y8ryoMWfygQlSxlkGL+Q/QqS M8tg== X-Gm-Message-State: AGRZ1gLNFNeIkJlWxI6gYSi3CMJKa7naA0N5C8pu1utxABJSQUV45dtu G4kI6hmE0pCwRaPkvjWt2u6oWG4C X-Google-Smtp-Source: AJdET5cB0xxdjhf1WLu2zr7TkpUZOv/oOmmiNFb8h3Ar7cRjF7Q3P3UjsISsKnaML/nSVw727DpFJw== X-Received: by 2002:a17:902:2901:: with SMTP id g1-v6mr1292502plb.0.1542107829572; Tue, 13 Nov 2018 03:17:09 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:a7:: with SMTP id a36-v6ls4310343pla.6.gmail; Tue, 13 Nov 2018 03:17:09 -0800 (PST) X-Received: by 2002:a17:902:1123:: with SMTP id d32-v6mr4662618pla.62.1542107829285; Tue, 13 Nov 2018 03:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542107829; cv=none; d=google.com; s=arc-20160816; b=N3TOdYF0YQZjpqXHDutFn98ZDvdhiN2/ZXhSzr5H5dCgC8rZr5FISrPZxTnyGTpdFw IeBAILtMOqtvw4uglNnmJ/JKk7QwRI2I+UyKejeX6lGPnSyohk4a25GKbMgMt+EgazBJ jh8LCjUeMhDS9Sj/Vb87B5jRmfMdybQ3ZlOKAzYumM3AEu2YpD8wMIo9yyiTEF/vnBJH XRjZh3ZIJvkMZgodEB8I/UlQZhiYCU5e9RR1Owp2Mtj92NMfsnYrbEKjY7ivlmEOieSm XS7SKvMjihRF4cIe8KhwcnsNqykPAhwI1hLQW9E5amcH8t7JSC3BhfmRo1Y7YzdgeAlm UwEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=T/5eIG+vkxGyFCZWm4+ZYmuvJOguVAUL27akKTjNutdvyMPhyU0gKdPkQN6E/ZHl+j u5VOuTuAgAZnhJ8iq69FtU5Nxz8emUvhJO0ZY0XAeyGYn2Zgefg0FrWXMfR+nND28TKW oUqAntTk5cIRW2KOsRUIfIaSOcu+z/JhBWlDvD4EzbgQLp3pSnKVkCzoHI757D++/vC/ /7A5EiC5wQlMNMNf+gOhARbKAZOumjDJcEjVdv9DSVvlWYQGAyTuBNBZdn6wgAoJ7eb9 GM4XUfElDerd9kQnIt3H0yObAzfpABntYtzJWsVTbl54O07xLbrdqkzxoSu4ULSAm9Tl lpEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToJirpXf; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m61-v6sor23173609plb.2.2018.11.13.03.17.09 for (Google Transport Security); Tue, 13 Nov 2018 03:17:09 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr4770500plb.18.1542107828971; Tue, 13 Nov 2018 03:17:08 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:08 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 03/26] clk: sunxi-ng: Add check for maximum rate to NKM PLLs Date: Tue, 13 Nov 2018 16:46:10 +0530 Message-Id: <20181113111633.20189-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ToJirpXf; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some NKM PLLs, frequency can be set above PLL working range. Add a constraint for maximum supported rate. This way, drivers can specify which is maximum allowed rate for PLL. Signed-off-by: Jagan Teki Acked-by: Stephen Boyd --- drivers/clk/sunxi-ng/ccu_nkm.c | 3 +++ drivers/clk/sunxi-ng/ccu_nkm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 6b5ad990f802..b8b66cdd30bf 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -128,6 +128,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, if (rate < nkm->min_rate) return nkm->min_rate; + if (nkm->max_rate && rate > nkm->max_rate) + return nkm->max_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 ff5bd00f429f..c82590481188 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -36,6 +36,7 @@ struct ccu_nkm { unsigned int fixed_post_div; unsigned int min_rate; + unsigned int max_rate; struct ccu_common common; };