From patchwork Tue Oct 23 15:50:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10653309 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 8CC5013A9 for ; Tue, 23 Oct 2018 15:52:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79DDE29C1C for ; Tue, 23 Oct 2018 15:52:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E36429C64; Tue, 23 Oct 2018 15:52:45 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 0A01629C1C for ; Tue, 23 Oct 2018 15:52:45 +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=qBL1XkFmGLRRwW43YrJMaVufqK/aA/qwNEOHZzbqiXA=; b=d9BRbpEW9jYDKb BA1RLqFo3noTbasR0WJ7R6IZmgXnMCNk1XlkWGasRMi9/TKlT9CfiWMsJwshJTlZSJ+XCUGP1hVvD gRcTsr8nGtKACSIB0aZnJWoTJjaKW0uBa1D8TfVN+9G25ZBWgAcAWzJvuZD0ILKqCDBKGWzHyYmQM InOpZc1GcmprUQ0CcdTPp/nfC+eiWiSif0KacX7x5RIUn8+Nxiq0rwfp2HunQcdIuBjZTYzXjPRjp Waq9ddDc+an3O8TNqxdzVY7YaJrjx8D3S9yDGxLcsSMY55lCRK2bBedkr+hgrBTzHI1sLv4gLWR3h hZXez0E/YurXMeWXxs+A==; 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 1gEyz1-0004tH-Eu; Tue, 23 Oct 2018 15:52:39 +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 1gEyxi-0004Do-51 for linux-arm-kernel@lists.infradead.org; Tue, 23 Oct 2018 15:51:26 +0000 Received: by mail-pg1-x543.google.com with SMTP id r9-v6so854402pgv.6 for ; Tue, 23 Oct 2018 08:51:08 -0700 (PDT) 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=1dyYdq2fGSrjONwrfY1SgFShhS+wEyBSRnppCGelZow=; b=FJGkYYgEP/eg/Wr9wbD7Fpq7rUFEazM/71HFrAqr/wVVs2hBXeyKynWEANE0N8bpBb jESZbeS8b406nfCpXeKdN6n0gjqx9WOvR7+fTrFJSTmV3w7TQ/LUXfVKnVpcwF+/PJZq Kfrr+u3rxntZwCx3QkK9EfmSyxpK1ORX3hTGU= 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=1dyYdq2fGSrjONwrfY1SgFShhS+wEyBSRnppCGelZow=; b=ZNUQJtSDO1i4MLb7oFu6CM1hg4Nlq3nNCG6nVpT/GIugK1y1NV1aXeuW2JdZ+C7Kn5 DfcEXiqrX3/o7+lVfpP8PSYuskRkaAKnSuXfGuzothQZH5kk/dt1r+VN7rF4UXsmi8h7 kjLLN8a/Qp141z9FW1872Sl0ppo+HFcOkYAqV8lf/nzMZHbr+gNzSOR199reoUrdDw4f 7AwaqM9smqc2E77pAQL01xmZtERmAdrTKRqBgB9cHneMSp8Hx39vz/giAqB5+JBbxorq OdyOEPszqGBAbI950qu55B2gjphys13AI1+pyfpu5DgMgxQDrPFHKjZW71qeKaliOaAz NU0A== X-Gm-Message-State: ABuFfogDljR3W9WqlNawzaKLhRno8+6kQjHr3/+gVHB8zB8oggqZs48b dB8gO52YPPijUMidUFGH/l20MQ== X-Google-Smtp-Source: ACcGV620rT4+klZBrl+72/MNbWP4Se0rx+vcw5DlyWGAQuwiKF6qJhGwL+yyA7oArbyCYbID4TVn7A== X-Received: by 2002:a63:1e5c:: with SMTP id p28-v6mr47910535pgm.376.1540309867407; Tue, 23 Oct 2018 08:51:07 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id o75-v6sm7442829pfg.0.2018.10.23.08.51.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 08:51:06 -0700 (PDT) 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 Subject: [PATCH v2 02/15] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Date: Tue, 23 Oct 2018 21:20:22 +0530 Message-Id: <20181023155035.9101-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181023155035.9101-1-jagan@amarulasolutions.com> References: <20181023155035.9101-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181023_085118_220520_09A3D29D X-CRM114-Status: GOOD ( 15.27 ) 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 --- 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; + 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; };