From patchwork Wed Feb 8 09:13:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 54279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3349128wrn; Wed, 8 Feb 2023 01:16:08 -0800 (PST) X-Google-Smtp-Source: AK7set8nXdgXdLdcgMqj46A9dFoPR73byU4YB3pjvMBjQ/vWEe/3XMmVpUar7fqokpo3p3TpZ9/h X-Received: by 2002:a05:6a21:30c3:b0:bc:42f9:6b21 with SMTP id yf3-20020a056a2130c300b000bc42f96b21mr4874412pzb.15.1675847768619; Wed, 08 Feb 2023 01:16:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675847768; cv=none; d=google.com; s=arc-20160816; b=WrQrBfn6liRa7mTyOpD9pWmNqEINxkSzAaAYedXdQZ8rp0rtDb8Ku4MatrA6Q52Vvb wWcPjt0RFfUanSLBhVimmB5AE1H87iftAKXdFTiCnhUmvekVzzzl74owHcwF4v5uQYm0 6oFwVVQjkXmpcamXklYrpJzJvLIf5O7MNECk9sE54kxt2uMUHJWemwcuzJIhgZ1YeZmN gKm8ssNC8fc/SZ2lCdP6I7Fz68sCNUrxtiTg05eMIOks1xgV31kY/OMS7U4jE6CKBngZ eQ9u7XQ7ywIG5ynjPae/B1tqK40lFLYd60upfE7q5HwQtVWEiGIlLkqhbtfqVrrSZr9G 3EzA== 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=DuUic+i1U7Wq2FP3EF4of24nNHQpKF/wijqQmHWITsc=; b=uejuRk45be2D5R95AU9p0i5JSZmPsXuANEmftMAM49iJexc16+Igb+NHRuSbCanAy0 Pkq/11U6T6uIs5J12DNyf52AsQkSNvvbxQ8ooQoxt4ewyiX3q8KFxb4GOCOK3D4Ido/y N8iIfSbVsczrHI8lXUEkTofiSlWLnFqi2nlmWJpcdkLfDobIYlTwE6TKGOAUckOSQOZ3 jFKJrFbOlG9ci+kh+3OAYDamlj2OENpVOIWTMFyrYZlouBD49mpZ1SiKGvehoG4hFPET yCmSHFi3jdkn3HVDESzsdtgBGeSklzSxlqZ1UV+SFasiv9q6HZms4v7/cTEz6cF9aMhr WEbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nDFpFjJi; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v15-20020a63b64f000000b004fb0d8abaadsi5311773pgt.141.2023.02.08.01.15.55; Wed, 08 Feb 2023 01:16:08 -0800 (PST) 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=@linaro.org header.s=google header.b=nDFpFjJi; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231350AbjBHJPl (ORCPT + 99 others); Wed, 8 Feb 2023 04:15:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbjBHJPL (ORCPT ); Wed, 8 Feb 2023 04:15:11 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B865645BFF for ; Wed, 8 Feb 2023 01:13:48 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id jg8so9943478ejc.6 for ; Wed, 08 Feb 2023 01:13:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DuUic+i1U7Wq2FP3EF4of24nNHQpKF/wijqQmHWITsc=; b=nDFpFjJi+KCbO6IFRe32xwArDhZIPitZ6Y96CW/FKiA5ymoAy+yjpJvOBtX/RwweKI FaWjGlDj8jwi8Wm2Bg6GWr8+ohC3KiZnhlxvbLiSDWkCqqOggWAI9kL/OjSPNc2lwInh 258UyqHnbEFEsrq1hJjVTC6/e8bThS442mGvY8u7jwed66xz3vrVoX9PNGd3DjB/j3oA EB7u+ZIIDIR5Hjg421QkT77lCVnv2TXUAoVKgD0TGfSXorqb4XI/W3mg8SaSD2uKCklO K7cK/Y3U2+IQduHLnY+GV8q6dZrON1N4hS6VcnM/UTW3P+CxPKR9Q69DdQS3++/1a0cE AFsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DuUic+i1U7Wq2FP3EF4of24nNHQpKF/wijqQmHWITsc=; b=J/YdU1FiA1GyPOejcbv9+y3vcccXY16/4C4WOoiohd7zGdCrZYwLHdQzvk3eaWY0xh gTRPBRIAlMyZ0Ov7zrARCoks8XvJbvAFgc/iPm6FuINEykwlSHTkhA13kozGIHepQlCD VDu3nGrnkB2HvYXOQwvg9nnBmuO4sKOjD0DPg5V6jqiN9oe7aEq7ZAd3XN4wY84tl3Ul nFxXUIE+Dw+Zs+CYJrz9xssikCuXIZjMz/6q2HJbD9qdi33+VGO3tVSSQHXSZJh63HLp IJc0fNCaM+pfbveDSoq5EI4P9EOY0u5/2r0kCcUG6q+uy4NUBk5HOELHajmmyqdpKZ0V RoNw== X-Gm-Message-State: AO0yUKWRNCxjIBeaw1jHxvFUPGqxxYJSDV8lYEBWYlMzkg9t/eJjcAW8 LgeV9Sz+KpFzaOHPil/rsoMBTQ== X-Received: by 2002:a17:907:2da6:b0:8ae:f73e:233f with SMTP id gt38-20020a1709072da600b008aef73e233fmr490317ejc.32.1675847626017; Wed, 08 Feb 2023 01:13:46 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id z2-20020a1709064e0200b00887a23bab85sm7987279eju.220.2023.02.08.01.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 01:13:45 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org, krzysztof.kozlowski@linaro.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 01/10] clk: qcom: branch: Add helper functions for setting retain bits Date: Wed, 8 Feb 2023 10:13:31 +0100 Message-Id: <20230208091340.124641-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208091340.124641-1-konrad.dybcio@linaro.org> References: <20230208091340.124641-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 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=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757253750069427733?= X-GMAIL-MSGID: =?utf-8?q?1757253750069427733?= Most Qualcomm branch clocks come with a pretty usual set of bits that can enable memory retention by means of not turning off parts of the memory logic. Add them to the common header file and introduce helper functions for setting them instead of using magic writes. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-branch.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h index 17a58119165e..55b3a2c3afed 100644 --- a/drivers/clk/qcom/clk-branch.h +++ b/drivers/clk/qcom/clk-branch.h @@ -37,6 +37,32 @@ struct clk_branch { struct clk_regmap clkr; }; +/* Branch clock common bits for HLOS-owned clocks */ +#define CBCR_FORCE_MEM_CORE_ON BIT(14) +#define CBCR_FORCE_MEM_PERIPH_ON BIT(13) +#define CBCR_FORCE_MEM_PERIPH_OFF BIT(12) + +static inline void qcom_branch_set_force_mem_core(struct regmap *regmap, + struct clk_branch clk, bool on) +{ + regmap_update_bits(regmap, clk.halt_reg, CBCR_FORCE_MEM_CORE_ON, + on ? CBCR_FORCE_MEM_CORE_ON : 0); +} + +static inline void qcom_branch_set_force_periph_on(struct regmap *regmap, + struct clk_branch clk, bool on) +{ + regmap_update_bits(regmap, clk.halt_reg, CBCR_FORCE_MEM_PERIPH_ON, + on ? CBCR_FORCE_MEM_PERIPH_ON : 0); +} + +static inline void qcom_branch_set_force_periph_off(struct regmap *regmap, + struct clk_branch clk, bool on) +{ + regmap_update_bits(regmap, clk.halt_reg, CBCR_FORCE_MEM_PERIPH_OFF, + on ? CBCR_FORCE_MEM_PERIPH_OFF : 0); +} + extern const struct clk_ops clk_branch_ops; extern const struct clk_ops clk_branch2_ops; extern const struct clk_ops clk_branch_simple_ops;