Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6131315rdb; Mon, 18 Sep 2023 05:19:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/kbbpd7wYnQFGZU+bj2SER0RVGWIhNIoDd3KNrZXkn58FCQVjZvMtoWt+vXMxLZ7ygGeP X-Received: by 2002:a17:902:9684:b0:1bf:25a0:f875 with SMTP id n4-20020a170902968400b001bf25a0f875mr6429942plp.39.1695039556118; Mon, 18 Sep 2023 05:19:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695039556; cv=none; d=google.com; s=arc-20160816; b=D3Ip7WJk/wX+uI2Sy2da37tHp6kwdKovtmTJggJNNCPyHhjADEAp6UaIYnQ7VO8dDR KnDiRjPoL+ZjjVJALlUNMbR0ShybHC2c2VQ3e2k8vrXwRm49MH84ioww2vUYT6eAHtDr 2cVU1vUaeL4jmj714CNQWckWg9yia8atgtVquLxk4Xa1x2YsD8qQWrmr/AhRbEuVuv0b S0R5zuL3zXKFitdSG9tx3WSdHcCaX3wnxw/XnAG0tDGNCJ8BRA35DQ8WgvMNL5gHWSIp cnGgEbIICgfKn2H2YKsxB/Bpa3l4JcuaNa1OCCE8R38+8tPpm6AwDFsIM4CpiogFLEwl 5oPA== 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=ntIS/xJA3nmS8C+qHhhmXutBf4D7O4ovO2luXjJAhFI=; fh=RUoqLuZuITlmATQNBnxyoemQD0RKvHH0dT8r5B4O084=; b=aM9NsrXO5ERuOgVKhHKW3O0YVjG01rIV6AHxkdWkLUVZl+ZNaIPqV8+xtpPFfmK+hg nTfzy1gsI8qKnQ6HMwMXVtaz8fMbBtXChj/7pwTJrCGOJtqG3eDg0FI2r7gDJIbjdZu+ mglUslmQdKhbgBCSUzooHg7RxH7/E85zI2E4G9JwpefGwen5Wi+Lx93SZjwT9SWIl9cD 61JrwEci6SV6ijQpbt1ecNsZvDg1xoKAivy9qnG2QdrhzkAl3KFFrBKxBLnzDDlomY8z ksziu4c0TgZjFABgc6kOPnFWg2WafJJr6HPXYNC6A80NH5h0bs6cPKE6a8qOQkPmL45t eRlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=qWngDVTQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id ij4-20020a170902ab4400b001b3d6d125f9si7743079plb.524.2023.09.18.05.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=qWngDVTQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D229980220BE; Mon, 18 Sep 2023 02:39:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240917AbjIRJiv (ORCPT + 99 others); Mon, 18 Sep 2023 05:38:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240939AbjIRJi3 (ORCPT ); Mon, 18 Sep 2023 05:38:29 -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 D391B120 for ; Mon, 18 Sep 2023 02:38:21 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9adca291f99so355859266b.2 for ; Mon, 18 Sep 2023 02:38:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695029900; x=1695634700; darn=vger.kernel.org; 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=ntIS/xJA3nmS8C+qHhhmXutBf4D7O4ovO2luXjJAhFI=; b=qWngDVTQZc1Rx2elTHHNXPxz89AfvfLDF33NxG+GxYCbk+S/9J5fB3qf2an/iUtsrZ Ww1KU1sixh1uYR7h8nassEuUjfbAoXpJEGkekBQ3axhAwFOlok/izYSRPSYtcVwynodp qCMWQ9b2nre1SMG3wz1Jbd5SCKQslESkdxKZvgrpUju4TwMKMgNmoJZ+QL4o1BPBTeth 52G07n9gKy/f0b37SJYmnyenJc8mV+pA5H1cbiT7Vay1lFqWj1hqsZVh85dSg2/NSoMr mEkcw37hJqQjKy/EElVYnwmTxEnQGxKtghle6OZoVsNf/hr2ge9yKM8vJhYHK+7k1gd9 YMnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695029900; x=1695634700; 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=ntIS/xJA3nmS8C+qHhhmXutBf4D7O4ovO2luXjJAhFI=; b=IhUfODwkisrXBcH6LXyk06Bkdz1q+B8QPmH1x5/r3zPVr+dEJPCWl0J5K8ZaPyorn9 AUSbWZi+a3tRJ1tpH9dSFfdhIxjfpmFy9ywsYfQH/9n0fj3dS1oDeMnASchtbByT14pZ 3G8pL55Jopdzd+swln6Hbqc0424iL5LqRZzSnftvfl8OQ5FvOx2gcWhXJxpLbL8bhdxr rGC5bQ+L4WbE7gT3NyvcAvSS+EhA1a7G1hAwS17ldCONCf3wCAc4+B62QsWTsnsudtt5 fArmkExOLAyz35OnpASuSvxXA1fo5obSuH6ZfKe5gagQcIvjnSKc8hNyGFixBENp6u9Y pVmw== X-Gm-Message-State: AOJu0Yy6NNa6ompkVbn3/7alZ2Qtrh/ZvSqfKT+Znsvn4SQscHrnY7p4 SDkoACLuW/eVxCdNgoceIvgoZA== X-Received: by 2002:a17:907:a053:b0:9a1:f96c:4baf with SMTP id gz19-20020a170907a05300b009a1f96c4bafmr7437464ejc.5.1695029900372; Mon, 18 Sep 2023 02:38:20 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a246:8222:872:4a5b:b69c:1318]) by smtp.gmail.com with ESMTPSA id o10-20020a1709061d4a00b0099293cdbc98sm6251164ejh.145.2023.09.18.02.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 02:38:19 -0700 (PDT) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger Cc: Ulf Hansson , Alexandre Mergnat , Chun-Jie Chen , AngeloGioacchino Del Regno , Tinghan Shen , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Markus Schneider-Pargmann Subject: [PATCH v8 2/8] soc: mediatek: pm-domains: Move bools to a flags field Date: Mon, 18 Sep 2023 11:37:46 +0200 Message-Id: <20230918093751.1188668-3-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918093751.1188668-1-msp@baylibre.com> References: <20230918093751.1188668-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 02:39:21 -0700 (PDT) To simplify the macros, use a flags field for simple bools. This is in preparation for more flags. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat Tested-by: Alexandre Mergnat --- drivers/pmdomain/mediatek/mtk-pm-domains.c | 6 +++--- drivers/pmdomain/mediatek/mtk-pm-domains.h | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c index ee962804b830..da675a33bdf5 100644 --- a/drivers/pmdomain/mediatek/mtk-pm-domains.c +++ b/drivers/pmdomain/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/pmdomain/mediatek/mtk-pm-domains.h b/drivers/pmdomain/mediatek/mtk-pm-domains.h index 5ec53ee073c4..d8c0c299dd45 100644 --- a/drivers/pmdomain/mediatek/mtk-pm-domains.h +++ b/drivers/pmdomain/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; + u8 flags; }; /** -- 2.40.1