From patchwork Mon Jun 19 08:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 13284163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87EBDEB64DA for ; Mon, 19 Jun 2023 08:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ardAF8XLAPwU/A9HUODgbjTWe5sqgu4fTfYhR6O17ic=; b=K770HQKgO7fIH+ DjD5cosJcuh+eeVjnINfKU0DyxukXbB+z/9q/M5tfGGPKuGwiRP5QLVnhvzOyZrY/GyFNY9TsEU0O abzDPGBuGizEXbzcwMcOYxNjsYM+p45FzEQJ8+nr0AknKcH2Ld+ZavPsBY2tHQoKDDWF0rkCb7lf8 b6y5h7lxs8Iu5U3d4tnessA0H1KgoeRNfoODJoK0riXUepR+6gEjGv5mo4Z4e0kkS24LurKJgEnW0 fwFXaig2yFJT6OkZkxoVSr/dB92JonuYYLn/jt7PA+q02hm/MRP4bVYNNVCRz/WqZlYzYCoj9iBnd dgbDAiSAYHrilhtex5iQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBAeZ-007u03-1P; Mon, 19 Jun 2023 08:54:27 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBAeN-007tsJ-28 for linux-arm-kernel@lists.infradead.org; Mon, 19 Jun 2023 08:54:19 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9889952ed18so159608066b.3 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=MUrf5UzT5mm/mjnme+bXlz6YG7LJNpYxk7kiaAFZ2Wx94nAxVWFp+NBkQ4NAApUDSG FijVooDmV31Mfp4TxzmY0yJnlSOwirUa5LNc9+eaIuy2sR8h3Ql6v9EiWKR/La3bkyXY qlr37VjibHmA+7Lfz/FJl+BqV883LxAI4QMnRFHzb7Oci/BNV1rAsJFQb5pd7Bp5STD0 I9sjvu8cvlTblWJhruBP1E/OHG5ByYDj9qVwsRYaGVpXySuW9ZKrPVALEebf1hFRC2wS zWDGMnIXfl3FroTyBEUpRZPAhqOxDi1fO1KcBuTpHG+s7qCOZEHpffYAjcCdVz14Rhfr M9Vg== X-Gm-Message-State: AC+VfDxZX/Yolgp7rt2f+U6Ny7ASNXZujGvgPEbjhr2lqxo+zZBSoOoe IY236678QjBZ18v7X93stGRCIg== X-Google-Smtp-Source: ACHHUZ5xugmtYuirqmRzIhzUWDWlP5X96hGOlG7cFBbVw5SzpqBBONkyAvcFrbpfnJZNknaMmZP9fw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230619_015415_704350_06CA90DB X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: AngeloGioacchino Del Regno --- 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; }; /**