Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp436375pxy; Wed, 5 May 2021 06:00:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu3thSZprrpmzAqMnFYumZXYmiUO4GMjeIq86s2xCHKM/cIaHf1z1w8OOV9GpPr6hGC9FK X-Received: by 2002:a17:90a:a007:: with SMTP id q7mr11497552pjp.156.1620219650174; Wed, 05 May 2021 06:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620219650; cv=none; d=google.com; s=arc-20160816; b=wsxseaTMQKNKptxUU3uocP8KzWkUqGDU5fEhZ1D45fufLiPg68DMgyz6ab9W3QuEjI PeuVRBJ4kcHl+Zfh+GSi6La0wyedbnJk+npKowdx4CichdRQZXqzBnmOgFe9esHzts7Y 9Bv8UyDreT63DceV4gjc7cHBZxdjDbXEv8S2lw+jLzHvLI/F4YP37FKlU0i10p5gaZA7 7urA39xAu/BZvAMHZihPTtVu9QbmLXloBeVa7MydVgq2vbe68IyA21QYQ7IroAETzu3x k2imRRvCLLRS0UCZDJpiRpOlwSTQsHeuq7ScKeCmKhJQbeXjhP/GFuNWPbS5Q8o/MuFy +Mig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=q3TUXql89bkOBKVdZb/N0fDACBtYAZwgrTC4aNZ/0kc=; b=Zkwp+IgZ2EO7jQ20D62TDEZneI8ibCixMzuTl2LGRlQXBFqQry6+BgYiYbm8rmsw+H j1DTS0Y1jyBupQBc9ybzzCBHbO7qrg5+QKyAXxwaJqa6u174VeTzYHTYXCPJL0sYFyjs jpdSi6VzB24bcBy8OWPiDBuNp+qzEg0fSN1bLXK/DZg25t1vZ0FGfJ+PCnlKMOI+JhWC pn5m4T91kzIzMDHrXU69jwEWuvzl2HqNc2byHjkNmBqEA9FH4MFHF6jZCjf1Kt3BSS7K yORoVLqPQa2lSizzPqyZoEAAJHPCPS4cyzSqJ75KLfhh2Gcc1JHbPh1/tlz7QoUdXV23 56bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uV29I9tL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si6725578pgm.597.2021.05.05.06.00.21; Wed, 05 May 2021 06:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uV29I9tL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233274AbhEENAg (ORCPT + 99 others); Wed, 5 May 2021 09:00:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbhEENAf (ORCPT ); Wed, 5 May 2021 09:00:35 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEAAC061574; Wed, 5 May 2021 05:59:38 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id y26so1913883eds.4; Wed, 05 May 2021 05:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=q3TUXql89bkOBKVdZb/N0fDACBtYAZwgrTC4aNZ/0kc=; b=uV29I9tLk7ANTNzFA1wxHQJbNKWCXsHVRbRSEBzO5LsmthoqIERDma5lAafkKTeqir HRvCo6sKwWjdy7gWqurDdr/67LoqJ0eeHBZ931slpmjfCNWd6P0PrbKlMn6sGUUx8MJN c5QszoiquPtLswpAkmublRPb/jbOHJp3cuYHkTctZYmuz6PYScf7zOeeCgFXnCIkUijp ZJHWbTWEN2m2AMCT4yu9W4ud1xjLX5UZMZ7Xf0k9QItiBUvcyI0vH88x37QXbjAhbYkB ArO45VAh4ZkSl5R0eace/5p9Br8N3bvgCUVjRSh0CEigbskH5hEpAHvoD5f4Y1BDHTUV ++AA== 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=q3TUXql89bkOBKVdZb/N0fDACBtYAZwgrTC4aNZ/0kc=; b=oeVidgfzWLKg45M1PI/4Un+fINWpSURJh4wM5jQgQHXeJKdi43gzbl8hz5JgAAsBSV 39ySjBCg80Vnim9yvskJ4/SIV3d/RDgT/poahfbaUTPIr4egsdb2q/WRweYQ+8R8ca81 +FIErInut3V2w7ypbA7w6xosvz83hxHkxrBcE20LmMfS7EdAp8Z+PJ9l2WM6R6GgyyN/ +iYw+IuDuwD5kQc4NzwOhxegOMIeIIaSzuAQ8yPXier2igYVl+xEhVelIzpQjq65fz88 25vOQtP7XPQ6J2sVpVIbM4OoV4Nk04XlZIDH7O/zKA3txLnwWINJCgFkqGbdk5Ut3IAL 1vOA== X-Gm-Message-State: AOAM532SzPYQlILGwghAKPdGwKL9vwah77DVUP8tFsdJRXnuZEiYBndx GuroROrtz3hI/3Vy/dV+2jMkfWGQTrzVlHXf2j4= X-Received: by 2002:a05:6402:20f:: with SMTP id t15mr32166134edv.370.1620219576979; Wed, 05 May 2021 05:59:36 -0700 (PDT) MIME-Version: 1.0 References: <20210409125732.376589-1-luca@lucaceresoli.net> In-Reply-To: <20210409125732.376589-1-luca@lucaceresoli.net> From: Adam Ford Date: Wed, 5 May 2021 07:59:25 -0500 Message-ID: Subject: Re: [PATCH] clk: vc5: fix output disabling when enabling a FOD To: Luca Ceresoli Cc: linux-clk , Michael Turquette , Stephen Boyd , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 7:57 AM Luca Ceresoli wrote: > > On 5P49V6965, when an output is enabled we enable the corresponding > FOD. When this happens for the first time, and specifically when writing > register VC5_OUT_DIV_CONTROL in vc5_clk_out_prepare(), all other outputs > are stopped for a short time and then restarted. > > According to Renesas support this is intended: "The reason for that is VC= 6E > has synced up all output function". > > This behaviour can be disabled at least on VersaClock 6E devices, of whic= h > only the 5P49V6965 is currently implemented by this driver. This requires > writing bit 7 (bypass_sync{1..4}) in register 0x20..0x50. Those register= s > are named "Unused Factory Reserved Register", and the bits are documented > as "Skip VDDO verification", which does not clearly explain the relati= on > to FOD sync. However according to Renesas support as well as my testing > setting this bit does prevent disabling of all clock outputs when enablin= g > a FOD. > > See "VersaClock =C2=AE 6E Family Register Descriptions and Programming Gu= ide" > (August 30, 2018), Table 116 "Power Up VDD check", page 58: > https://www.renesas.com/us/en/document/mau/versaclock-6e-family-register-= descriptions-and-programming-guide > Reviewed-by: Adam Ford > Signed-off-by: Luca Ceresoli > --- > drivers/clk/clk-versaclock5.c | 27 ++++++++++++++++++++++++--- > 1 file changed, 24 insertions(+), 3 deletions(-) > > diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.= c > index 344cd6c61188..3c737742c2a9 100644 > --- a/drivers/clk/clk-versaclock5.c > +++ b/drivers/clk/clk-versaclock5.c > @@ -69,7 +69,10 @@ > #define VC5_FEEDBACK_FRAC_DIV(n) (0x19 + (n)) > #define VC5_RC_CONTROL0 0x1e > #define VC5_RC_CONTROL1 0x1f > -/* Register 0x20 is factory reserved */ > + > +/* These registers are named "Unused Factory Reserved Registers" */ > +#define VC5_RESERVED_X0(idx) (0x20 + ((idx) * 0x10)) > +#define VC5_RESERVED_X0_BYPASS_SYNC BIT(7) /* bypass_sync bit */ > > /* Output divider control for divider 1,2,3,4 */ > #define VC5_OUT_DIV_CONTROL(idx) (0x21 + ((idx) * 0x10)) > @@ -87,7 +90,6 @@ > #define VC5_OUT_DIV_SKEW_INT(idx, n) (0x2b + ((idx) * 0x10) + (n)) > #define VC5_OUT_DIV_INT(idx, n) (0x2d + ((idx) * 0x10) + = (n)) > #define VC5_OUT_DIV_SKEW_FRAC(idx) (0x2f + ((idx) * 0x10)) > -/* Registers 0x30, 0x40, 0x50 are factory reserved */ > > /* Clock control register for clock 1,2 */ > #define VC5_CLK_OUTPUT_CFG(idx, n) (0x60 + ((idx) * 0x2) + (n)) > @@ -140,6 +142,8 @@ > #define VC5_HAS_INTERNAL_XTAL BIT(0) > /* chip has PFD requency doubler */ > #define VC5_HAS_PFD_FREQ_DBL BIT(1) > +/* chip has bits to disable FOD sync */ > +#define VC5_HAS_BYPASS_SYNC_BIT BIT(2) > > /* Supported IDT VC5 models. */ > enum vc5_model { > @@ -581,6 +585,23 @@ static int vc5_clk_out_prepare(struct clk_hw *hw) > unsigned int src; > int ret; > > + /* > + * When enabling a FOD, all currently enabled FODs are briefly > + * stopped in order to synchronize all of them. This causes a clo= ck > + * disruption to any unrelated chips that might be already using > + * other clock outputs. Bypass the sync feature to avoid the issu= e, > + * which is possible on the VersaClock 6E family via reserved > + * registers. > + */ Thanks for the comments here. I with IDT/Renesas would better document this. I might see if I can convince one of the hardware guys at my office to test the impact of radiated emissions. > + if (vc5->chip_info->flags & VC5_HAS_BYPASS_SYNC_BIT) { > + ret =3D regmap_update_bits(vc5->regmap, > + VC5_RESERVED_X0(hwdata->num), > + VC5_RESERVED_X0_BYPASS_SYNC, > + VC5_RESERVED_X0_BYPASS_SYNC); > + if (ret) > + return ret; > + } > + > /* > * If the input mux is disabled, enable it first and > * select source from matching FOD. > @@ -1166,7 +1187,7 @@ static const struct vc5_chip_info idt_5p49v6965_inf= o =3D { > .model =3D IDT_VC6_5P49V6965, > .clk_fod_cnt =3D 4, > .clk_out_cnt =3D 5, > - .flags =3D 0, > + .flags =3D VC5_HAS_BYPASS_SYNC_BIT, > }; > > static const struct i2c_device_id vc5_id[] =3D { > -- > 2.25.1 >