Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp464161rwi; Thu, 13 Oct 2022 00:05:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6u9DgHKCpsnO/T9hSEKZFw0dvq7FuE9d1DHWtw0Nfr4dfayjT0ACFVgNdWkqNPrMR+nULd X-Received: by 2002:a05:6402:35c9:b0:45c:de2e:ae1c with SMTP id z9-20020a05640235c900b0045cde2eae1cmr2250358edc.393.1665644753194; Thu, 13 Oct 2022 00:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665644753; cv=none; d=google.com; s=arc-20160816; b=yvT2GfLPO+5JvzIyWNCdCqRPI/QN+rd3s5GTawHDB1M9lbqaxDJW697HizQvZ7zigy DMuN0HIGVP6StWBusEWF+FtRWY0xXXfMKaN08Ak1lai+3Hu4NrA9WhWv95lRhgbNtybb Lilnw5+SeyzQeEJrenm9UMH1jsJANh2eQrfyYi7tSTZ1PV0fQR6XdASonU7SjsFlZ4zK 7ztT2px/cFbDgq5ABDQ8I5s2ydM59vhYW6Gx5yjeMhHhoMMQE7F0NwQA+O8p2kh+Q9na hSxfIlmJUtWjLqo3aqfSR8PbWaTZAGn6kqwNaqsEiuiprZWF0UxAtg0wkH8/i5JF6k8F vZ8w== 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 :dkim-signature; bh=yW/6V1qRcDmA37h7BKc8WxQSHaHKLLO2foHGntzZ9N4=; b=QS46G7/iZA8P8lXpBmoGQtiOHWVsS6Jd3u5k4JMlQqAjqohes8skhmCE8aLwIkNxyp Fh5a19PEsQrsapr8UytyZhPizEFB4+cggvF6coSnZXwmviB5VQpJb2xVeCdDB6cZHgxL LDRQVyKSUAr0zLWU6X36KBYto01VxP6mcwYJFjKyMLHotJbdZWl5XOE47ux1EWdL31h5 MkmPIPQhdb+Vgsktj9rA4K/OGu/WhtcD5ekcZ/CPOaGHFwX5pA5TgERlpll/XfKoOnBO jpPndHqJpuiFqtAMaMXOIC0Xd9vs3cCUojX4q67kCMC7FuYx/F5kpzFirYYM2tdijbAv mZ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@maxlinear.com header.s=selector header.b=oqts3gZX; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=maxlinear.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz1-20020a1709072ce100b0073dd7598686si16508727ejc.270.2022.10.13.00.05.26; Thu, 13 Oct 2022 00:05:53 -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; dkim=pass header.i=@maxlinear.com header.s=selector header.b=oqts3gZX; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=maxlinear.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbiJMGtW (ORCPT + 99 others); Thu, 13 Oct 2022 02:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbiJMGtD (ORCPT ); Thu, 13 Oct 2022 02:49:03 -0400 Received: from us-smtp-delivery-115.mimecast.com (us-smtp-delivery-115.mimecast.com [170.10.133.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964881463B0 for ; Wed, 12 Oct 2022 23:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maxlinear.com; s=selector; t=1665643737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yW/6V1qRcDmA37h7BKc8WxQSHaHKLLO2foHGntzZ9N4=; b=oqts3gZXDybtQLXgKB3l3e/izVkY53vCSb16Vi9jFmp6S6YqCHXc4Yj8uYtJZ2luRF2fY4 Q91UhyVZKM/HBrI/iLUM2GzmVfIOPIeBBseKgIdRzYUqN9I7fDGLaHr9O7KA2Utdny1EmI HcYhQYF4CY7Ww0toRkYYCzklNVRuXZhGDOBhqBu+ECr/XfoOJrKCDKposl9UuJYAXOuCLX mMj/ekCc/0t0Xe1XfPM4O/w8bvA4QOVtrLtNCrd+Q6B/Bf1DwpUhKyo7yu88Gkzp9J8/VH bQU7SVwFUnob2H8UxLSXih2lNbtppHqjlaZ+QsWOLZokPUZtiEHcpKeC/5v/Cw== Received: from mail.maxlinear.com (174-47-1-84.static.ctl.one [174.47.1.84]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id us-mta-562-APN1wHB2N8KLM2CyH0UUIw-1; Thu, 13 Oct 2022 02:48:48 -0400 X-MC-Unique: APN1wHB2N8KLM2CyH0UUIw-1 Received: from sgsxdev001.isng.phoenix.local (10.226.81.111) by mail.maxlinear.com (10.23.38.119) with Microsoft SMTP Server id 15.1.2375.24; Wed, 12 Oct 2022 23:48:45 -0700 From: Rahul Tanwar To: , , , CC: , , "Rahul Tanwar" Subject: [PATCH v4 3/4] clk: mxl: Add option to override gate clks Date: Thu, 13 Oct 2022 14:48:32 +0800 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: maxlinear.com Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In MxL's LGM SoC, gate clocks 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 support such use cases, provide option to override gate clks enable/disa= ble by adding a flag GATE_CLK_HW which controls if these gate clks are controll= ed by HW i.e. this driver or overridden in order to allow it to be controlled by power profiles instead. Reviewed-by: Yi xin Zhu Signed-off-by: Rahul Tanwar --- drivers/clk/x86/clk-cgu.c | 15 ++++++++++++++- drivers/clk/x86/clk-cgu.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c index 1f7e93de67bc..5eafd7e0d945 100644 --- a/drivers/clk/x86/clk-cgu.c +++ b/drivers/clk/x86/clk-cgu.c @@ -354,8 +354,21 @@ int lgm_clk_register_branches(struct lgm_clk_provider = *ctx, =09=09=09hw =3D lgm_clk_register_fixed_factor(ctx, list); =09=09=09break; =09=09case CLK_TYPE_GATE: -=09=09=09hw =3D lgm_clk_register_gate(ctx, list); +=09=09=09if (list->gate_flags & GATE_CLK_HW) +=09=09=09=09hw =3D lgm_clk_register_gate(ctx, list); +=09=09=09else +=09=09=09=09/* +=09=09=09=09 * GATE_CLKs can be controlled either from +=09=09=09=09 * CGU clk driver i.e. this driver or directly +=09=09=09=09 * from power management driver/daemon. It is +=09=09=09=09 * dependent on the power policy/profile requirements +=09=09=09=09 * of the end product. To override control of gate +=09=09=09=09 * clks from this driver, provide NULL for this index +=09=09=09=09 * of gate clk provider. +=09=09=09=09 */ +=09=09=09=09hw =3D NULL; =09=09=09break; + =09=09default: =09=09=09dev_err(ctx->dev, "invalid clk type\n"); =09=09=09return -EINVAL; diff --git a/drivers/clk/x86/clk-cgu.h b/drivers/clk/x86/clk-cgu.h index 0aa0f35d63a0..73ce84345f81 100644 --- a/drivers/clk/x86/clk-cgu.h +++ b/drivers/clk/x86/clk-cgu.h @@ -197,6 +197,7 @@ struct lgm_clk_branch { /* clock flags definition */ #define CLOCK_FLAG_VAL_INIT=09BIT(16) #define MUX_CLK_SW=09=09BIT(17) +#define GATE_CLK_HW=09=09BIT(18) =20 #define LGM_MUX(_id, _name, _pdata, _f, _reg,=09=09\ =09=09_shift, _width, _cf, _v)=09=09\ --=20 2.17.1