Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp133729ima; Fri, 1 Feb 2019 00:34:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MsSkW//r25qG/oMsUJL5wrxINcPqkPH8Z2DWZGwi9yxAaoEg7mI8R+S5SKVAJ40CQ47Y/ X-Received: by 2002:a62:de06:: with SMTP id h6mr39415678pfg.158.1549010059147; Fri, 01 Feb 2019 00:34:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549010059; cv=none; d=google.com; s=arc-20160816; b=wVgz0Vk2v+fbT18pBsoFW8nDaxEZObnTXbv0g823CXhDQOUjXtoFh1kD9rsH0W/Nc3 jAhmSKCtT6tHKIb47hRNs2s4boKxgCqIgu8zb2BqZ2rGZooRxdpl8Tjb80yNtnZcMayt /YaNV3gYyvJTZ+aamZ5P76R67VOXHrErAzTE72CWcJXafnMPtVIlbZRYWRN/xjCbF5F+ eGGyIYlZSSKBsLCj157znGQIQmUuMphWufBrZhcRPJXsPNPx8oFNxfbAoIBAbzna1lq6 UZzy/onrru0LTsP6NqP6lMvVmmmQ666bqrkGI7f8mOMTHChh5SC/ON0WdWoIg6bdpz2N xJow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/DAp9tZ5DfV26dtiTFawmKAdn5aMPsPJvJA7C2Ok+lI=; b=w8fnqx3Nq8R6pNY0ozl3NGx6H67mgFXGxy0LuMw931LHhDEXMvPiEKsny1G+onUjKK lVgiSj4oVKe4RZoxY+wpCYCKZ94Z8S08Ld1llkHa6LoP7tP7VLpB0eE0hE1TmAP2xNVo PP0CPlRSjCTS8ATBDukzaq2g0ymJGnuH0kvHD4A6v1/wwYUKcsTSaMywZTqbt2Gvu9MQ gNL04yA6+p+0wmgcEKLZuP0fkUxNwLz20WVzPBdyyHjPhUT0KWGKYy3pbEST98OxwUXG 7TajFEqBz62K1K5ChjIbfFm78SIyEtLBR3lISWloqCHv7MqmSwiJSQnMp9c6x4OsFIWP otyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si6610594pgb.107.2019.02.01.00.34.03; Fri, 01 Feb 2019 00:34:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729425AbfBAIb7 (ORCPT + 99 others); Fri, 1 Feb 2019 03:31:59 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:15467 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727935AbfBAIaf (ORCPT ); Fri, 1 Feb 2019 03:30:35 -0500 X-UUID: de07b6ce74d44821836ca1e2bd7c1e59-20190201 X-UUID: de07b6ce74d44821836ca1e2bd7c1e59-20190201 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1985247759; Fri, 01 Feb 2019 16:30:28 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 16:30:26 +0800 Received: from mtkslt210.mediatek.inc (10.21.14.14) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 16:30:26 +0800 From: Weiyi Lu To: Nicolas Boichat , Matthias Brugger , Stephen Boyd , Rob Herring CC: James Liao , Fan Chen , , , , , , , Weiyi Lu Subject: [PATCH v4 12/12] clk: mediatek: Allow changing PLL rate when it is off Date: Fri, 1 Feb 2019 16:30:16 +0800 Message-ID: <20190201083016.25856-14-weiyi.lu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190201083016.25856-1-weiyi.lu@mediatek.com> References: <20190201083016.25856-1-weiyi.lu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 30187A2001985F3D5D717328033DA56F4AC3280D8AD30A2E4526C4DFA199F0682000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Liao Some modules may need to change its clock rate before turn on it. So changing PLL's rate when it is off should be allowed. This patch removes PLL enabled check before set rate, so that PLLs can set new frequency even if they are off. On MT8173 for example, ARMPLL's enable bit can be controlled by other HW. That means ARMPLL may be turned on even if we (CPU / SW) set ARMPLL's enable bit as 0. In this case, SW may want and can still change ARMPLL's rate by changing its pcw and postdiv settings. But without this patch, new pcw setting will not be applied because its enable bit is 0. Signed-off-by: James Liao Acked-by: Michael Turquette Signed-off-by: Weiyi Lu --- drivers/clk/mediatek/clk-pll.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c index cf444031bdfb..ff27174ea347 100644 --- a/drivers/clk/mediatek/clk-pll.c +++ b/drivers/clk/mediatek/clk-pll.c @@ -97,13 +97,10 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, int postdiv) { u32 con1, val; - int pll_en; u32 tuner_en = 0; u32 tuner_en_mask; void __iomem *tuner_en_addr = NULL; - pll_en = readl(pll->base_addr + REG_CON0) & CON0_BASE_EN; - /* disable tuner */ if (pll->tuner_en_addr) { tuner_en_addr = pll->tuner_en_addr; @@ -142,8 +139,7 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, con1 = readl(pll->base_addr + REG_CON1); - if (pll_en) - con1 |= CON1_PCW_CHG; + con1 |= CON1_PCW_CHG; writel(con1, pll->base_addr + REG_CON1); if (pll->tuner_addr) @@ -156,8 +152,7 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, writel(val, tuner_en_addr); } - if (pll_en) - udelay(20); + udelay(20); } /* -- 2.18.0