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: 10680265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E9E714E2 for ; Tue, 13 Nov 2018 11:17:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDFF029A6B for ; Tue, 13 Nov 2018 11:17:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF2DD29A73; Tue, 13 Nov 2018 11:17:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB52829A6B for ; Tue, 13 Nov 2018 11:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FoFMqWXT7qVNjjnoO3o5uUw97Ki9K3QirAVVC28LTLc=; b=N/QWtlhwqEaJ5K MBax0bhjqUxgumPi9ZcsUYeggPQCvkP9qFoltINj3q8wGhKCmKCKYgpc59hENC6eXIEU5WNLy9q96 ZH1gqJiQfYCMTALT5HCr0qZJ0hj6sZXB70Ta76DYnfkh/OeNTQamfwdu0ECyKdkQWd8LcYZlAMKzc x9A/HDO4sn09zCPgKSD3yG2nqftZVTFwaffXeErRN1pLsLjJ6a5uhwawH53Nw3GR/2dwwKxfxXHF4 aU1ItJnNtgbp323iwtnE25UmhPcPkfmbmGzCaEWZcI8apoZ3MGYqlbfFbtsY8E/JpkH+ivDr3cTf8 SQdm1IO1iFrKJ51aN44w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMWhU-0007xL-DW; Tue, 13 Nov 2018 11:17:44 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMWh5-0007Fx-K3 for linux-arm-kernel@lists.infradead.org; Tue, 13 Nov 2018 11:17:21 +0000 Received: by mail-pl1-x643.google.com with SMTP id a14so1245718plm.12 for ; Tue, 13 Nov 2018 03:17:09 -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=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=ToJirpXfC1n3gWkryiJS7jnKRWpzntkBX5uluzEnPwvJIU74yr+59gNpfe4mkRJsr6 ZQy5ESBGNxw5piaq9yvaXKHONhOWo5FwD/GIy/35Wcz5fsEQXlRk5Y84iuWdjHRgs6Gi s0utKmQauGwjiO5oGX1Dkw79QTh+P4obBluIk= 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=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=N6ziSiTj/LCam1HNxc3KmDTNEiNoCUTK7qtoqW6iPeUKUvLBQBIRjTUFkWr42ld7bU 6hMeqoGKiBQwFLe00Kphj4ICZUSRTs+K8sTNh+j7b23e5YPz6fJSyM3gt3l/ECYrjolx FTE0XEJAtRfvNZWr65pDppa2HNhG+v/fk3lMJeeURQSORoCjHyAm0zsXOoMMjR5dAAnb 4iYtlx8up/g4D++SRCUJV0xiNOhrbRihMDui39pdnwVgHy298AJfBWjZz87B2gez4TJW xry32pzLw9NpFcmpLw5tkMQyu+TC7W/xA7Ai3I7SRXwurFHrK1HQmCAiE8RJWVisCv/n ZUZQ== X-Gm-Message-State: AGRZ1gKB+qrRwY8fKj4VCwvjnNCEhyxVw3Q+WFlYsZ91rIwIRGpDI8i2 H3bPTmFuHe9dWV4OppI6n4Xiww== X-Google-Smtp-Source: AJdET5f30k2tAIaqToyDxrKODYMga/iJ046M4/2dIT577ikT4Iv4sylXZhUrbjRpWQ1GftQPeTw08Q== 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181113_031719_685439_6DA7E09B X-CRM114-Status: GOOD ( 14.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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; };