Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5998449ybe; Tue, 10 Sep 2019 11:57:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6gHxuJjpbu8fGPqSx2rgX7Z8RUSgkXUrjEjXKYurLHRVBPX2AFN/SllNFw4b1eAXUdgbs X-Received: by 2002:a17:906:b896:: with SMTP id hb22mr26299972ejb.59.1568141851959; Tue, 10 Sep 2019 11:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141851; cv=none; d=google.com; s=arc-20160816; b=NQ9weHrYgrKwIsSqRMUQq1wNfstnE3eTJL3f0duJQnrE3oE+vgH6XodAC6cY9pKnhz jLuY8870UqZp1IiIl0Rq3cFZqn385wvWL+ZF9lZjWYHNsRsv/STaQK2034WmNZKeNYQc ZxG0yejkcPi278Eq1oaHK2ygzCX/1d5wj89wRKrbSFBkbUWMkKaHbZ1QLrtF4FKnxASf fZrvw/FljdHdYm2OPEG6CFaD7mXQJPq4g8hMxOCn7k75H9a2mFwxHAMYIO4JX3R801nd YyzsWPn2mmEOlpk01UEsyskkym7ZBiEaeVNhnpCe8tXZ5Z4gOW86QzozxNbGHxBKDFak ONSg== 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=Mp/+xh4B3lpSZPmUYL9dk1fTpKxVKAigwQspDwbteG4=; b=y6rzRPrHzXaakFROHNz340GjKLmOQ76ESloYGcu+NtyJjVi/MkNSRzKKETCTxA/iIg 5OvMLslzX5MFyMSyJ4p30DRoxaaG/6nGS4p57PiViCJd/23z8qSgFUY2fi1qRddqvbaa bLwnf3JaGvIXx5EEkWUtF2ymCbj+Bjvq1fgQxsmq4E1VwyE4MHBvvHrz9kUrVt+RS2ax s6ZVHPbTtkQtTvsJ5RJuky4zQ6hbyyZYUjKx1JG7a59+ShDKeYrOjq0TcMrjd2rgZP90 VtirlDY2DMC2IUllRLZFGSG7ZeDA52bGddxQjaD2W5mYvvOnPpq70lL3uEmmPQxY5P5N 9cRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sa7HyIV0; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si10038044ejq.314.2019.09.10.11.57.08; Tue, 10 Sep 2019 11:57:31 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=sa7HyIV0; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731845AbfIJLu1 (ORCPT + 99 others); Tue, 10 Sep 2019 07:50:27 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40549 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfIJLu0 (ORCPT ); Tue, 10 Sep 2019 07:50:26 -0400 Received: by mail-wr1-f66.google.com with SMTP id w13so19576782wru.7; Tue, 10 Sep 2019 04:50:24 -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; bh=Mp/+xh4B3lpSZPmUYL9dk1fTpKxVKAigwQspDwbteG4=; b=sa7HyIV0cMMHhgL1oWqjGwgDx6yJ6vvqgaCRI6+aVF6/EOgson57KX5taONf0xwhZc 1tj9JmDKUINzY4o7P0ZhBW9gvdwuWFZoa5FraxRlX46Y3xbGIUiXtBz8bmJl3e4YVsN2 KaLQXi4gy1N2kMStAOhOee9ajNjA2xn2QelLNQ3G76kGH/XIyjvf8QFDakFhQ3a8oViO foT1pNIPDEE+6AtOWPfcLkTx06a67K0AzOG6LqpRXIbptk9eHupVpHni78cO9Y6Ff31d RpmzI6X7ksKaQUorQnu+Fatg5ziWPviVAjqiYPCCzHsoX1xJ0TIF0P1Qa3NhxDdHIn9T tZhQ== 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=Mp/+xh4B3lpSZPmUYL9dk1fTpKxVKAigwQspDwbteG4=; b=Wj8eCn9JVviq4SVCNXkfUoET2CikTJTfUnFc+fGTn/RKwRv3DBSemGYFMZ6whYnP5Q 1OiLzNS3rlREOAKzaTOsFmsnOHOxYzyXj4mnKD6+PCfB5+8N3i13ICe999ZgtgWopfhW cXExPnnCDe4SxbNfSLUR3R5A4Lc9oZY8NBjjhBvpM4I/g/yijCIn4lvl2I03HiEK01UE FYJGMiAuGNsr6ldWPY3Bf05gfzeVmXqI861ueMroN3RnZgeK1Eg6cRJQiHIfnY4i1qQ5 t9+TlQk9LwxeRuCBEid7iYWt5N6Hi54bUPvuXT9GroLbK/WRdbqhgYFrNMPgBxmvo0Dj IggQ== X-Gm-Message-State: APjAAAVJYX2/inNIOoiRF87kAwTzysDXflpTXk/c9KwaUgyX6A/meVCS 1dPB8dTbxTLWS7wYGv8voUzK7rhqSTKhblb+CM0= X-Received: by 2002:a05:6000:142:: with SMTP id r2mr2208566wrx.212.1568116224155; Tue, 10 Sep 2019 04:50:24 -0700 (PDT) MIME-Version: 1.0 References: <1566936978-28519-1-git-send-email-peng.fan@nxp.com> <20190906172044.B99FB20838@mail.kernel.org> In-Reply-To: From: Daniel Baluta Date: Tue, 10 Sep 2019 14:50:12 +0300 Message-ID: Subject: Re: [PATCH] clk: imx: lpcg: write twice when writing lpcg regs To: Anson Huang Cc: Dong Aisheng , Stephen Boyd , Peng Fan , "festevam@gmail.com" , "mturquette@baylibre.com" , "s.hauer@pengutronix.de" , "shawnguo@kernel.org" , Aisheng Dong , "kernel@pengutronix.de" , dl-linux-imx , Jacky Bai , Abel Vesa , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@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, Sep 10, 2019 at 1:40 PM Anson Huang wrote: > > > > > On Sat, Sep 7, 2019 at 9:47 PM Stephen Boyd wrote: > > > > > > Quoting Peng Fan (2019-08-27 01:17:50) > > > > From: Peng Fan > > > > > > > > There is hardware issue that: > > > > The output clock the LPCG cell will not turn back on as expected, > > > > even though a read of the IPG registers in the LPCG indicates that > > > > the clock should be enabled. > > > > > > > > The software workaround is to write twice to enable the LPCG clock > > > > output. > > > > > > > > Signed-off-by: Peng Fan > > > > > > Does this need a Fixes tag? > > > > Not sure as it's not code logic issue but a hardware bug. > > And 4.19 LTS still have not this driver support. > > Looks like there is an errata for this issue, and Ranjani just sent a patch for review internally, > > Back-to-back LPCG writes can be ignored by the LPCG register due to a > HW bug. The writes need to be separated by atleast 4 cycles of the gated clock. > The workaround is implemented as follows: > 1. For clocks running greater than 50MHz no delay is required as the > delay in accessing the LPCG register is sufficient. > 2. For clocks running greater than 23MHz, a read followed by the write > will provide the sufficient delay. > 3. For clocks running below 23MHz, LPCG is not used. Lets add this information in the commit message and also enhance the comment before the double write. Also, why can't we add a udelay after the first write and remove the second write as having two writes for writing a value looks very un-natural.