Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6128602rwd; Mon, 19 Jun 2023 02:47:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6l0467BT/3KFT+xW/SPceUwOQ147OAnf/fh1ptvyw62tXzTS/BpHcJwCdkO8T8RdhCVc5K X-Received: by 2002:a05:6a00:10c2:b0:668:6ce8:48b6 with SMTP id d2-20020a056a0010c200b006686ce848b6mr6121224pfu.31.1687168058667; Mon, 19 Jun 2023 02:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687168058; cv=none; d=google.com; s=arc-20160816; b=BZ3VS5g1B0jXGNvx4Ti6jU+WWxBXVRDRfUOhDkvd+CaaEDKzzqO+SteZQh+37hpNJG Klruc4Fgqx/3y5tWeiqdWTqyo+N6KFco0vwTdkMmeAPLAXAKLi9vhvoEmd7dxQEa1Uv3 IKqJBf7jqTfEa+H0ijG3KuNAq33sAwlVzn58pmJ29TNk1aOCSUCQhI7QBsNNKSvunYiw wqtLNEs/F+4REc++1KmeYGMpaAkn9HvUz4jNFpOxS85KRQYvw81MOP9CDU7dger87xHL HY977tE2WVw4bTrzYIrjcOBXCjm4U74pVEjIigjw4ihxC+36p4CTDpFQTyjh9zqqIPV8 XRZQ== 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=fp2CY0ufDGcamwFQBbeDzmusiEpGslruFK5CPypDqWU=; b=A1WB41Q3vH0fAiN5qzYIR570Fj0BMYPJXhOxJT1skpKhjnGqiYFjZXOtv2XK4QYx96 TRS8fgE2kL4yAoRv8S5rA6b3egHBrpDcsNc0x8dHlQU/kUnH39IWjRbAPUIyJCpiDkM/ S2dJCLois9yML+WdDSzDikgl4USKkX97YTC1/iXT801Ma1hV9DRjWlxgr4cIPvdCms2y qFXMRDdt2750BBBO1qj8AvbGqrQyk4A9P4hNgf9NjZWz/IwiZ3aT2gACp5bXdH59WsQD clmJI/RylhWvF1on2leZuaod4qYso9JE4XAMKdD3Xv4mB5SJ30ct47EGxEXI1aWiVUHb ZKMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=dC9YSWU1; 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 x64-20020a626343000000b0065824ae5092si20315426pfb.151.2023.06.19.02.47.26; Mon, 19 Jun 2023 02:47:38 -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=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=dC9YSWU1; 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 S231299AbjFSIz7 (ORCPT + 99 others); Mon, 19 Jun 2023 04:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbjFSIy7 (ORCPT ); Mon, 19 Jun 2023 04:54:59 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C481ADA for ; Mon, 19 Jun 2023 01:54:15 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-988aefaa44eso118676666b.2 for ; Mon, 19 Jun 2023 01:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687164854; x=1689756854; 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=fp2CY0ufDGcamwFQBbeDzmusiEpGslruFK5CPypDqWU=; b=dC9YSWU16Yyoc3srLfu6RqX/YnkDLDX6Y6E7496Ovko9QI/+rvX28OhG1C5YFs82Cn 6XJ4Fyc8HAEXeo2npkE87P6YBbD5UCbQc4EYK0kj0Lvfx9ZKpZIreNCdMBQMDZlJAinM FTGLQL2Kt71uNdnJC0C4wS2XbGEC22Yzv7v0oleYS5CqDZ/N0f6W43kDC3lUnq9j4KRT dxTU3yfnyMW777IUK63YArbzpcD+9UfNFVLTPvJhcwGeWynFd7ZU2zJwGnNpgDHxH+Yn cAW3KdqW4LEgRawUXM3QPzRM5tBFU6aRsRImZiZm0fgwWEI0v6Zmpv+UoorRrSO+TbWw e8Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687164854; x=1689756854; 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=fp2CY0ufDGcamwFQBbeDzmusiEpGslruFK5CPypDqWU=; b=AiP3sd34Km9DKxKn0PCZUSSgtPuhqJa3L6dp0WvgrlFC/VTY/KKeYuQyjazMPsvG1w 4mj+2LXxojGTOIbd7TFhPDAw7XzswL7Y9SdtEW6jZZUNsVvXuBcuFKO7KB9XiUxvDffU VCZH2DjXBFJAskN7+LdW0Qn7RUXcxeq2TlTiyWLpGmEkGNTwM25FOmSwfe1E3LUoH7SL VzsG+JmixHXPhBKLwoPdCVW9sj6sMv8hdiObDA0qF8j4ceuz/GWt2rbjlpF2SxAA6rDv u7n5YzL0Z9445qIWK7CtK3XEk2tqWDFERN1WxEyDnx8ctqG01wFewdehSVtkjnPGSKzW wuTg== X-Gm-Message-State: AC+VfDz9zMBgcyBOhJ2V0IkHMUd3koJvgK4K0xFfCFhjYsK8xaa6LwqL Hv0eidknNAo5HDumJahhhkb/Ug== X-Received: by 2002:a17:906:9b88:b0:988:9641:fe38 with SMTP id dd8-20020a1709069b8800b009889641fe38mr2375669ejc.32.1687164854182; Mon, 19 Jun 2023 01:54:14 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4090:a245:802c:bc2b:8db8:9210:41eb]) by smtp.gmail.com with ESMTPSA id h27-20020a17090619db00b00987a6e01e94sm2994339ejd.214.2023.06.19.01.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 01:54:13 -0700 (PDT) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , Tinghan Shen , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Markus Schneider-Pargmann Subject: [PATCH v5 2/8] soc: mediatek: pm-domains: Move bools to a flags field Date: Mon, 19 Jun 2023 10:53:38 +0200 Message-Id: <20230619085344.2885311-3-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619085344.2885311-1-msp@baylibre.com> References: <20230619085344.2885311-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 To simplify the macros, use a flags field for simple bools. This is in preparation for more flags. Signed-off-by: Markus Schneider-Pargmann --- drivers/soc/mediatek/mtk-pm-domains.c | 6 +++--- drivers/soc/mediatek/mtk-pm-domains.h | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 354249cc1b12..aa9ab413479e 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -128,7 +128,7 @@ static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, st if (!mask) break; - if (bpd[i].bus_prot_reg_update) + if (bpd[i].flags & BUS_PROT_REG_UPDATE) regmap_set_bits(regmap, bpd[i].bus_prot_set, mask); else regmap_write(regmap, bpd[i].bus_prot_set, mask); @@ -165,12 +165,12 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, if (!mask) continue; - if (bpd[i].bus_prot_reg_update) + if (bpd[i].flags & BUS_PROT_REG_UPDATE) regmap_clear_bits(regmap, bpd[i].bus_prot_clr, mask); else regmap_write(regmap, bpd[i].bus_prot_clr, mask); - if (bpd[i].ignore_clr_ack) + if (bpd[i].flags & BUS_PROT_IGNORE_CLR_ACK) continue; ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 5ec53ee073c4..e26c8c317a6b 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -42,23 +42,27 @@ #define SPM_MAX_BUS_PROT_DATA 6 -#define _BUS_PROT(_mask, _set, _clr, _sta, _update, _ignore) { \ +enum scpsys_bus_prot_flags { + BUS_PROT_REG_UPDATE = BIT(1), + BUS_PROT_IGNORE_CLR_ACK = BIT(2), +}; + +#define _BUS_PROT(_mask, _set, _clr, _sta, _flags) { \ .bus_prot_mask = (_mask), \ .bus_prot_set = _set, \ .bus_prot_clr = _clr, \ .bus_prot_sta = _sta, \ - .bus_prot_reg_update = _update, \ - .ignore_clr_ack = _ignore, \ + .flags = _flags \ } #define BUS_PROT_WR(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, false, false) + _BUS_PROT(_mask, _set, _clr, _sta, 0) #define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, false, true) + _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_IGNORE_CLR_ACK) #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, true, false) + _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_REG_UPDATE) #define BUS_PROT_UPDATE_TOPAXI(_mask) \ BUS_PROT_UPDATE(_mask, \ @@ -71,8 +75,7 @@ struct scpsys_bus_prot_data { u32 bus_prot_set; u32 bus_prot_clr; u32 bus_prot_sta; - bool bus_prot_reg_update; - bool ignore_clr_ack; + u32 flags; }; /** -- 2.40.1