Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp487836imu; Tue, 27 Nov 2018 15:55:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uy2nwpIZPup01W+8Yd0t7bMoR4ktfwb6C0jwLUQzjz1aTp/10+XFVCUN4ZomAYV0cPMXqz X-Received: by 2002:a62:c42:: with SMTP id u63mr3340554pfi.73.1543362906572; Tue, 27 Nov 2018 15:55:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543362906; cv=none; d=google.com; s=arc-20160816; b=JAGCjfHzQoHPJ2c0JAqjjy75AT9bYUTuGrZpUF7pEXDOuu0AFp/gf3wVDfNmbArzbF sPwfebMFCl9wCZS3ptIm2FIGmv+kxfJ1kudEdPyJu6yXE4MwIq08ZDWtuN35AqTruPdx BXCsFu9RuSwiHkVtlI5FeIU1nxgHsP/uRz5bx8UST4t5ejzol2Lg45jEFV9CgnlQSA3u e+LH9oruaVM7CzOKwFU+j0IorWb12x6aerG2L5wfTQI70lpGwUePZzRxzuZqNlas6G4u sdlduDaQIIA9/nETLCBPCeMcaOAO2uxuXZFWD0r4l7xAYbUkF2LtePDbYMQRVI93ghy/ WLxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=TO4sExyxv6acTTPZL3vzEWLckjCWVxWXgD9YGLjR0cE=; b=zJJuNTNBGFLdT6HKY1tjADhX76AXMPHw7KNYiM7sTO2tLNCHPomjpElKAlY8zJ8ftz tZJmizMtGF252DUiGppGUIwV1baufL+r2CaHbiZpJTKi3wh/MnfiKnIz4lXLNR+1qWpa n/9J0Jkngt/f8Py4odn4Tdlbgg1wIS/I1r6AaKIfpSVtsENwgtECEod8IrFN/EwVPUI7 V2ufCT6TfJMKSsoO1MWt/IwvE5b1P/QnjvNGLZYNIyciVRXChR35JCyLJtUTLBvZVwnS XvD+RkooLCyJB3bjZkG+ij/NSM78pf/u2Fkd611wgvTb6/aUl05Fx/c7cQM43Bg4Ch1G hJpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O+P3S3jQ; 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 q5si4568754pgk.46.2018.11.27.15.54.50; Tue, 27 Nov 2018 15:55:06 -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=O+P3S3jQ; 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 S1726902AbeK1Kxq (ORCPT + 99 others); Wed, 28 Nov 2018 05:53:46 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35947 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726587AbeK1Kxq (ORCPT ); Wed, 28 Nov 2018 05:53:46 -0500 Received: by mail-pf1-f195.google.com with SMTP id b85so9205704pfc.3 for ; Tue, 27 Nov 2018 15:54:12 -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:content-transfer-encoding; bh=TO4sExyxv6acTTPZL3vzEWLckjCWVxWXgD9YGLjR0cE=; b=O+P3S3jQTX49LUFvNhedEOyCBgVXTg7htYNET1JxN74PfUyzqIlaJUcGCzsHlJi346 4h8KfTKaSLyPQTYXIC7VmFjgik5qpAlxhgHVlLAbyZ4hbTq60AYnKpT1rRAJulmszkDn 0hfrIOAq3ho0hsWXJe6PSCLDSONBII7V+j1Yw= 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:content-transfer-encoding; bh=TO4sExyxv6acTTPZL3vzEWLckjCWVxWXgD9YGLjR0cE=; b=M2VBc8J1co03JYOph3aA+kO/N7djgZjfvH+uL/6HgVQ4J1E7l38qyls+HrtTjFOEcR fDXQA1IjLnyAyiDOQFK/1NCw06nZJIpmK1Cfr1fnYLP1wDk/579tjEF5f31Q8uQoISUG iyrLtF6/tUrg9G950o+a0EaW1Xn6D/yusi+ewomQ5FN23/891MpEjsL7LaTSIYkqPMK/ K6JStMdXTGtKG4I5pFmvgg0VG49Vki5KD2EzgBRlIYHqDseiVyGSXPkSwZxQNFyonir3 6wQP6GHJTk5GGQ/Pxdr1mwM67RazllQ1hvGhlYodcpHfo/B1q06asaG/hKMSIcSifvr9 So9w== X-Gm-Message-State: AGRZ1gKra1V2gU5DFl7YCUHWbKW92IMFBlkuBWjGvhLXGZtwSsDyY1Zp zev+d1MeA29fsPYt9QTecaTeLrgW3ZGDUPUeDaxvIA== X-Received: by 2002:a62:938f:: with SMTP id r15mr34967910pfk.27.1543362851560; Tue, 27 Nov 2018 15:54:11 -0800 (PST) MIME-Version: 1.0 References: <20181127034254.24721-1-weiyi.lu@mediatek.com> <20181127034254.24721-5-weiyi.lu@mediatek.com> In-Reply-To: From: Nicolas Boichat Date: Wed, 28 Nov 2018 07:54:00 +0800 Message-ID: Subject: Re: [PATCH v2 03/11] clk: mediatek: Disable tuner_en before change PLL rate To: sean.wang@kernel.org Cc: Weiyi Lu , Matthias Brugger , sboyd@codeaurora.org, Rob Herring , jamesjj.liao@mediatek.com, srv_heupstream@mediatek.com, lkml , Fan Chen , linux-mediatek@lists.infradead.org, owen.chen@mediatek.com, linux-clk@vger.kernel.org, linux-arm Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 4:37 AM Sean Wang wrote: > > Weiyi Lu =E6=96=BC 2018=E5=B9=B411=E6=9C=8826=E6= =97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=887:45=E5=AF=AB=E9=81=93=EF=BC=9A > > > > From: Owen Chen > > > > PLLs with tuner_en bit, such as APLL1, need to disable > > tuner_en before apply new frequency settings, or the new frequency > > settings (pcw) will not be applied. > > The tuner_en bit will be disabled during changing PLL rate > > and be restored after new settings applied. > > It looks like a bug fix. If so, you should add a fixes tag and even cc > stable tree > > > > > Signed-off-by: Owen Chen > > --- > > drivers/clk/mediatek/clk-pll.c | 33 +++++++++++++++++++++++++++++++-- > > 1 file changed, 31 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-= pll.c > > index 1db161aced31..81400601f107 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 CON1_PCW_CHG BIT(31) > > it seems like an unnecessary change Below, you have: con1 |=3D CON1_PCW_CHG; Presumably PCW_CHG is on BIT(31) of CON1(?), so I think this is a good change. Maybe this needs to be a separate patch, though? > > > > #define AUDPLL_TUNER_EN BIT(31) > > > > @@ -97,9 +97,31 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll= *pll, u32 pcw, > > { > > u32 con1, val; > > int pll_en; > > + u32 tuner_en =3D 0; > > + u32 tuner_en_mask; > > + void __iomem *tuner_en_addr =3D NULL; > > > > pll_en =3D readl(pll->base_addr + REG_CON0) & CON0_BASE_EN; > > > > + /* disable tuner */ > > similar code pieces are ready on mtk_pll_[un]prepare. maybe we can add > common tuner operations for them to reuse. > > > + if (pll->tuner_en_addr) { > > + tuner_en_addr =3D pll->tuner_en_addr; > > + tuner_en_mask =3D BIT(pll->data->tuner_en_bit); > > + } else if (pll->tuner_addr) { > > + tuner_en_addr =3D pll->tuner_addr; > > + tuner_en_mask =3D AUDPLL_TUNER_EN; > > + } > > + > > + if (tuner_en_addr) { > > + val =3D readl(tuner_en_addr); > > + tuner_en =3D val & tuner_en_mask; > > + > > + if (tuner_en) { > > + val &=3D ~tuner_en_mask; > > + writel(val, tuner_en_addr); > > + } > > + } > > + > > /* set postdiv */ > > val =3D readl(pll->pd_addr); > > val &=3D ~(POSTDIV_MASK << pll->data->pd_shift); > > @@ -120,12 +142,19 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_= pll *pll, u32 pcw, > > con1 =3D readl(pll->base_addr + REG_CON1); > > > > if (pll_en) > > - con1 |=3D CON0_PCW_CHG; > > + con1 |=3D CON1_PCW_CHG; > > > > writel(con1, pll->base_addr + REG_CON1); > > if (pll->tuner_addr) > > writel(con1 + 1, pll->tuner_addr); > > > > + /* restore tuner_en */ > > + if (tuner_en_addr && tuner_en) { > > if (tuner_en) is sufficient > > > + val =3D readl(tuner_en_addr); > > + val |=3D tuner_en_mask; > > + writel(val, tuner_en_addr); > > + } > > + > > if (pll_en) > > udelay(20); > > } > > -- > > 2.18.0 > > > > > > _______________________________________________ > > Linux-mediatek mailing list > > Linux-mediatek@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-mediatek