Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5653565imb; Thu, 7 Mar 2019 22:24:44 -0800 (PST) X-Google-Smtp-Source: APXvYqyDOC3JzBVWbO/pZWG/hdSNfG85P4TJZsJcBaMOmwhoZdztnAJYy5LrIk+eAEzljJHQXegV X-Received: by 2002:a63:d64:: with SMTP id 36mr14798752pgn.360.1552026284698; Thu, 07 Mar 2019 22:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552026284; cv=none; d=google.com; s=arc-20160816; b=DiLR4qCsaH4WQxN7QI6vQZGtm7394BdM1nfIKAkyO2y7SEdX/MAVT2ZqtpRPcHA25O MZ6BED/am/pf69wA3uAcM7zcVLdrXRYqyulrUuH3IGSSjlB0SodKn10n/yEMrSr4xpM4 C4ztll0tWdwOn3G3kpWJcOQ3Y7D7RK8FD5hln8JWFcIn8fpTAZ3PCdFiz+8R3vLwD4Tl JLJQ9Trh85bKEDrZ4Ba9jnTzdxDQEzAoVzuIBPNF0mVO0nEeMUCS1gcoSqgoW6W9b5o2 UyMCLD0GSpsSYBK9nFB4IpwKUvEdXkGF2M7SyUoZB2jAbwZTZD8u7fDNOVNNXLrg4cW2 UVBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=aGU05ZOWtmlmwypOaP7id+McLm9LOcz0MsaglE8fUvs=; b=ZTPkREsvQak2Vhv4eescBQ9P5rOeH/NltNNVsCGnnWrTkxJVkiu57IM6EJ7/XyBGPz Lr3Ike6srPxxhc+WPXMflDzzfRaGJx4ws8AIX2fXYz6joSxsJ0WElY3CCwNT3m50nLP9 sn7oeUPkSipx4ch3oQTF8OPsuzxFLJPd4zmABvaihunYoz7rm8vcIP92bGzdCwSx9veA uJuokmaRopVh2EKE9G36MVv/brL1yrCKvOgZFJI0RkuPdAQQIhZdRQ7GAPTA/8btP2Nc icyOtb+3ShoeKdsZWbu1NOoeRiAeleCygeJCc3al3U+G6767PPKvdP82GcU+dVxddjHc NT2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="fDC+PGo/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si6196909pls.240.2019.03.07.22.24.29; Thu, 07 Mar 2019 22:24:44 -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; dkim=pass header.i=@chromium.org header.s=google header.b="fDC+PGo/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726313AbfCHGYK (ORCPT + 99 others); Fri, 8 Mar 2019 01:24:10 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46816 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfCHGYK (ORCPT ); Fri, 8 Mar 2019 01:24:10 -0500 Received: by mail-qt1-f194.google.com with SMTP id z25so20088742qti.13 for ; Thu, 07 Mar 2019 22:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aGU05ZOWtmlmwypOaP7id+McLm9LOcz0MsaglE8fUvs=; b=fDC+PGo/0AQKJxSSJYBvclvGPPGa/iuloy2vQ/4nHs8KCiDUSsQhDxrt/796+UmafS Zz9F6AdSaA80Pu9EbAn5HmSe9sDWMB8OhkQBXIb7rxIYCiP/8TAgYWx1gLeiK7atOTQ4 s4GvsKRjn84Qldrl5DzrcPqt6AskGfA8n3JFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aGU05ZOWtmlmwypOaP7id+McLm9LOcz0MsaglE8fUvs=; b=G1Ns1CCLgj+UPOAqzlazT/SkKHHODRNbyoX8itx90EoMMynG9nVS7Q0aX2kVLr2MtP Di29N+lmpkA6I/pmgG70hcmYssvaZ4a/85DNYTmPndlYtJkkoMyRfhUNjEt4dkm+J3MV pswsXCNkTxKJPvSGoD6utZTSOi/KaJlG3Swj8oAiQ3npvWFnMJP0LJlrEFoYmslfQ+VU 4z26ixnF8ISPQ1T+KtfYigaUg2Cc5PFLcU0AAg11wc4DE+T41ryu41CirWps0t3KN+QE F2q6LBMzL3SxPxAeSPnEsXVYttjeF/8k4v+dmYyRI31z2cKBEsyYZm2x306Q+kOaa7E0 YhvA== X-Gm-Message-State: APjAAAWL4TR43XOWEa0zh3bvhatSOOyJYgepzvC9iulkxrjKznQwoP7M Xij4/K945i5hF8L0jJztjfHhPEEbxTFmFtaT9jw0UQ== X-Received: by 2002:ac8:3183:: with SMTP id h3mr13803375qte.368.1552026249063; Thu, 07 Mar 2019 22:24:09 -0800 (PST) MIME-Version: 1.0 References: <20190305050546.23431-1-weiyi.lu@mediatek.com> <20190305050546.23431-9-weiyi.lu@mediatek.com> In-Reply-To: <20190305050546.23431-9-weiyi.lu@mediatek.com> From: Nicolas Boichat Date: Fri, 8 Mar 2019 14:23:58 +0800 Message-ID: Subject: Re: [PATCH v5 7/9] clk: mediatek: Add configurable pcw_chg_reg to mtk_pll_data To: Weiyi Lu Cc: Matthias Brugger , Stephen Boyd , Rob Herring , James Liao , Fan Chen , linux-arm Mailing List , lkml , "moderated list:ARM/Mediatek SoC support" , linux-clk@vger.kernel.org, srv_heupstream , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 5, 2019 at 1:05 PM Weiyi Lu wrote: > > In previous MediaTek PLL design, it assumes the pcw change control > is always on the CON1 register. > However, the pcw change bit on MT8183 was moved onto CON0 because > the the PCW length of audio PLLs are extended to 32-bit. > Add configurable pcw_chg_reg to set the pcw change control register > address or using the default control register CON1 if without > setting in pll data. > > Signed-off-by: Weiyi Lu Reviewed-and-tested-by: Nicolas Boichat > --- > drivers/clk/mediatek/clk-mtk.h | 1 + > drivers/clk/mediatek/clk-pll.c | 17 +++++++++++------ > 2 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h > index 928905496c4b..37ae944548e9 100644 > --- a/drivers/clk/mediatek/clk-mtk.h > +++ b/drivers/clk/mediatek/clk-mtk.h > @@ -221,6 +221,7 @@ struct mtk_pll_data { > int pcwibits; > uint32_t pcw_reg; > int pcw_shift; > + uint32_t pcw_chg_reg; > const struct mtk_pll_div_table *div_table; > const char *parent_name; > }; > diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c > index 67aaa3082d9b..65cee1d6c400 100644 > --- a/drivers/clk/mediatek/clk-pll.c > +++ b/drivers/clk/mediatek/clk-pll.c > @@ -27,7 +27,7 @@ > #define CON0_BASE_EN BIT(0) > #define CON0_PWR_ON BIT(0) > #define CON0_ISO_EN BIT(1) > -#define CON0_PCW_CHG BIT(31) > +#define PCW_CHG_MASK BIT(31) > > #define AUDPLL_TUNER_EN BIT(31) > > @@ -51,6 +51,7 @@ struct mtk_clk_pll { > void __iomem *tuner_addr; > void __iomem *tuner_en_addr; > void __iomem *pcw_addr; > + void __iomem *pcw_chg_addr; > const struct mtk_pll_data *data; > }; > > @@ -122,7 +123,7 @@ static void __mtk_pll_tuner_disable(struct mtk_clk_pll *pll) > static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, > int postdiv) > { > - u32 con1, val; > + u32 chg, val; > int pll_en; > > pll_en = readl(pll->base_addr + REG_CON0) & CON0_BASE_EN; > @@ -147,14 +148,14 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, > val |= pcw << pll->data->pcw_shift; > writel(val, pll->pcw_addr); > > - con1 = readl(pll->base_addr + REG_CON1); > + chg = readl(pll->pcw_chg_addr); > > if (pll_en) > - con1 |= CON0_PCW_CHG; > + chg |= PCW_CHG_MASK; > > - writel(con1, pll->base_addr + REG_CON1); > + writel(chg, pll->pcw_chg_addr); > if (pll->tuner_addr) > - writel(con1 + 1, pll->tuner_addr); > + writel(val + 1, pll->tuner_addr); > > /* restore tuner_en */ > __mtk_pll_tuner_enable(pll); > @@ -329,6 +330,10 @@ static struct clk *mtk_clk_register_pll(const struct mtk_pll_data *data, > pll->pwr_addr = base + data->pwr_reg; > pll->pd_addr = base + data->pd_reg; > pll->pcw_addr = base + data->pcw_reg; > + if (data->pcw_chg_reg) > + pll->pcw_chg_addr = base + data->pcw_chg_reg; > + else > + pll->pcw_chg_addr = pll->base_addr + REG_CON1; > if (data->tuner_reg) > pll->tuner_addr = base + data->tuner_reg; > if (data->tuner_en_reg) > -- > 2.18.0 >