Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1376407ybe; Mon, 2 Sep 2019 20:09:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJwrtANJ7iQ34RczC9swdeLsUKlqP17ZOARq1PmHzfpP6qVZOHgJcqww4Zy9fbFAerE8dZ X-Received: by 2002:a17:90a:b383:: with SMTP id e3mr377144pjr.85.1567480166228; Mon, 02 Sep 2019 20:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567480166; cv=none; d=google.com; s=arc-20160816; b=SbgUCGKRJkypLewkZCqfku2w473yPiaXWRkkviUoI3/6BjLli0fnEDOIruUw27WPWd 2E1eXJJB6hzUPmT7SPpARt/AHPNiRVLEve4k6V1yug8FqGo8G4l44KTRBGS/jOfbeZCh ih1gHGaz42lqQP49s5XLD7gBRJopFAJz0blBoc6DfLVWje4trwa53NuxNv1b38gl0Fl3 XZveLO6imlPMchH/DyXLNPWqd8NhI94PDOg52EELDoxVEkBSvN+pZqRwPpWpS3T5Dtj5 R/E4/2rv3AnSH4sQGLlwkogGrLWHsoFVMAn1Blfyoq9k4Lm6+CuYw4+XdfUEGId2EDXa kKrg== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=jpUWmMKWwTjPAKG0i0d13RWinkPFdzMtGo3lQyyTEPM=; b=lHbMUOJHMDe0S07XU3SrlA18vE4Wg/n6yhwk/c8M7NwWVFKNSrbtkvF705njOXUbh8 lb5YwXhUzl4GhUuqPlP/0zgwPyTpF0IvpWliJPU0/HhrlodgHCTkUL5gDUQIPCelr+NA McnKWu50nGhD2ACCsgE1xr5dVsK5m8T9P+6cObQVzmsVfHIhf/7z5XbMLCcT/WXCsREx 8zL0Cd4Z5G5CjvuWcQ/o5Yl3KAJnPMtlL9MZZ2tz1+aNpxFILYp+/wl4mrgObY5MXFEj SgQeYSXG/7X3h4pubnekYPbFcoI07ZrME+YWSTSRcjfF/yN0GPYqDO3grsa5LGcL16Mn 7cww== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si13425583pgu.504.2019.09.02.20.09.10; Mon, 02 Sep 2019 20:09:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725994AbfICDIT (ORCPT + 99 others); Mon, 2 Sep 2019 23:08:19 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:39245 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725813AbfICDIS (ORCPT ); Mon, 2 Sep 2019 23:08:18 -0400 X-UUID: 5512fba9b63b4a1a9c449cfd92584e64-20190903 X-UUID: 5512fba9b63b4a1a9c449cfd92584e64-20190903 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1278790854; Tue, 03 Sep 2019 11:08:12 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 3 Sep 2019 11:08:07 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 3 Sep 2019 11:08:07 +0800 Message-ID: <1567480086.22890.21.camel@mtksdaap41> Subject: Re: [RFC v1] clk: core: support clocks that need to be enabled during re-parent From: Weiyi Lu To: Stephen Boyd CC: Matthias Brugger , James Liao , Fan Chen , , , , , , Biao Huang Date: Tue, 3 Sep 2019 11:08:06 +0800 In-Reply-To: <20190626035246.4591A20659@mail.kernel.org> References: <1560138293-4163-1-git-send-email-weiyi.lu@mediatek.com> <20190625221415.B0DC22086D@mail.kernel.org> <1561511122.24282.10.camel@mtksdaap41> <20190626035246.4591A20659@mail.kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-06-25 at 20:52 -0700, Stephen Boyd wrote: > Quoting Weiyi Lu (2019-06-25 18:05:22) > > On Tue, 2019-06-25 at 15:14 -0700, Stephen Boyd wrote: > > > Quoting Weiyi Lu (2019-06-09 20:44:53) > > > > When using property assigned-clock-parents to assign parent clocks, > > > > core clocks might still be disabled during re-parent. > > > > Add flag 'CLK_OPS_CORE_ENABLE' for those clocks must be enabled > > > > during re-parent. > > > > > > > > Signed-off-by: Weiyi Lu > > > > > > Can you further describe the scenario where this is a problem? Is it > > > some sort of clk that is enabled by default out of the bootloader and is > > > then configured to have an 'assigned-clock-parents' property to change > > > the parent, but that clk needs to be "enabled" so that the framework > > > turns on the parents for the parent switch? > > > > When driver is built as module(.ko) and install at runtime after the > > whole initialization stage. Clk might already be turned off before > > configuring by assigned-clock-parents. For such clock design that need > > to have clock enabled during re-parent, the configuration of > > assigned-clock-parents might be failed. That's the problem we have now. > > Great. Please put this sort of information in the commit text. > OK, I'll do when sending next version. > > Do you have any suggestion for such usage of clocks? Many thanks. > > > > Ok, and in this case somehow CLK_OPS_PARENT_ENABLE flag doesn't work? Is > that because the clk itself doesn't do anything unless it's enabled? I > seem to recall that we usually work around this by caching the state of > the clk parents or frequencies and then when the clk prepare or enable > op is called we actually write the hardware to change the state. There > are some qcom clks like this and we basically just use the hardware > itself to cache the state of the clk while it hasn't actually changed to > be at that rate, because the clk is not enabled yet. > Hi Stephen, Will you recommend if we cache the state in the platform driver instead of the hardware itself and then change the state when clk enable op is called if we don't have such hardware design on MTK clocks? > The main concern is that we're having to turn on clks to make things > work, when it would be best to not turn on clks just so that register > writes actually make a difference to what the hardware does. > In my view, it's a safe operation to enable clock shortly to make things work when its child clock is still disabled. What do you think?