Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2893138ybb; Mon, 30 Mar 2020 15:25:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvqoKKQWx5c7f6mJhdN4bcltSzasTERoZne81cRoDw1ZdMGEdSHmEFmbWULONuA20SWIcra X-Received: by 2002:a05:6830:1e96:: with SMTP id n22mr10676179otr.189.1585607147706; Mon, 30 Mar 2020 15:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585607147; cv=none; d=google.com; s=arc-20160816; b=mvKB1EIkPN56k/zfSLaKLf0wBpxcDWbXT0Sm/1gxmuZY4IEE4JG4+DJDo7+3Wv6DYl 4k7A/0Ao8rMOdeOei/WfRodgqB32gEDxUo4UbszR5ev3ROQoKmbEelqC1cMFle3mVM4D KAbR+fhJAREdle9MUmnFWD5dcQdyt1CTF7VKQ+IhS1Mu0hobUEBfAb5GXQAf8/ZgyDY/ IgDj0imEcZTqgFG5jxD/dlxhyFlvRGAf7g666X/HpNhLfVP5N831+5pASlGfAiJGzuNd dkxRmXL9WoAUr5CiHgryh9Tul4rdwwhldBxm0tQv91jx4mvI4KqMjd+oTe0L1fJ3J6pE Bfkg== 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=MdDlaK3jLN/q9KcoyP33Chc7uvr3eCaMbY+7EESj0As=; b=stk6LdEAYzl4qlN5fyXnX8fU9Mn7n9GdRzxb+oq+YwUKZSfTnorpo0/v9m6ALM4NuL 6MJwJrBq8hLfFOKpLVftlnnRhSJ4rk2wfjy/KcjBr33nayNbO2C/+7OJpqiV5ONpbX6X sHLr694Cqh4yBDd4f7IjmB5NcOm2s4LYEHj7Y9eRUdauCpzFR9hojdHOki8Toz3WaMMe MN5pBKEPU+IHdroxm1AljjdYuJ0pHVBWnOaj3/wrh51YrdFJ5n3b+2klhlrBmDB6NX/V VAURN2rfW+wvzWq/LKwzw4q/HOHx3qV0yUTwkf3eUcDZTkD+V0wYWYFCHPCbwgC5HsRZ Fk6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=EejkddiJ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si6366960oig.212.2020.03.30.15.25.35; Mon, 30 Mar 2020 15:25:47 -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=@googlemail.com header.s=20161025 header.b=EejkddiJ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731002AbgC3WLf (ORCPT + 99 others); Mon, 30 Mar 2020 18:11:35 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36804 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728987AbgC3WLc (ORCPT ); Mon, 30 Mar 2020 18:11:32 -0400 Received: by mail-wr1-f66.google.com with SMTP id 31so23568696wrs.3; Mon, 30 Mar 2020 15:11:31 -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=MdDlaK3jLN/q9KcoyP33Chc7uvr3eCaMbY+7EESj0As=; b=EejkddiJCEPU8jCPYEqGgLrI766UTSVP81xsECLV/sI5ZxSNQI+IBeTYqywvQiQwpd jizrNf5HboqfV1xdwyv9bR/1B+GDxkQ/oNit9/Cz/4jFBonU7K4TuFHcUmoRDocz77mZ A7nfupQ7qilNBOA/PiQxGhiDHCtPuLDrMB+89iaatZlN1RkKwVLJRtgLbPFHII9JZOsV Fo/5pJ2w8Dx3lBz3om4roa1BHfL+JgvG86CwfM730MoQBABygMPLBBCbC3MMQoLrbZb7 /Gt4dwYUFDL8WRM5vsLMdpPIByS7GMShGaFjei5C5xaHLoQ9A1YxmbqURvF4UpI5omsn Pv/A== 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=MdDlaK3jLN/q9KcoyP33Chc7uvr3eCaMbY+7EESj0As=; b=hLr4YqLL6+DQAXwwilAMgCo7PPNWZydg8/Sis7QeBQbcupO9ENiPf7DzM32E/cdRnF Q9ijughANSFoseBBUgcrfjcb0MdXsLDZ7/3gOB3VOXfZJhn1CTYS+/INeV+8d6RHy6He W5d+KlOi02fCbj0rnrL7O1x1NK/eSiDZE31ZjDqz3Du8esnVyYIpTPTGzWXuiwRVIXqx 1MNNsdWqn/ZtKckbP5ynAZ3MUprYqN2UhEOx1ntflXmuIB0uNujJ4gK5Uc3e4+JAeFp/ sCr9FgMvKLAFGObkIw61hDNpjhSSyfiQNDxmPHi1N8ND8A+HYN8nyEpDv3uahiiEJGUu HLSw== X-Gm-Message-State: ANhLgQ17ywB+7M9OiPC2jTuGQjwpNx3inPLoRUh04x7RoYw+h+OyYVdt jUnkfQ1SZSrwDhe5P8UlfvE= X-Received: by 2002:a5d:5228:: with SMTP id i8mr17301089wra.156.1585606290341; Mon, 30 Mar 2020 15:11:30 -0700 (PDT) Received: from localhost.localdomain (p200300F13710ED00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3710:ed00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id b187sm1260509wmc.14.2020.03.30.15.11.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 15:11:29 -0700 (PDT) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, khilman@baylibre.com, jbrunet@baylibre.com, narmstrong@baylibre.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Martin Blumenstingl Subject: [RFC v1 2/5] clk: meson: g12a: Prepare the GPU clock tree to change at runtime Date: Tue, 31 Mar 2020 00:11:01 +0200 Message-Id: <20200330221104.3163788-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200330221104.3163788-1-martin.blumenstingl@googlemail.com> References: <20200330221104.3163788-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 populate set_rate requests from the divider to the mux so the GPU clock frequency can be updated at runtime (which will be required for GPU DVFS). Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/g12a.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index fad616cac01e..30c15766ebb1 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -3702,7 +3702,9 @@ static struct clk_regmap g12a_hdmi = { /* * 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 g12a_mali_0_1_parent_data[] = { { .fw_name = "xtal", }, @@ -3726,7 +3728,13 @@ static struct clk_regmap g12a_mali_0_sel = { .ops = &clk_regmap_mux_ops, .parent_data = g12a_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, }, }; @@ -3743,7 +3751,7 @@ static struct clk_regmap g12a_mali_0_div = { &g12a_mali_0_sel.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -3759,7 +3767,7 @@ static struct clk_regmap g12a_mali_0 = { &g12a_mali_0_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; @@ -3774,7 +3782,13 @@ static struct clk_regmap g12a_mali_1_sel = { .ops = &clk_regmap_mux_ops, .parent_data = g12a_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, }, }; @@ -3791,7 +3805,7 @@ static struct clk_regmap g12a_mali_1_div = { &g12a_mali_1_sel.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; @@ -3807,7 +3821,7 @@ static struct clk_regmap g12a_mali_1 = { &g12a_mali_1_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; @@ -3827,7 +3841,7 @@ static struct clk_regmap g12a_mali = { .ops = &clk_regmap_mux_ops, .parent_hws = g12a_mali_parent_hws, .num_parents = 2, - .flags = CLK_SET_RATE_NO_REPARENT, + .flags = CLK_SET_RATE_PARENT, }, }; -- 2.26.0