From patchwork Fri Jan 5 17:09:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 123555 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1059918qgn; Fri, 5 Jan 2018 09:11:59 -0800 (PST) X-Google-Smtp-Source: ACJfBouT8BT4V0IA9X0EN8pbVrjKDcTT+I3yQ3W5rzoFAOETVH7Cnq6ZzK7liBdiwL6SVBdHn/C7 X-Received: by 10.159.204.129 with SMTP id t1mr3675729plo.2.1515172319835; Fri, 05 Jan 2018 09:11:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515172319; cv=none; d=google.com; s=arc-20160816; b=aqZXmY/l+uLRZ2CBfRoI/rfuptQ8AXqcD8spRYAZtYsqhDdD0ABfRuwLalHQ6GLNqB 1F31CClsMb7sKg1SQ+GBpvaZye2ox5UMXMAxEOQIIQyJSVbGC9vYQA4P0qMoQLETOn35 wVpeOY5zgyhCbLq1T+xdlBxQ43h2bvBG+4M9ycc+m0UjOl7YrbFf2Vpw3xy2H1P3dKls E1fNJ0SwW+PAqKSCLWCuSVYzcOvJwvoYZpc0vzamnugjTZuEIH7pmawxAMml35wK1Z22 Haqhw6G3ClomzAZ9eY0U0hyD9XZ2VJjEr2JgoN3UMucfGHuOVj9MqXI4idGvDSaGi7pw WzdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=3N8JT1SwGn68wR6NmiyAwGdx6SRhLnG6jQh9AJydHGg=; b=pXQWAimAlJJreoVXX4QoooPEklUQuciBjVaf8d+bk1CWjP8dAOOpzaQzUd4mH2SJZy Iv0iVUHDA6r2dnb+obbIolvjipqStPmHauy15kkz6a5ECxXOYGxiUESfX2RKQvehwk+g XHAC6iLDM0sNPJKf3NRONOonOM4lpNCxI9bdh2DOT13f2Mw7mmSaLnQm3HddaXC81WoA Z9ukgqtcTeWroIILHpg286FP5NfCn2YmSFzSeMqIC3nK6B6EIDHXonlZvKyJdxahi3+1 +s+aPw145kPBEYZdbL6Pt+BV69KFvv63WZZ2xpy9UnltORRcJtCWOxBGcrMEuoMEyK/P CvCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=TtN2eKPz; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 r74si4298031pfe.273.2018.01.05.09.11.59; Fri, 05 Jan 2018 09:11:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=TtN2eKPz; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752346AbeAERKG (ORCPT + 10 others); Fri, 5 Jan 2018 12:10:06 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45813 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279AbeAERKF (ORCPT ); Fri, 5 Jan 2018 12:10:05 -0500 Received: by mail-wr0-f196.google.com with SMTP id o15so4868189wrf.12 for ; Fri, 05 Jan 2018 09:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vhTiE1q+W9XLMnKuM8pGuls+KnGKWREcmhY32m5XW7A=; b=TtN2eKPzpFjCzkWFKt2Z158U3X+Uax/n0MZQhRdedfx7AFahGbpIzZN+LZLS2f86nH FkVDTDGM/PO5xn0SN0jqafjUWk5rN/S17BxnVyLqyiMwof5e5db8D/kfMj9nI9fxD85g uaTZkm5OxuzMDeW5qrfDFylon4iKYBGi42t3M8GEz187JZW/GIRjy8RJyNWyuYznMcbn QJBHTPy+apVLEO+a8GFEMHbtkJ9RU6zXCNulgxHzRjhGW9pUBME57VF6tMotg6k9MDl8 cZicKuKWdbqvm7oO7/YmdvWgzTaGRqpx2Zt5nzyGgLFkSBaJFrF4Vmti/q8l1HpbiknY /o0Q== 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:date:message-id:in-reply-to :references; bh=vhTiE1q+W9XLMnKuM8pGuls+KnGKWREcmhY32m5XW7A=; b=lWeZMtNkrf99KoQUY9r7FkvgKNlZChoysEJQEw8TaXJ6nDaBRxARTxStIu+7rr+nqj BPFN0bP05dA0nazLiEtMlQTqQecEnQ5nK2QmSWfNkhqxlVAMY1zSUTHPkHzbR4HXBZCp xteeFfCEFGirPNbz82zG7xJDhdmymiOAJquJ43445NSHJm0xL7RUOYvGRoCfWdLmLZ5u AydyJOufCubLN0WGPc8aNWpWXOweCK6J/ksz/VGyXkNj7keMdi5mdjsUNsov0ZRvFxbl +HLunJy0kRU3Nt3329dVkbXcncjYrIh0JchBQhzXEJtQLLE1ILElcEvSX0s/EG4fcEBu 5fiw== X-Gm-Message-State: AKGB3mJ5UJpYyDpqzWZzOt0uQeJU4dLxu7p1o15b2gjWFRQ7LpwaSxM3 jQNnJ63FohG0Oli4b1555E9iyw== X-Received: by 10.223.160.149 with SMTP id m21mr3215526wrm.112.1515172204475; Fri, 05 Jan 2018 09:10:04 -0800 (PST) Received: from boomer.baylibre.local ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id g17sm3263661wra.6.2018.01.05.09.10.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2018 09:10:03 -0800 (PST) From: Jerome Brunet To: Stephen Boyd , Michael Turquette , linux-clk@vger.kernel.org Cc: Jerome Brunet , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Vladimir Zapolskiy , Sylvain Lemieux , Andy Gross , David Brown Subject: [PATCH 1/5] clk: divider: read-only divider can propagate rate change Date: Fri, 5 Jan 2018 18:09:55 +0100 Message-Id: <20180105170959.17266-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180105170959.17266-1-jbrunet@baylibre.com> References: <20180105170959.17266-1-jbrunet@baylibre.com> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When a divider clock has CLK_DIVIDER_READ_ONLY set, it means that the register shall be left un-touched, but it does not mean the clock should stop rate propagation if CLK_SET_RATE_PARENT is set This is properly handled in qcom clk-regmap-divider but it was not in the generic divider Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1") Signed-off-by: Jerome Brunet --- drivers/clk/clk-divider.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Tested-by: David Lechner diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index b49942b9fe50..a851d3e04c7f 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -348,6 +348,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct clk_divider *divider = to_clk_divider(hw); + struct clk_hw *hw_parent = clk_hw_get_parent(hw); int bestdiv; /* if read only, just return current value */ @@ -356,6 +357,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, bestdiv &= div_mask(divider->width); bestdiv = _get_div(divider->table, bestdiv, divider->flags, divider->width); + + /* Even a read-only clock can propagate a rate change */ + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { + if (!hw_parent) + return -EINVAL; + + *prate = clk_hw_round_rate(hw_parent, rate * bestdiv); + } + return DIV_ROUND_UP_ULL((u64)*prate, bestdiv); }