Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp600739ybz; Wed, 15 Apr 2020 14:55:27 -0700 (PDT) X-Google-Smtp-Source: APiQypJi/zgdoycJMjum/p7oniCnaAD7GhKZTXCuTe5blkztZLEeC2IobquBGFW+w9RJkTWLu1Tr X-Received: by 2002:aa7:c649:: with SMTP id z9mr12698715edr.288.1586987727430; Wed, 15 Apr 2020 14:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987727; cv=none; d=google.com; s=arc-20160816; b=GJYJ5+KwqLwN3Z7o8j3SNbGGHt/bwCa2YBzGgk/xTiIdgZzgZzymmvb6qGvMQk+sUV XZUujQ3dmLyuoW6+1c5ybAOXBbpHEG9mY5J2Bt6Dnx2w93T6wE8TL+8fQOsM4sIp3ZU4 DCOsddjRyOnFUFKiNgPgIh+eY7EHa+I0M1CR2eMUncJFfy23RDBGeg0yMI11mJvsykl1 OWscWQfxeH2vwi5WoC+34u0l/gGGs6X7nhEklUMLzq2Ld9unot7MeW7y1Rjf1wC92eyV uIlmx2WHHUXs1Ogs11Lo0heF+59b+vBVsMbnPOogpVssZHkeUIlu4ATjD/zjxtAZu4SE ujdQ== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=buqvW+rh8aGkpkt6IACKm4M4fmbaWcmA3j17X8abtHA=; b=wEZ+Cdnno4x5yoWWuBu1tkfzpMxa+KJgC7KbsC0pR6PXB7gMotY2B1BbrE57DrJpr1 3dK5WRHtWUqZURTA1xpAH1bT0zdvgIV6tIJFrp7Kp2m0oVQdbCEqYuTZN5Rr/fA6twtk yuSpPWnIWfvlw3b6+h8vCPwBfN1TjnswIL97klQnyePllPxghvTQ94lsHm/wPBbWXkhO a/9QF7XWqImKUxWJrbPVi/3F3zvpGrX7UtLwduE570eI9dZwmBPNg3HGWyP6jDH3BO7U x1YY7HWi89KwwprjgKi3XEmY98x0xMMDUEYVl+e19p/cbeuYURobmovl1JOsC+HXikc1 SjJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="bS3/ROK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ot21si10371045ejb.351.2020.04.15.14.55.04; Wed, 15 Apr 2020 14:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="bS3/ROK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505218AbgDNTwa (ORCPT + 99 others); Tue, 14 Apr 2020 15:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2391640AbgDNTvU (ORCPT ); Tue, 14 Apr 2020 15:51:20 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD36C061A41; Tue, 14 Apr 2020 12:51:19 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id y24so15675050wma.4; Tue, 14 Apr 2020 12:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=buqvW+rh8aGkpkt6IACKm4M4fmbaWcmA3j17X8abtHA=; b=bS3/ROK/sffJXwV2Rj/G7kYPdJZgF8fmwMTwrUtrs4+TIJR2cD/R+dEM9aVovzLVRM pzi6C1aISUmH8ksCMqc3gm92h6/1Uq8KKn0Ypay5lSIl6V0owSap/QGLjCyAEDMtl9o6 SvQfNryeGB2JDGc2JKmDQnnlG9ddJz20U/gsG38nHZiN4+dklzXWfw6u103Bhu/aYtaf fCQxZFaTuYaQkzteOC0UIk22jXkpuYCJ6YawiGWnZMX2ABBTggi9qPxxFLTGK17AQK6H IDjnwSBJg3aGm5n9ZaxVo+Ni4nS3685k7fXE8zp2to0b41sTjZWj6gWmZv4f6Y1CAxKC KI9g== 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:mime-version:content-transfer-encoding; bh=buqvW+rh8aGkpkt6IACKm4M4fmbaWcmA3j17X8abtHA=; b=DUg7+C+PbZMtyN5Kfzk2QaGjdYEniydwpv6RGVNufp11q9V8MB4RVmMX75J6peI9s9 4sk0yucc4VVKw+ymzleA3OCu+WG2XuBB/xFriDQrHgoFdDKcyfgf0w2frSWX0kYsxAkF /ARkLO89nWnL46Uo0UiOpup0acKN2fvjMahSl9KJBk6f+Tbe95eNgLEMwIV4jz5dSX3N NOIfW+Z5j+qbwJnGgJFvGDSIeZpKvZ5iJbJ75AN5sBJpUlHIC5CZmBJiUU5BYuGMdSvm P3v2SxZgq8QMaB+oqW9c20ZOwyBMH8UfeB5+Hn64kr4EhYD873nmKu49LOsAYyAtr7GH heOQ== X-Gm-Message-State: AGi0PuaCl8WBVvBPHy2G0PgyJySXGJfvf0B7h04mao7wUkU2N3CDA1pD SqX1z5qqJwq1U39xqFsBloY= X-Received: by 2002:a1c:f20c:: with SMTP id s12mr1544202wmc.83.1586893877796; Tue, 14 Apr 2020 12:51:17 -0700 (PDT) Received: from localhost.localdomain (p200300F13717DF00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3717:df00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id s14sm20886844wme.33.2020.04.14.12.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 12:51:17 -0700 (PDT) From: Martin Blumenstingl To: jbrunet@baylibre.com, linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org Cc: narmstrong@baylibre.com, mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v2 1/2] clk: meson: gxbb: Prepare the GPU clock tree to change at runtime Date: Tue, 14 Apr 2020 21:50:30 +0200 Message-Id: <20200414195031.224021-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200414195031.224021-1-martin.blumenstingl@googlemail.com> References: <20200414195031.224021-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "mali_0" or "mali_1" clock trees should not be updated while the clock is running. Enforce this by setting CLK_SET_RATE_GATE on the "mali_0" and "mali_1" gates. This makes the CCF switch to the "mali_1" tree when "mali_0" is currently active and vice versa, which is exactly what the vendor driver does when updating the frequency of the mali clock. Also propagate set_rate requests from the gate to the divider and from the divider to the the mux so the GPU clock frequency can be updated at runtime (which will be required for GPU DVFS). Don't propagate rate changes to the mux parents because we don't want to change the MPLL clocks (these are reserved for audio). Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/gxbb.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index 5fd6a574f8c3..0a68af6eec3d 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -957,7 +957,9 @@ static struct clk_regmap gxbb_sar_adc_clk = { /* * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) - * muxed by a glitch-free switch. + * muxed by a glitch-free switch. The CCF can manage this glitch-free + * mux because it does top-to-bottom updates the each clock tree and + * switches to the "inactive" one when CLK_SET_RATE_GATE is set. */ static const struct clk_parent_data gxbb_mali_0_1_parent_data[] = { @@ -980,14 +982,15 @@ static struct clk_regmap gxbb_mali_0_sel = { .hw.init = &(struct clk_init_data){ .name = "mali_0_sel", .ops = &clk_regmap_mux_ops, - /* - * bits 10:9 selects from 8 possible parents: - * xtal, gp0_pll, mpll2, mpll1, fclk_div7, - * fclk_div4, fclk_div3, fclk_div5 - */ .parent_data = gxbb_mali_0_1_parent_data, .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, + /* + * Don't request the parent to change the rate because + * all GPU frequencies can be derived from the fclk_* + * clocks and one special GP0_PLL setting. This is + * important because we need the MPLL clocks for audio. + */ + .flags = 0, }, }; @@ -1004,7 +1007,7 @@ static struct clk_regmap gxbb_mali_0_div = { &gxbb_mali_0_sel.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -1020,7 +1023,7 @@ static struct clk_regmap gxbb_mali_0 = { &gxbb_mali_0_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; @@ -1033,14 +1036,15 @@ static struct clk_regmap gxbb_mali_1_sel = { .hw.init = &(struct clk_init_data){ .name = "mali_1_sel", .ops = &clk_regmap_mux_ops, - /* - * bits 10:9 selects from 8 possible parents: - * xtal, gp0_pll, mpll2, mpll1, fclk_div7, - * fclk_div4, fclk_div3, fclk_div5 - */ .parent_data = gxbb_mali_0_1_parent_data, .num_parents = 8, - .flags = CLK_SET_RATE_NO_REPARENT, + /* + * Don't request the parent to change the rate because + * all GPU frequencies can be derived from the fclk_* + * clocks and one special GP0_PLL setting. This is + * important because we need the MPLL clocks for audio. + */ + .flags = 0, }, }; @@ -1057,7 +1061,7 @@ static struct clk_regmap gxbb_mali_1_div = { &gxbb_mali_1_sel.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -1073,7 +1077,7 @@ static struct clk_regmap gxbb_mali_1 = { &gxbb_mali_1_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; @@ -1093,7 +1097,7 @@ static struct clk_regmap gxbb_mali = { .ops = &clk_regmap_mux_ops, .parent_hws = gxbb_mali_parent_hws, .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; -- 2.26.0