From patchwork Tue Nov 13 11:16:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680261 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 07F0613BF for ; Tue, 13 Nov 2018 11:17:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA60D29A6B for ; Tue, 13 Nov 2018 11:17:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEAE929A73; Tue, 13 Nov 2018 11:17:39 +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 91B6629A6B for ; Tue, 13 Nov 2018 11:17:39 +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=c9LxRbKvvzYsl87E9fqYIiNwWFYYxnxWo34EQ2avE+c=; b=GeVs1+i5BxX0Vc bZkr5z7AsPd65gkNILj3egMxhaLgmhTlx1xiRH2Uh+dOWKtiKkuU+CPz4RCiO+pk9EmjjTfSKBR6V vlWLDzHwr5Mu01t21r2BRa14tdcxCQxpUD0P7HZyX5TqRhP+IJ7Pg268Ss2pRJz/Ea/uIksVQy0rh dD/bFp87xHD0t0y64gs/jjpEQaRBKb4z7e6jIcJ3SFabFCBZP1ui6JnQ91p8A4juuhBe3/mT43grf o3JrjbaPah1leLbRdibhimK+mGdo+YU8Lys0zWlSgb7MCfqvdGru1+D6/Tq2TVKAfQXPz+XEvTYKo YL8rPWKEEPDHBFYsV80g==; 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 1gMWhG-0007iU-8V; Tue, 13 Nov 2018 11:17:30 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMWgz-0007D6-Dm for linux-arm-kernel@lists.infradead.org; Tue, 13 Nov 2018 11:17:14 +0000 Received: by mail-pg1-x543.google.com with SMTP id 70so5535220pgh.8 for ; Tue, 13 Nov 2018 03:17:03 -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=yqEP2BzZ2jXeAZHhd1kTnxj7Hp6aFHA67iUShP1YZAg=; b=CT5tzK3FIIhy1SV/dTYRZshieXYn7lZws4/N07d+OFM1y06E6ppEDYyoNj4z+DiXHJ PKZOi3485lOdSDvdmpJfx1lIHydjsICF2QEc3hqlBgn9iLvI0p8LwUgC39dsfYEJVgI1 QjDVkRit1N407Ya9Vob3dqzxremR9OfsQ4uRc= 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=yqEP2BzZ2jXeAZHhd1kTnxj7Hp6aFHA67iUShP1YZAg=; b=fbRu8mU5aA+ZhfRCyXt2Y0VeGCzze2idaT7ssLRg4Bf8lif/yL9qsO/Sh0LhsF1iP0 EsvRGS3wXpv/OlAwwTe7UbJJUrWMIpcYNVDgQljVD6w6uHQAZNaN3IgOcQ9fLqbwE3xo ap3TR/cTKS3GUAkayDO8eB7D9oSjAPvgL0RDBlMKxdnUusNJ+B3z2zeXZifBS3Kdg8H2 AxmLk3HA0MeLhUIk5v+f7uwB6vGUP8igrrAdcPTXjNTTGTNcmdXydqiZvOI4eSOx5JIn /AG+fY66sgV9TsMRHaJzoy1L6R36qmS2EaRSCNWe/ViVEKsy6d3GbjYFjGQwW4lK3rTF ET4A== X-Gm-Message-State: AGRZ1gLVaREfq+f4WK7i3D6fOjeSEs/RmZarGoUI3PyQVbRBjva8UAlf S2IvyPQQDSYyXEckHC0DNBREoA== X-Google-Smtp-Source: AJdET5cmMrWyjSS6C6l9voHS7ZTX4u3lJ5zBE7LPx1Im9I1AC8wCAE6QwyFo514E2Hznjq6ngUFrDA== X-Received: by 2002:a62:1709:: with SMTP id 9mr3422529pfx.249.1542107822825; Tue, 13 Nov 2018 03:17:02 -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.16.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:02 -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 02/26] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Date: Tue, 13 Nov 2018 16:46:09 +0530 Message-Id: <20181113111633.20189-3-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_031713_538687_8EE918EE X-CRM114-Status: GOOD ( 14.40 ) 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 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 | 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 841840e35e61..6b5ad990f802 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -125,6 +125,9 @@ 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) + return nkm->min_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; };