From patchwork Wed Mar 13 16:35:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 10851467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 640641669 for ; Wed, 13 Mar 2019 16:36:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F68328889 for ; Wed, 13 Mar 2019 16:36:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 436DD289AF; Wed, 13 Mar 2019 16:36:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E02C328889 for ; Wed, 13 Mar 2019 16:36:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbfCMQgT (ORCPT ); Wed, 13 Mar 2019 12:36:19 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:42669 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfCMQgT (ORCPT ); Wed, 13 Mar 2019 12:36:19 -0400 Received: from localhost (alyon-652-1-66-9.w109-213.abo.wanadoo.fr [109.213.209.9]) (Authenticated sender: gregory.clement@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 9191620000E; Wed, 13 Mar 2019 16:36:12 +0000 (UTC) From: Gregory CLEMENT To: Stephen Boyd , Mike Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, Christian Neubert , Ilias Apalodimas , Vincent Guittot , Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Gregory CLEMENT , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, Antoine Tenart , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Maxime Chevallier , stable@vger.kernel.org Subject: [PATCH] clk: mvebu: armada-37xx-periph: Fix initialization for cpu clocks Date: Wed, 13 Mar 2019 17:35:58 +0100 Message-Id: <20190313163558.6705-1-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The clock parenting was not setup properly when DVFS was enabled. It was expected that the same clock source was used with and without DVFS which was not the case. This patch fixes this issue, allowing to make the cpufreq support work when the CPU clocks source are not the default ones. Fixes: 92ce45fb875d ("cpufreq: Add DVFS support for Armada 37xx") Cc: Reported-by: Christian Neubert Reported-by: Ilias Apalodimas Signed-off-by: Gregory CLEMENT --- drivers/clk/mvebu/armada-37xx-periph.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index 1f1cff428d78..26ed3c18a239 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c @@ -671,6 +671,17 @@ static int armada_3700_add_composite_clk(const struct clk_periph_data *data, map = syscon_regmap_lookup_by_compatible( "marvell,armada-3700-nb-pm"); pmcpu_clk->nb_pm_base = map; + + /* + * Use the same parent when DVFS is enabled that the + * default parent received at boot time. When this + * function is called, DVFS is not enabled yet, so we + * get the default parent and we can set the parent + * for DVFS. + */ + if (clk_pm_cpu_set_parent(muxrate_hw, + clk_pm_cpu_get_parent(muxrate_hw))) + dev_warn(dev, "Failed to setup default parent clock for DVFS\n"); } *hw = clk_hw_register_composite(dev, data->name, data->parent_names,