Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4253419rwb; Mon, 31 Jul 2023 04:15:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlFBrcq0dFp1DutfIbcfYQKdEZgHJ/xFaF6S7w2bwiDjOeVjJUwWEaF9JZQTMsPkYQ61qUXm X-Received: by 2002:a05:6a20:841e:b0:134:9868:812e with SMTP id c30-20020a056a20841e00b001349868812emr9011049pzd.39.1690802123985; Mon, 31 Jul 2023 04:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690802123; cv=none; d=google.com; s=arc-20160816; b=QH4HuTRq48nIMnmbanLiZ7L7UaznTiAgThPEWVEjgQMbxHWp5LzdqCSCtDWyX5gjf1 3QU5gAn+c1xh6gBqtXL418s8B2CajylaKD4VjUa1C32owyNp8d+Ey2Sx8FwVcdVduqci S49kBBZZqp/5TTL8WTwY5Ea+L8S8mgXoGS6lHN5AeAjfbgjYcoakRGxX8BzscLziKm5K pUuhfN/YH9PR0JgJrl1N6p7f9HiBKJGh5f/BykbcnpdfkXHSfTG61PY+f5XQztDsibMT cpebnjvLR8rV10dr4vpFcguWHi/UfnSYto7Us73tgS1UPJqyupBo4dV6u7elIjQv+LpZ UMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=roAVRLsFTeasd/WNMexhQWNQVbwACdscXvxOnzFOGlU=; fh=58MfIQYzwFKIHC8ZyPyQox+X84Zx6k5cC4G4UN9QciA=; b=ohi+dorL/X17DjMWLahqsO+AksVuOlFqgQZ2A7ff351VbsSut5K2r/P4+TzM1oAdB0 csLomGcdLB2fM0pE+GGMFZlVPzFha3qOMz541BZEHVvxEECXMdfqNwrH8IrMNKH7ddgQ nDETxr/vA8dLnpKG2w5W3qEa5vqQzbwPcf1SBDKXGSl2FHD0j2FcEoRS1D8KwXHAKKXz NZs+Jnc04Rvdl35xbxeZrnSNVM+tePQ9ujhdw1fzC409a/IzoIwCWnGiuVh0BkT1/Xpr CbhcOuOq89UwFTXjjAjotSLq/jactgOCeToAMenv1Sye8QCMx+8IAXs15eDgcfJYFAd/ RGTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a637e46000000b0055ac5fed588si6889081pgn.154.2023.07.31.04.15.11; Mon, 31 Jul 2023 04:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232013AbjGaKXy (ORCPT + 99 others); Mon, 31 Jul 2023 06:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjGaKXw (ORCPT ); Mon, 31 Jul 2023 06:23:52 -0400 X-Greylist: delayed 1184 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 31 Jul 2023 03:23:42 PDT Received: from mxout70.expurgate.net (mxout70.expurgate.net [194.37.255.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B317E78 for ; Mon, 31 Jul 2023 03:23:42 -0700 (PDT) Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1qQPkq-0074df-Bv for linux-kernel@vger.kernel.org; Mon, 31 Jul 2023 12:03:56 +0200 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qQPkp-0074ZW-VV for linux-kernel@vger.kernel.org; Mon, 31 Jul 2023 12:03:55 +0200 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id A812C240050 for ; Mon, 31 Jul 2023 12:03:54 +0200 (CEST) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 6B60524004B; Mon, 31 Jul 2023 12:03:54 +0200 (CEST) Received: from localhost.localdomain (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id E9C61312A1; Mon, 31 Jul 2023 12:03:53 +0200 (CEST) From: Florian Eckert To: mturquette@baylibre.com, sboyd@kernel.org, yzhu@maxlinear.com, rtanwar@maxlinear.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Eckert.Florian@googlemail.com Subject: [PATCH 1/2] clk: mxl: add mxl,control-gate dts property Date: Mon, 31 Jul 2023 12:03:48 +0200 Message-ID: <20230731100349.184553-2-fe@dev.tdt.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230731100349.184553-1-fe@dev.tdt.de> References: <20230731100349.184553-1-fe@dev.tdt.de> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Content-Transfer-Encoding: quoted-printable X-purgate: clean X-purgate-type: clean X-purgate-ID: 151534::1690797836-25E01C1B-4C3D6A58/0/0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gate clocks can be controlled either from this cgu clk driver or directly from power management driver/daemon. It is dependent on the power policy/profile requirements of the end product. To take control of gate clks from this driver. Until now, the source code had to be changed for this purpose by adding the flag 'GATE_CLK_HW' to the LGM_GATE macro in the source file 'drivers/clk/x86/clk-lgm.c'. This can be better handled via the device tree, so that the source no longer needs to be changed. For this purpose, a new option 'mxl,control-gate' is added, which specifies that the gate is controlled by this driver. Signed-off-by: Florian Eckert --- drivers/clk/x86/clk-cgu.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c index 89b53f280aee..cb4e92ea54bf 100644 --- a/drivers/clk/x86/clk-cgu.c +++ b/drivers/clk/x86/clk-cgu.c @@ -339,6 +339,8 @@ int lgm_clk_register_branches(struct lgm_clk_provider= *ctx, { struct clk_hw *hw; unsigned int idx; + const char *name; + unsigned int count, i; =20 for (idx =3D 0; idx < nr_clk; idx++, list++) { switch (list->type) { @@ -355,19 +357,21 @@ int lgm_clk_register_branches(struct lgm_clk_provid= er *ctx, hw =3D lgm_clk_register_fixed_factor(ctx, list); break; case CLK_TYPE_GATE: - if (list->gate_flags & GATE_CLK_HW) { - hw =3D lgm_clk_register_gate(ctx, list); - } else { - /* - * GATE_CLKs can be controlled either from - * CGU clk driver i.e. this driver or directly - * from power management driver/daemon. It is - * dependent on the power policy/profile requirements - * of the end product. To override control of gate - * clks from this driver, provide NULL for this index - * of gate clk provider. - */ - hw =3D NULL; + /* Check if cgu should control the gate clock */ + hw =3D NULL; + count =3D of_property_count_strings(ctx->np, + "mxl,control-gate"); + if (count <=3D 0) + break; + for (i =3D 0; i < count; i++) { + of_property_read_string_index(ctx->np, + "mxl,control-gate", + i, &name); + if (!strncmp(list->name, name, strlen(list->name))) { + dev_err(ctx->dev, "enable gate control for %s\n", + list->name); + hw =3D lgm_clk_register_gate(ctx, list); + } } break; =20 --=20 2.30.2