Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp256736ybd; Tue, 25 Jun 2019 20:53:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNJEduZ+ws5TAWt9pOt/9o30HyYsRbe0rCi4YCHbnxZXqpCCbUd7LYWNJpuDZS8tqMIQop X-Received: by 2002:a63:1208:: with SMTP id h8mr575021pgl.377.1561521187338; Tue, 25 Jun 2019 20:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561521187; cv=none; d=google.com; s=arc-20160816; b=pcl0XVDx5I+KuxBd+UVgpWIKuqloEtB92PEHJ2oooPh0ZspJnIh3eJpaUlBUkXbnlD 5JME+WKrIOj6H/Uyn3d8TYILkxBWe4ZmOkYz2qWQLuzmxoW0/F4ZiTzzTlqgQm4vBWWe gp/pz56tv9T2+IeLMkPFwTefzGCPxReELFcIoW9ssqvOv1j+swNpvgj9J1d9DZO23me1 qukmKLgeu07+agc6O9ToNZEVptVZ4jrypEG23lRoed8A5jnf3w7OWAKWUuBAYCxLylY1 ok1lPvzw3DQMsJyf/k7jefHdWFB/1LC6Cdu1mZdc7kiIwNAWspWZyCUfDzjxGjPIiT93 t/Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:cc:subject :from:to:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=jaEEvSkybIYUYLERU8dvRG7Sz2NYCLoRzwpTdvAQDME=; b=Znrgr73ycBryZqFjODJObCa8Sv9BY1dv4sH3mjhFtrITpv1FgQzHSrsP1Lt7qsmOiL +w7BsLDRT8i6aGN09CB1dtSxGNjh1UbOJp7MwoVOz0PLk0WkUJYRQgT16pxRc4rvfOkS rTILq2DeFYLWH26kTh7rasoFkpgDq8M3OfWOjUi99kS3XZ8zWq2EH7yGHKjh9fnqmpXE iW4IhVcEpHTL0aGKkc5VloP2c5fzSVvRsvTZtrtI6U6qPcDSKsjruTR8uctq1eLNuirw ShnDo4Z/E2hKrANeYO4PD6FskoAyLapgH9Yib4S7uGRPOc5Px1i6/ZRNrmAu5K3d/YUY +quw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bPsaerdH; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si2023051pll.324.2019.06.25.20.52.51; Tue, 25 Jun 2019 20:53:07 -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=@kernel.org header.s=default header.b=bPsaerdH; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbfFZDwr (ORCPT + 99 others); Tue, 25 Jun 2019 23:52:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:38166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfFZDwr (ORCPT ); Tue, 25 Jun 2019 23:52:47 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4591A20659; Wed, 26 Jun 2019 03:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561521166; bh=YtbDfJl0BWbBYAdPqlHUFfwmDl41K3e4m55oYYuQFmo=; h=In-Reply-To:References:To:From:Subject:Cc:Date:From; b=bPsaerdHt5VMFIeTHZlGLf2VI08qXlLs9kDyiLi5peBR1pEi2qEpNBqFLRFqHt2tJ sJFDz0U1eeN6X9MULqO9W6PnSJib8wD826AlNWh7Kkis6a8vESxxO0+Po1znPJvX9G y06ljy6KIeOz0PidhfhJwl59jSvNEJSW2fiWZAC4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1561511122.24282.10.camel@mtksdaap41> References: <1560138293-4163-1-git-send-email-weiyi.lu@mediatek.com> <20190625221415.B0DC22086D@mail.kernel.org> <1561511122.24282.10.camel@mtksdaap41> To: Weiyi Lu From: Stephen Boyd Subject: Re: [RFC v1] clk: core: support clocks that need to be enabled during re-parent Cc: Matthias Brugger , James Liao , Fan Chen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-clk@vger.kernel.org, srv_heupstream@mediatek.com, Biao Huang User-Agent: alot/0.8.1 Date: Tue, 25 Jun 2019 20:52:45 -0700 Message-Id: <20190626035246.4591A20659@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > >=20 > > > Signed-off-by: Weiyi Lu > >=20 > > 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? >=20 > 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. > Do you have any suggestion for such usage of clocks? Many thanks. >=20 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. 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.