From patchwork Mon Jan 30 15:32:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 50348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2248983wrn; Mon, 30 Jan 2023 07:43:17 -0800 (PST) X-Google-Smtp-Source: AK7set+PAoKFhYnDf4p0aCkov7XsIVanMXXncCZZUxL9rWKvjknkXNfyXBGCiMZkdKV7hiFTUBP9 X-Received: by 2002:a17:906:4b13:b0:878:5e84:e1d6 with SMTP id y19-20020a1709064b1300b008785e84e1d6mr18692817eju.75.1675093397759; Mon, 30 Jan 2023 07:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675093397; cv=none; d=google.com; s=arc-20160816; b=NA2ujgu0S2dIu6sxf1skD1fERN2e1ssAmkaHIqCNRxSzUAvtwdVkwwppO6VAJ93qrb Vk6ljOniwMpqMcwgIqreoVi/7YUBjw9bt1gLopBGK3edQ2SkyNXOiPEUWeUExlElQE+r cweJEQtcXLgJVcB4LPpy74EjZ8ZcaGSGTY4W+0bXU7qinYPSrezGRSTlWm1IPuqmS2P1 wqvOkmzp+oI33CnGB5xNRUci5CBTlR1+GkLfFrPxlddqjHTTUCnPBAeXKrWNaVP64a/c y0si3xMZ4WIlpjnC4n5vTW7J5ZORCy8GDZO5fRInLeg1xq+hvTj4ntSyXG1mgA/T3of5 Dipw== 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=KZ+Opwm6jcHi17rVDvjxU6dDxEIV55VJ/74LTubqrB0=; b=rwhezcZyjTXkW6P5+PK9Oa36YtXaZaZXp5ZM2N92B3YY/FSP88o+dQYdlZJxnDH+cN CYvuwko22mTt4ySRmvkzDxuRdDyEHlYLX9jp2IPwuZtJ9kvcIR3eL02Z1QILlSWuVFiZ ExISpn82hdzy+E0tF0XFeBOaFIG9NmBdQ2UlPBFTJrWClywrpnDmwauBOkT68FymcJhi jlt4sRkiS5XOGGJKrzFKEFCZQgpFTRWH2A8dZwT8oQAZ0QmOCnLqR8JLWgxZUTw6oAf5 CYhJYKqgXBg1OWPfGIrDA+vmeVFAF+yub3GLJCNSgAgj6p+10jlrFV/ndYxRsu2UIjmP buRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IIsKysQy; 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 j19-20020a170906535300b0088acf6e8c97si1162541ejo.531.2023.01.30.07.42.54; Mon, 30 Jan 2023 07:43:17 -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=IIsKysQy; 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 S236602AbjA3PdN (ORCPT + 99 others); Mon, 30 Jan 2023 10:33:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237190AbjA3PdI (ORCPT ); Mon, 30 Jan 2023 10:33:08 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111883CE15 for ; Mon, 30 Jan 2023 07:33:07 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id gr7so8239043ejb.5 for ; Mon, 30 Jan 2023 07:33:06 -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=KZ+Opwm6jcHi17rVDvjxU6dDxEIV55VJ/74LTubqrB0=; b=IIsKysQyfCEF6p8MD7eRzgo1qyjPHfvIoZIZD20jvXGEqHunHJgD+iefDncyUoDLDL Xilf0NPG2xYwQB/LMJpet6CBbmQISUxlLxsn+3BfC0t6WSQfEkh/iZkI/MU2tE2DsyDS g/fuiM6QIAJ8nlCWWSvWAuwaNj/vByor50sU6f82ewwupm7rBmLUBroQ7nARX9NRpYA8 gos/iWhl2ZzEv8ET7VXpXkF7FWgGdMe7trjQl7Wb6XwbeaqPeHjfiNlIUfvz1+2VoikS maGu+P0ccozlCBOGjbnHKwhgkp5DQ+VBx6Hska4gzUywJczogaAU3HykW79KCrqBFUPg 7pEg== 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=KZ+Opwm6jcHi17rVDvjxU6dDxEIV55VJ/74LTubqrB0=; b=lFMimIInFnQZaO7I4TIm6SvvmtjSYTcabT/tUNRAvvU9TxhKffJTDvJNj2C6u5SrKp yQuWoauhK8RUPIgrhRHBmrLvnS1DeeI9fMWY/+KpDLBcQBkUjtWE89HqqraiLowJnZbN bV6RA2vPaXTEqgJ6aa0EZsne/z7q3mwtKx0wc4T31Idvy/0Wjrp1nALCyVqeMTMpJHVk GNOgOGEmK5tG0ZZotu4IbLVdYDQULEUY80V387Djeqc6Wzi9KJqN6smQyxgADeIv0mO7 MQgI6TKRdVLmFAw0KANhc/U/QrnSE63kXFlRDm7RswtllwB/0W6QhYOYk/+H1kEuAbe0 3bZg== X-Gm-Message-State: AFqh2krxhw/ruEkWrh1a7cyTUtjJWuXUdmFkcLywjk5bqWhPDyBP+Ykl in8E3HOLL+EGGrzPnTANBhN29w== X-Received: by 2002:a17:906:a058:b0:84d:4e9b:ace5 with SMTP id bg24-20020a170906a05800b0084d4e9bace5mr48508058ejb.67.1675092785563; Mon, 30 Jan 2023 07:33:05 -0800 (PST) Received: from localhost.localdomain (abyl20.neoplus.adsl.tpnet.pl. [83.9.31.20]) by smtp.gmail.com with ESMTPSA id k7-20020a170906054700b00878769f1e6bsm6805773eja.55.2023.01.30.07.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 07:33:05 -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 v3 1/8] clk: qcom: branch: Add helper functions for setting retain bits Date: Mon, 30 Jan 2023 16:32:45 +0100 Message-Id: <20230130153252.2310882-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230130153252.2310882-1-konrad.dybcio@linaro.org> References: <20230130153252.2310882-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?1756462734862005354?= X-GMAIL-MSGID: =?utf-8?q?1756462734862005354?= 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 --- v2 -> v3: - New patch drivers/clk/qcom/clk-branch.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h index 17a58119165e..d8fc7b93ef6d 100644 --- a/drivers/clk/qcom/clk-branch.h +++ b/drivers/clk/qcom/clk-branch.h @@ -37,6 +37,29 @@ 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, u32 reg, bool on) +{ + regmap_update_bits(regmap, 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, u32 reg, bool on) +{ + regmap_update_bits(regmap, 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, u32 reg, bool on) +{ + regmap_update_bits(regmap, 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;