From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_NEOMUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 911C5ECDE46 for ; Wed, 24 Oct 2018 18:04:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6529920831 for ; Wed, 24 Oct 2018 18:04:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6529920831 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727160AbeJYCdu convert rfc822-to-8bit (ORCPT ); Wed, 24 Oct 2018 22:33:50 -0400 Received: from mail.bootlin.com ([62.4.15.54]:52019 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726577AbeJYCdu (ORCPT ); Wed, 24 Oct 2018 22:33:50 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 48DB5208CD; Wed, 24 Oct 2018 20:04:46 +0200 (CEST) Received: from localhost (unknown [2.223.63.88]) by mail.bootlin.com (Postfix) with ESMTPSA id 0CDDC20890; Wed, 24 Oct 2018 20:04:36 +0200 (CEST) Date: Wed, 24 Oct 2018 19:04:36 +0100 From: Maxime Ripard To: Jagan Teki Cc: 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 Subject: Re: [PATCH v2 02/15] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Message-ID: <20181024180436.5n3i3z6h2yezc4cv@flea> References: <20181023155035.9101-1-jagan@amarulasolutions.com> <20181023155035.9101-3-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20181023155035.9101-3-jagan@amarulasolutions.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 23, 2018 at 09:20:22PM +0530, Jagan Teki wrote: > 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 > --- > Changes for v2: > - new patch > > drivers/clk/sunxi-ng/ccu_nkm.c | 7 +++++++ > drivers/clk/sunxi-ng/ccu_nkm.h | 1 + > 2 files changed, 8 insertions(+) > > diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c > index 841840e35e61..d17539dc88dd 100644 > --- a/drivers/clk/sunxi-ng/ccu_nkm.c > +++ b/drivers/clk/sunxi-ng/ccu_nkm.c > @@ -125,6 +125,13 @@ 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; > + if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) > + rate /= nkm->fixed_post_div; I'm not sure this is right. Is the post divider taken into account to calculate the minimum, or is the minimum on the rate before the fixed post divider. How did you test this? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com