From nobody Thu Nov 14 16:57:15 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFF46EB64D9 for ; Tue, 27 Jun 2023 13:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231210AbjF0NLI (ORCPT ); Tue, 27 Jun 2023 09:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbjF0NK5 (ORCPT ); Tue, 27 Jun 2023 09:10:57 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC182728 for ; Tue, 27 Jun 2023 06:10:55 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso17043085e9.0 for ; Tue, 27 Jun 2023 06:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687871454; x=1690463454; 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=Huq0f602AiELC22FO/5lw5XrAmTN1TOhrm45pj/62Fs=; b=5Z2ZEG6r8DhbQgX06aBUiWzpTIGIwhNqcJJPQZpnwvOMzYwuTH4XZbmPhbtHQgWe9/ kRtbqZjoEvQRy3Ja+OdCb8/oOf1yaDz35MMA4k1ICxnR2xBdSJKBd0Twv1l7EXjQkv4+ ZQJbnyg5Y7MCCYTg4deB70jEE2YgD8JHoaTeRdrdY7Lk+9s5eXhI5sCrG9t9deH7yDiu 58yvmJvFpqo/v8ziEOlhasQn/tSX9HYwMbrFl8Exi8yyC0t9LTWgZ4DpaxL381uMGDwd LJEeyOln1xXCrNtgRE56+MCsDJ66tUfRWhEuPey+xz5ikTs/46M5hgtREeUYUgnBmJjA VCYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687871454; x=1690463454; 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=Huq0f602AiELC22FO/5lw5XrAmTN1TOhrm45pj/62Fs=; b=JDyMn3B85rrwQgfmT0GTWPAah2/iOZbSCj6w/k32eqZf9GJxKHqfAukyrqvxVz8EQD 1g+ESerzCLqoLhrT4Fo/rH4f888HPKULvP6/XCXM+1Lq77SHvia9KoQWfw2q9FOuLAUu GckwHwIt4SudScWs9uZ6H3xrEqcnS9ZfVApso19Qa/1Gh17/lFRIjHt5A+Ki20Vs/qRo qLqHPhNFXTrCl6wo7RgOoO2AqxFZYOc+85+VSdfCMhQlCXC8sV5/FjGXjXEfu8ZwyLI6 dfqw3YwWHw+BC7g/NKxLCt691DecIlYcL74Ftw1YWD6ArDMA91NEA5vDl9J8+JUwtFk/ 7D+A== X-Gm-Message-State: AC+VfDxa2Psk/QsEnabwmbTjrWihpZg8SaViZnBMYAmimkTPBjsBLtAf RHKXBRRbJj3tC/y2ZQzetq/2uQ== X-Google-Smtp-Source: ACHHUZ6Niu7ICR+ebAasagaHNKyTduKojDXMRrfbteTnIxkrfxz5IIspiY3YKwhEMmYz+hf4o+nvzA== X-Received: by 2002:a05:600c:2249:b0:3fb:a1b1:ebfd with SMTP id a9-20020a05600c224900b003fba1b1ebfdmr2007172wmm.13.1687871454140; Tue, 27 Jun 2023 06:10:54 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id z26-20020a1c4c1a000000b003f91e32b1ebsm1403196wmf.17.2023.06.27.06.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 06:10:47 -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 v6 3/8] soc: mediatek: pm-domains: Split bus_prot_mask Date: Tue, 27 Jun 2023 15:10:35 +0200 Message-Id: <20230627131040.3418538-4-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230627131040.3418538-1-msp@baylibre.com> References: <20230627131040.3418538-1-msp@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" bus_prot_mask is used for all operations, set clear and acknowledge. In preparation of m8365 power domain support split this one mask into two, one mask for set and clear, another one for acknowledge. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Alexandre Mergnat Reviewed-by: AngeloGioacchino Del Regno Tested-by: Alexandre Mergnat --- drivers/soc/mediatek/mtk-pm-domains.c | 24 ++++++++++++++---------- drivers/soc/mediatek/mtk-pm-domains.h | 14 ++++++++------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/m= tk-pm-domains.c index aa9ab413479e..c801fa763e89 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -123,18 +123,20 @@ static int _scpsys_bus_protect_enable(const struct sc= psys_bus_prot_data *bpd, st int i, ret; =20 for (i =3D 0; i < SPM_MAX_BUS_PROT_DATA; i++) { - u32 val, mask =3D bpd[i].bus_prot_mask; + u32 val; + u32 set_clr_mask =3D bpd[i].bus_prot_set_clr_mask; + u32 sta_mask =3D bpd[i].bus_prot_sta_mask; =20 - if (!mask) + if (!set_clr_mask) break; =20 if (bpd[i].flags & BUS_PROT_REG_UPDATE) - regmap_set_bits(regmap, bpd[i].bus_prot_set, mask); + regmap_set_bits(regmap, bpd[i].bus_prot_set, set_clr_mask); else - regmap_write(regmap, bpd[i].bus_prot_set, mask); + regmap_write(regmap, bpd[i].bus_prot_set, set_clr_mask); =20 ret =3D regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, - val, (val & mask) =3D=3D mask, + val, (val & sta_mask) =3D=3D sta_mask, MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); if (ret) return ret; @@ -160,21 +162,23 @@ static int _scpsys_bus_protect_disable(const struct s= cpsys_bus_prot_data *bpd, int i, ret; =20 for (i =3D SPM_MAX_BUS_PROT_DATA - 1; i >=3D 0; i--) { - u32 val, mask =3D bpd[i].bus_prot_mask; + u32 val; + u32 set_clr_mask =3D bpd[i].bus_prot_set_clr_mask; + u32 sta_mask =3D bpd[i].bus_prot_sta_mask; =20 - if (!mask) + if (!set_clr_mask) continue; =20 if (bpd[i].flags & BUS_PROT_REG_UPDATE) - regmap_clear_bits(regmap, bpd[i].bus_prot_clr, mask); + regmap_clear_bits(regmap, bpd[i].bus_prot_clr, set_clr_mask); else - regmap_write(regmap, bpd[i].bus_prot_clr, mask); + regmap_write(regmap, bpd[i].bus_prot_clr, set_clr_mask); =20 if (bpd[i].flags & BUS_PROT_IGNORE_CLR_ACK) continue; =20 ret =3D regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, - val, !(val & mask), + val, !(val & sta_mask), MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); if (ret) return ret; diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/m= tk-pm-domains.h index d8c0c299dd45..4c3ab72a907b 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -47,22 +47,23 @@ enum scpsys_bus_prot_flags { BUS_PROT_IGNORE_CLR_ACK =3D BIT(2), }; =20 -#define _BUS_PROT(_mask, _set, _clr, _sta, _flags) { \ - .bus_prot_mask =3D (_mask), \ +#define _BUS_PROT(_set_clr_mask, _set, _clr, _sta_mask, _sta, _flags) { \ + .bus_prot_set_clr_mask =3D (_set_clr_mask), \ .bus_prot_set =3D _set, \ .bus_prot_clr =3D _clr, \ + .bus_prot_sta_mask =3D (_sta_mask), \ .bus_prot_sta =3D _sta, \ .flags =3D _flags \ } =20 #define BUS_PROT_WR(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, 0) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, 0) =20 #define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_IGNORE_CLR_ACK) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, BUS_PROT_IGNORE_CLR_ACK) =20 #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, BUS_PROT_REG_UPDATE) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, BUS_PROT_REG_UPDATE) =20 #define BUS_PROT_UPDATE_TOPAXI(_mask) \ BUS_PROT_UPDATE(_mask, \ @@ -71,9 +72,10 @@ enum scpsys_bus_prot_flags { INFRA_TOPAXI_PROTECTSTA1) =20 struct scpsys_bus_prot_data { - u32 bus_prot_mask; + u32 bus_prot_set_clr_mask; u32 bus_prot_set; u32 bus_prot_clr; + u32 bus_prot_sta_mask; u32 bus_prot_sta; u8 flags; }; --=20 2.40.1