Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2931147imm; Thu, 24 May 2018 19:17:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrU+tdheWLlTSvFPNylhGVE/foP1VcrSBV8vX9SfYv03G7SwGIMsee9CpDHZO3hhf94t4Wt X-Received: by 2002:a63:951c:: with SMTP id p28-v6mr427322pgd.318.1527214670972; Thu, 24 May 2018 19:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527214670; cv=none; d=google.com; s=arc-20160816; b=UGXHfp+fNN8CS4q6rowhVYH7T8+uFoVUQr5hTx96i37pgnwtcQ2UahUkHE/WDkvdGp E4Uw8sKgsgOJ+8z35BBO6QhO6BTmff7o5Moi3XXPcToqasN42WEVFiMcuXNVJmnWs5wR rPXtR0OsztIp8UHWN4FnVjmYjjOr8InbctX02/s+MGT0e/89pRwuo0O23A2hBEsDoQ7E QYjdjyRWE4Y/l57I9zUG3yep3uQN0MqNIfdvJ5HrPX+lN+mdfAfIwI//Hhk8VdROZgpO 7D/ZTvrvIzBfUi14XYZyQgD9q8PjInEVCYaE15065rL/lpjpHGvSxxaN3tc6RVNOhCqz S+Wg== 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 :dkim-signature:arc-authentication-results; bh=5Z/0X7Og8KFERpdQQq03jzCfoL9H6BIHKCNESr35fnE=; b=0IpFXHP4RqhqiGJjTjLi5fqANeAj/atVRCnrYN9bHaHm6byZ08Lcev3F8kS/cO1CSr 8n1442vcyKQVhjSEfgshQpOtJkwy97OAAjyYKnAIOfCJ22Jhpm9kg356pjXi22pTEuCp DOg8Jn2MKTbuCHBaqv/OZyGPHAa1GmG5vP51FjZAkqgUomfvM3AVx2yjqzOG+6bvXQJ5 FZYmxn98q0eJ5PYX9Yw9aLPTqbWonHYlcPmDnjo/NYokOqdZ08JxtVywusrsyaG3iWwq SNm748H+FkCb/AxSpVkjtuwKuBWAIpCGbRFlRKAW6To6YPuIoSOQdAaRUHJ4XRByZFZ1 jXvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=h5yiRh6s; 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 j6-v6si22715771pfb.25.2018.05.24.19.17.36; Thu, 24 May 2018 19:17:50 -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=h5yiRh6s; 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 S965943AbeEXOyE (ORCPT + 99 others); Thu, 24 May 2018 10:54:04 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38434 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965332AbeEXOyA (ORCPT ); Thu, 24 May 2018 10:54:00 -0400 Received: by mail-wm0-f67.google.com with SMTP id m129-v6so6127041wmb.3 for ; Thu, 24 May 2018 07:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Z/0X7Og8KFERpdQQq03jzCfoL9H6BIHKCNESr35fnE=; b=h5yiRh6s4veYsPBRvy0UhLbI7rgjLablDZ8H3paD0jMgte6kP17UK6guPINNwKhRHR 4FPkTXHbWgXNLGtkXFCs76z1t4yc3QZvmG+sfqH+W/yapfPSV3mXrOND8IIRZjzFWY5m H+9pD8gd3jCf9q9x6BhlD4M51Y1Y3o5zcF55sp9T+WU/drEXj0cJwThG+y8K7W2/eThb 6kGBvjAP5tZrGbMdVW/cvAzkDesqZbmsf4qtUQsYv0oIcEfAoZN6oJJHEn2Wk1CIIL9J t1uQbmtL/si27xMDD08WtqW2l/ChCND7Lu/r67abxkWT/OH1DvvsZcdmEz9XVnNSl62W xIzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Z/0X7Og8KFERpdQQq03jzCfoL9H6BIHKCNESr35fnE=; b=Y+Af9ltTzFeSBJb9PS1j4OM9mMvj7NYvnA5mMy0Hdnh4jSTHSEnQ4q3lXpBPTbEOyC EL2XfgSrtrzkQh5uww9S/QjodPjPc+Yggrqd4FUO4qouxRZfmSuaB/qyCggNraJ6jDMl UvlvtC4PuhkX58mpoTVy8Sut4vkmcnOjKt/iFOtHtBwqiXFt3h57hVxGvByDAsfq5bBQ 7JfOkH0Wr4W01YnADv01ZwixArXyvqu0f3/xWYY4ZWRHcWG9j80hJVjz7UFgkS4S4Zv8 4Zg4vN5NsXWHxFlJZzjnn2THSvsS8rxdY6ik2qVRk1eO5x+5js8plIUNVp2NTesgT93f ibIg== X-Gm-Message-State: ALKqPwclIz9LQ0JPe3x8533qqqHrXktvuZfYItiRYFe0BFk3XsoLGXRC Tf0pKLOBf8LXRQ2wHqun4Ea44w== X-Received: by 2002:a1c:6ce:: with SMTP id 197-v6mr7279314wmg.159.1527173638992; Thu, 24 May 2018 07:53:58 -0700 (PDT) Received: from boomer ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id l69-v6sm6353211wmb.6.2018.05.24.07.53.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 07:53:58 -0700 (PDT) Message-ID: <1527173636.2822.66.camel@baylibre.com> Subject: Re: [PATCH v5 00/10] clk: implement clock rate protection mechanism From: Jerome Brunet To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King , Linus Walleij , Quentin Schulz , Kevin Hilman , Maxime Ripard Date: Thu, 24 May 2018 16:53:56 +0200 In-Reply-To: <20180423182136.43156.94025@harbor.lan> References: <20171201215200.23523-1-jbrunet@baylibre.com> <151373031022.33554.13905466641279532222@resonance> <20171222021520.GO7997@codeaurora.org> <1517217778.3153.1.camel@baylibre.com> <20180201174307.GC23162@codeaurora.org> <1517575828.3153.23.camel@baylibre.com> <20180423182136.43156.94025@harbor.lan> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 (3.26.6-1.fc27) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-04-23 at 11:21 -0700, Michael Turquette wrote: > Quoting Jerome Brunet (2018-02-02 04:50:28) > > On Thu, 2018-02-01 at 09:43 -0800, Stephen Boyd wrote: > > > > > > Applied to clk-protect-rate, with the exception that I did not apply > > > > > > "clk: fix CLK_SET_RATE_GATE with clock rate protection" as it breaks > > > > > > qcom clk code. > > > > > > > > > > > > Stephen, do you plan to fix up the qcom clock code so that the > > > > > > SET_RATE_GATE improvement can go in? > > > > > > > > > > > > > > > > I started working on it a while back. Let's see if I can finish > > > > > it off this weekend. > > > > > > > > > > > > > Hi Stephen, > > > > > > > > Have you been able find something to fix the qcom code regarding this issue ? > > > > > > > > > > This is what I have. I'm unhappy with a few things. First, I made > > > a spinlock for each clk, which is overkill. Most likely, just a > > > single spinlock is needed per clk-controller device. Second, I > > > haven't finished off the branch/gate part, so gating/ungating of > > > branches needs to be locked as well to prevent branches from > > > turning on while rates change. And finally, the 'branches' list is > > > duplicating a bunch of information about the child clks of an > > > RCG, so it feels like we need a core framework API to enable and > > > disable clks forcibly while remembering what is enabled/disabled > > > or at least to walk the clk tree and call some function. > > > > Looks similar to Mike's CCR idea ;) > > Giving clk provider drivers more control over the clocks that they > provide is a similar concept, but the ancient ccr series dealt almost > exclusively with set_rate and set_parent ops. > > > > > > > > > The spinlock per clk-controller is duplicating the regmap lock we > > > already have, so we may want a regmap API to grab the lock, and > > > then another regmap API to do reads/writes without grabbing the > > > lock, and then finally release the lock with a regmap unlock API. > > > > There is 'regsequence' for multiple write in a burst, but that's only if you do > > write only ... I suppose you are more in read/update/writeback mode, so it > > probably does not help much. > > > > Maybe we could extend regmap's regsequence, to do a sequence of > > regmap_update_bits() ? > > > > Another possibility could be to provide your own lock/unlock ops when > > registering the regmap. With this, you might be able to supply your own spinlock > > to regmap. This is already supported by regmap, would it help ? > > Stephen, was there ever an update on your end? This patch has been > dangling for a while and I thought it was time to ping on it. > > Regards, > Mike Mike, Stephen, The patch as been sitting on list for 6 months now and CLK_SET_RATE_GATE still does not really do what it should, at least not completely. How can we progress on this ? As explained in this mail [0] from March, I think there is a fairly simple way to deal with platforms relying on the broken implementation, such as qcom and the mmci driver. [0]: https://lkml.kernel.org/r/1522398050.3871.12.camel@baylibre.com Regards Jerome > > > > > > This part is mostly an optimization, but it would be nice to have > > > so that multiple writes could be done in sequence. This way, the > > > RCG code could do the special locking sequence and the branch > > > code could do the fire and forget single bit update. > >