From patchwork Mon Dec 10 16:17:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 73 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f69.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id E852A2E54A3 for ; Mon, 10 Dec 2018 17:17:46 +0100 (CET) Received: by mail-wr1-f69.google.com with SMTP id q18sf3730231wrx.0 for ; Mon, 10 Dec 2018 08:17:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544458666; cv=pass; d=google.com; s=arc-20160816; b=U58AaSmVUGDXPXwoAAhg5fYqU5EPvnIvo7+je841yzE6HuN/I8d0U2CxmSIxzhBBb+ 4g4I4Y80dp5bks6ezkykL7axfTqrrm18R9bU23QEmtUgyET9CJRo0sHQWxht0N25EmD1 +ZUzMSm4GgtlJg8/xYQUr3WUBJ+0gESTbZqO6zEBGk/HF+Dnwv3nYB9Em/gKsTTunf3c KFA53EquyWGULTq0dAHUQvgk5aar6zGkLbhIlHHRpB322/MlB/ELtI71zeWT0SatA/9A BWzqTrkLanrIcnZRRBk/3vYiLo1IobhXoR/AohVr29R33IkTqJWuSg17UuBTeCK6z+rB HvjQ== 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=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=PqXerrnzu3J3/e8/L9GyVQHfAEYPUR9q9qSJ6bDPzVYmYT9McYlu7aZNfx5EoQFVZz gO5Jfdgdj40g3ZnaDTk/rkOHdKVq913W4lFDZV6/O3yaNOWDXU7G9JmGCp4QTH16oYFm K9Z/GgiHODzDB5umAfGM2unh9bDUY0ASZB/MUgfTIrhcAFiwU9IdiDeS5Ii/PpNmjun/ cENjlXvqOj6yLtTOKZYwb66Q5SeQP7H7B7ZccqvOo0C/jLGFdGmpLis0Ez3UIWv8mpV1 eA04HIOgnAJfmRjM2uVGHnvbB2ESUsrWD1BDwbJHcSPV8H141lwf5kBciir1N+PWOgiB aCTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=c6YjHI+8; 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=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=hyE2df2OxYnBYMIkyznjGVe824uCUo1uylnFOuoy8uh7dK22arS7rkwasbyZKgg8Dr c+ERUuEuOLP9P1L/bV7GMthbcB9RswG3OZJNmclGSK6pAjI9e0Mjp+c1XMIiQGVX1RLw PuuUuRK430KUvFklCs1PUU0SRnTou2QdryKNo= 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=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=Lz1E78XtD180GCVV6qc5BBrZgwnyQwcjuH6+IUdpHtWZ4LfTz+TMSJpNvqcO4k2Mhy L36dgShSB+pB6bOtoe82SH38NA+59hqhyAUN+/IYpPT7l5n0ooQZuwwMu/EaCrxqOslQ U0JDV4lRtuWWFa5oMv6InZ85sno/lhLVuJgbmHIZhXZANm6tNnSMvNaOKYiEuKgVllJo ZY+TD5aCUhI58iOTgRVKQCfAmDXcN7YhH3/oWC1R25Y0AcLFL797eVFR20l6Ac3S3oxu u0iH68fC9+MKtqzSeUANAJ6GDZ9oe9Wg9Bclo2g2f2iPP6MOOzPZNPaTx0xzfs6paz9N c0pg== X-Gm-Message-State: AA+aEWZSzosWBl80TqH9m6kEd8s90YlURzeqBqRR3yVcL8ObeeShkM9+ OmhwV1t3ZNBmkh2o+KjTqCGOrb8j X-Google-Smtp-Source: AFSGD/X5bz98NYgj0aiJh9LfiJygG7FzztnMRSFzkLOeTpG1RjCX0wKgfjRdnsCmmsA8XlLKmIAkyQ== X-Received: by 2002:a1c:7d03:: with SMTP id y3mr1385866wmc.8.1544458666542; Mon, 10 Dec 2018 08:17:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a1c:1f41:: with SMTP id f62ls1322873wmf.14.canary-gmail; Mon, 10 Dec 2018 08:17:46 -0800 (PST) X-Received: by 2002:a1c:1b86:: with SMTP id b128mr10842810wmb.30.1544458666116; Mon, 10 Dec 2018 08:17:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544458666; cv=none; d=google.com; s=arc-20160816; b=vKAnG6V7GZfpcr5Lxeh0qdWkHv1/U1TzIyibxVw4wiZilT0UCL9/i5ra0613haRH+2 l6JlnKbPyCkkBENRAgUvUENT+HJYu7+e9u0SdJ3I31qmDSGKknVQcfcAZsjixl9fwSXf Uu40nDvs1dQUboIUL6R1xRRcrQjGkRTsM8XrNw4/P8SqZLrXKEM06ruH9veTgzeueDoN 7FnsVA/dLr4RBjXHFUnIssswcsvG8IaWTFiFsFvbp603uSpm0cOk1g7rmzS2atm12icr 3cjE3qhcaGw5takPPMT/7tFwkSFr5iXSC5VNu5gxhP0FVOVVDJDny4bgtXLGEdSyAHbd RsZw== 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=EEGBFedCv0eGIwFBpPqp7aDi2x6OUg3hp3DvnJn01c8=; b=fbnbw8CrnfXD1aoyu5TVZ0sZxigkOEdJtwRfop0cnBJ3VJ5sejIdXM53OEIoVDVmAv Z1FATb+pzf/ICVXGYdmWJvCmBNBVVNjwCrbphZ3E7WFgs2dX0XbCag0B3XpAmTfKJckC 43t/y8xxkVi7crvYjLijaViTEmE9MPNY+NF9K0bjxL4w6jxyBQrfcd469xl8anSkTm4O DPN3Ii3Mp2SoggkFLh2jd/OBqfX3eQukiGeYqBAPJf/xXSnD88d23NkJU6DJ7h1uylxo XzFJG14cKHyN3usQbsrSyfewVBHYVAmaPXvOX5i9nIydW3xcidRc8PrJOBeAsFnsA2bK eBYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=c6YjHI+8; 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 o10sor7866984wmf.29.2018.12.10.08.17.46 for (Google Transport Security); Mon, 10 Dec 2018 08:17:46 -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:a1c:16ce:: with SMTP id 197mr10900332wmw.126.1544458665729; Mon, 10 Dec 2018 08:17:45 -0800 (PST) Received: from localhost.localdomain (ip-162-59.sn-213-198.clouditalia.com. [213.198.162.59]) by smtp.gmail.com with ESMTPSA id b13sm8397503wrn.28.2018.12.10.08.17.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:17:45 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michael Trimarchi , linux-sunxi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 01/17] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Date: Mon, 10 Dec 2018 21:47:13 +0530 Message-Id: <20181210161729.29720-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181210161729.29720-1-jagan@amarulasolutions.com> References: <20181210161729.29720-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=c6YjHI+8; 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 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; };