Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp979237ybe; Thu, 19 Sep 2019 06:55:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDEn+qWfRy8SSDv9adUyzVXhpl/9c40i+qHARCZZYoXVRFxwuGuTodNWU3nUisyeZgNZu2 X-Received: by 2002:a17:906:c787:: with SMTP id cw7mr1787344ejb.34.1568901345528; Thu, 19 Sep 2019 06:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568901345; cv=none; d=google.com; s=arc-20160816; b=BbEYdNZYqi5blL3ASErrpRoI6d9rbjtriUjQuidalt0u+No23e0kBINHqU5uEFapJ0 zeG+K2z6LrUvg3B31OMVk3sdaGwHFzHE8JNrfxWfo6Jo+3Cmld1huNIXLPIIndN/GAu0 Jp7cp2pNu6S5xlM6kyCwqRxBH2G4eQHeUjo9GpOkqh/ensLL4cgnh2bjzTxREU7iMOOQ xUNLjuUEYkrzWpaxsERrM1qufUSntvL/5hlaR5uKChCldVqabjeAb3Pcb6wU0AuQEwmQ 1Yb/UxnsEHDeZsE0ki6RRrakOAAHakZJWtq1fQwo+2Z5UxYcCv311ZS0mvW823EiRKAZ uefQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=T/oUm0WVxShCr4Uz7hk8J9IALquJO7fiM1qSUhv05Fw=; b=xo+HkQCSijvtlT+oL2tkr8fuc65xHwllcOF4sy9D4XBgWk2fB+eqSUepaDyDKIWPLK PQ5wDxY6B5fO+ZIavPvazkCvofM2LeD+oayy7ndqp9IdfjKsB5DmoTzttg6Y1fTg/5pw X35eZzRLLCMVyz+1A7/mUq79TFcfnU/GeUICCnkEn9rktpGRZ4XKL7nc9R6Utn+EXz0B 89djk3RKtPy8NJYR0lMjaFuBfeN90jK2hXM3qq6bbznH3wVHke0OCA4XIAhbkk7h/J7a 3w6t4/w0Dq1dQjOaH8n+yJPsHEyj1QHARTPAUvMGVeUIv3pBTLcrssLjbbA44crr8EUo ITsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hn5Featf; 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 b1si5510104edm.271.2019.09.19.06.55.22; Thu, 19 Sep 2019 06:55:45 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=hn5Featf; 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 S2389596AbfISNBc (ORCPT + 99 others); Thu, 19 Sep 2019 09:01:32 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40590 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388246AbfISNBc (ORCPT ); Thu, 19 Sep 2019 09:01:32 -0400 Received: by mail-wr1-f67.google.com with SMTP id l3so2994245wru.7 for ; Thu, 19 Sep 2019 06:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=T/oUm0WVxShCr4Uz7hk8J9IALquJO7fiM1qSUhv05Fw=; b=hn5FeatfnL4cSmnI9pQY3P9osYNKz/jSMr9nvitnLWGqkM6yvb/KGWYyxLf0EWZMEI KgwmvOwSr91t9Mdl7+1BaWEye0QJfGIrTU3vNMygFbaStWk0TycOssQlLpCEvM/clXy+ 3c3DwwJsbMG7A8Q9+NOW0CeeOeSpBuu+QCb79uhRFq52xorUxM7W5ZX6CRCE0mcZhwO7 ervFdUK+7qMMaDaMDg9nDlOQ4Qdivk2ccaWWMpBlMbmTOcQmIvHKqKAi5f2OioQOt96K 6MzEc5hr0Hxo8IPf6+sVZSw0qiqkjUIhdcrxZWM2/ugwrQApKhoIZA2uC/hFihcP+ihK Wwzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=T/oUm0WVxShCr4Uz7hk8J9IALquJO7fiM1qSUhv05Fw=; b=XM5qYuaNIHpsw38T7MD+ig8EoVBWtQuZ2VVkvlf0z12vAod/oH4OxXmvA0fUKCPQ1v 7tBYuSFRaaZjHcTwdpdhAeEeoRAgUdKeWbVUkky8Mbpq0uoRuRN8UuONq1t6vg8zF3RS 4U8VTN/IGKth8dMHTrNPXT7vHS3AQnl2k7swBF37OdCSwIXIIcS8X473MOX/H5xpdicL 2l32few+R+sgxpLDb6pJ2//VIseliujUU2OIuE0gtTf0faJqLDTQTCkWCgqThnN7oE+V MHbYS2L4XlbAzO1oaEF0xL6uTHvQGmnEeVCEQ+QDfeJEI3vu5zNjVA7ONED2sKFYRPQ+ dxEg== X-Gm-Message-State: APjAAAURHTPyHSMRD5nXJ6Il6hOpnB0n0ungeUu2dNvZUHO8odqPWOyS FpElk7Lz2J2VegpufBx1CzEJuQ== X-Received: by 2002:adf:e485:: with SMTP id i5mr1971966wrm.175.1568898090150; Thu, 19 Sep 2019 06:01:30 -0700 (PDT) Received: from localhost (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a18sm20259922wrh.25.2019.09.19.06.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 06:01:29 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong , Stephen Boyd Cc: Neil Armstrong , linux-clk@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] clk: meson: clk-pll: always enable a critical PLL when setting the rate In-Reply-To: <20190919093809.21364-1-narmstrong@baylibre.com> References: <20190919093627.21245-1-narmstrong@baylibre.com> <20190919093809.21364-1-narmstrong@baylibre.com> Date: Thu, 19 Sep 2019 15:01:28 +0200 Message-ID: <1j1rwce8yf.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 19 Sep 2019 at 11:38, Neil Armstrong wrote: > Make sure we always enable a PLL on a set_rate() when the PLL is > flagged as critical. > > This fixes the case when the Amlogic G12A SYS_PLL gets disabled by the > PSCI firmware when resuming from suspend-to-memory, in the case > where the CPU was not clocked by the SYS_PLL, but by the fixed PLL > fixed divisors. > In this particular case, when changing the PLL rate, CCF doesn't handle > the fact the PLL could have been disabled in the meantime and set_rate() > only changes the rate and never enables it again. > > Fixes: d6e81845b7d9 ("clk: meson: clk-pll: check if the clock is already enabled') > Signed-off-by: Neil Armstrong > --- > drivers/clk/meson/clk-pll.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c > index ddb1e5634739..8c5adccb7959 100644 > --- a/drivers/clk/meson/clk-pll.c > +++ b/drivers/clk/meson/clk-pll.c > @@ -379,7 +379,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, > } > > /* If the pll is stopped, bail out now */ > - if (!enabled) > + if (!(hw->init->flags & CLK_IS_CRITICAL) && !enabled) This is surely a work around to the issue at hand but: * Enabling the clock, critical or not, should not be done but the set_rate() callback. This is not the purpose of this callback. * Enabling the clock in such way does not walk the tree. So, if there is ever another PSCI Fw which disable we would get into the same issue again. IOW, This is not specific to the PLL driver so it should not have to deal with this. Since this clock can change out of CCF maybe it should be marked with CLK_GET_RATE_NOCACHE ? When CCF hits a clock with CLK_GET_RATE_NOCACHE while walking the tree, in addition to to calling get_rate(), CCF could also call is_enabled() if the clock has CLK_IS_CRITICAL and possibly .enable() ? Stephen, what do you think ? > return 0; > > if (meson_clk_pll_enable(hw)) { > -- > 2.22.0