Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10122750ybl; Thu, 26 Dec 2019 11:13:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzGTT3ccPOhjmiE21LXwh9Cv70Q3i441t29ODeU5DCLX6KVW+BVKXtRUUUMG4CglNfUqdjj X-Received: by 2002:a05:6830:1442:: with SMTP id w2mr54223423otp.143.1577387627769; Thu, 26 Dec 2019 11:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577387627; cv=none; d=google.com; s=arc-20160816; b=alO5xm1DkXMTRmOPPWfhfdcaPdh/Ou8sPZ+0gwr7Ec1ZHP0PmR/8UCX5Xqf5qpazk8 j91ucQGgUXTO7d5EN/6T+AVOA02c8vlt+uQby5b56vPrvkO+q1zc6usjMAF+WE74N2DG Yr6PjhUcnxn+lItOpOPJYvVCUQUdlbNmPXJNz0pkgoe+rKHBJtZ5eamTG76YPimiyESH vsS/pTpEg7zR5cP4aIex7gJsvposn4tQYyQCnelg3E5kRGZ6aP30c1B/Dh8CJlXvRI8/ Zt2y1dEFTLuJJgpF2juhJjm2+PKXGUfpWSdAox0OFQtoQv3cBLetlogX9I9JqLiolsrY BDsA== 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=tt36REs6xTGhoAu/DRKUVnoYElZnOVVi2F4lvnCzwxk=; b=CDLN/UknJLZmXpbphgHx5O/Azh/ZWCv6E9gQxD7DwYag1KnvY81IwHbIQTCX0Kl3R1 294KfXRfdhvMYAP7056pkg5bVV+BjzjWJc4NqeX8Wtzv74ToqmzVrFH7lCt/5K5dSgAX 4rIl3Sacj8jCSYtBIt0dsGb7Zs6bho17NcHMUWJSAfZX/27JtGHVtD9b3udWosmdv3wQ KO4w2V/9sXIFMRO9mdZFGFrgjhkM7eb88SQwh8CgX1IxV4+LM7Tc55G9/9jLNtLkIapg UlVJDd4sST3XwrY8XJjnh3SusYZlGaEYy+J8uPp2oTWCH1eRiAz8h2rUHtoQFx1EFklH DnwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="nN/5xERv"; 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 s17si17485855otq.78.2019.12.26.11.13.32; Thu, 26 Dec 2019 11:13:47 -0800 (PST) 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="nN/5xERv"; 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 S1726944AbfLZTMr (ORCPT + 99 others); Thu, 26 Dec 2019 14:12:47 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39271 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726809AbfLZTMq (ORCPT ); Thu, 26 Dec 2019 14:12:46 -0500 Received: by mail-wm1-f66.google.com with SMTP id 20so6672126wmj.4; Thu, 26 Dec 2019 11:12:44 -0800 (PST) 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=tt36REs6xTGhoAu/DRKUVnoYElZnOVVi2F4lvnCzwxk=; b=nN/5xERvRFlldF3gW7sAZTJtfO1cS4PM2gDnf67/zENyO5n4o77HOWTbJd+ZG9QQEk rRmgS1gcOjN3hRQiIL+owsaJVLwFqTfL1/vG+uggrbXC0yBGM+RxK1zFTo6OGeRaCvvr 2bIXCEAwf2NTdJkSs9YLL71Y1MeiMYh+cgkFAqIiuMUmEUldmHj5l+11ytV6bc1yFMBx KSK2b/dgA5OZI681Yv5LvSHPpYjq5STPnwC0M/RjXSjn/F7jJrOyJThiJKZl71YehIwR pNI8Gvuz2bqniQpEFgzsYaEu9XkhkxVZNHC6U7sQeTE0867hzRQ7yq0Gjwpl4SU2o4WP c7yg== 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=tt36REs6xTGhoAu/DRKUVnoYElZnOVVi2F4lvnCzwxk=; b=do5BZXSygILym60TcUevkjx44J+wPa9w6u0vlxoMR6yeVOX9oMds4nGeqfRVOYyL/3 M4UQwYTRxd7Lv2+tBxeOfvXyDVi7cEKvqxotARwWRZLZLmQT4Ac42/p72OInw9yniiz3 hzjPU7VwqBexJFJkv9njjFPYHgbNtQSrNBqcfp7kqcwa890y4B12B0Ez30HNC/bHJZiZ uTIVXxZY8Xo6gK7w11CKloIaUYqsBVsARSxPJSvwogeGJxvJn7t9ngtKvldvN2bOUNJt Fb66jN/GHBP4m64LfsQWpHgW0G0ZUNRWS6L9E7LVdaO4u2oY/x7jRyrHCwzSaKLlGrWs b+Zw== X-Gm-Message-State: APjAAAUhjn7DWTKjFCdBCU8hdcU7ILvaKOV/Ri2Eyj2lS8vmC3SM18UP SIPNbhc/v/PzCdsYDhgsW/cx4hItaB0= X-Received: by 2002:a05:600c:290f:: with SMTP id i15mr15657682wmd.115.1577387564126; Thu, 26 Dec 2019 11:12:44 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id o7sm8965937wmh.11.2019.12.26.11.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 11:12:43 -0800 (PST) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, jbrunet@baylibre.com, sboyd@kernel.org Cc: narmstrong@baylibre.com, mturquette@baylibre.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Blumenstingl Subject: [PATCH v2 1/2] clk: meson: meson8b: make the CCF use the glitch-free "mali" mux Date: Thu, 26 Dec 2019 20:12:23 +0100 Message-Id: <20191226191224.3785282-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191226191224.3785282-1-martin.blumenstingl@googlemail.com> References: <20191226191224.3785282-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. This fixes a potential hang when changing the GPU frequency at runtime. Fixes: 74e1f2521f16ff ("clk: meson: meson8b: add the GPU clock tree") Signed-off-by: Martin Blumenstingl --- drivers/clk/meson/meson8b.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 3408297bff65..9fd31f23b2a9 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -1772,8 +1772,11 @@ static struct clk_regmap meson8b_hdmi_sys = { /* * The MALI IP is clocked by two identical clocks (mali_0 and mali_1) - * muxed by a glitch-free switch on Meson8b and Meson8m2. Meson8 only - * has mali_0 and no glitch-free mux. + * muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can + * actually 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. + * Meson8 only has mali_0 and no glitch-free mux. */ static const struct clk_parent_data meson8b_mali_0_1_parent_data[] = { { .fw_name = "xtal", .name = "xtal", .index = -1, }, @@ -1838,7 +1841,7 @@ static struct clk_regmap meson8b_mali_0 = { &meson8b_mali_0_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; @@ -1893,7 +1896,7 @@ static struct clk_regmap meson8b_mali_1 = { &meson8b_mali_1_div.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT, }, }; -- 2.24.1