From patchwork Thu Jan 5 17:07:28 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: 13090477 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 5EC5EC3DA7D for ; Thu, 5 Jan 2023 20:59:42 +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=Tjp/K7V4aeZ2PgazV2PZVptEh7zms5rfOPGdZhTspt8=; b=oerd7vYTN+WWmp jGB2nDEpT8Ode5AGvgfA973wqBP9QtS8FoY1hrRsKsYX6iKcqAj8xWDGwBR6kpfSf0sK4ZtCjU1NQ Om8QE88GD72jvWPPbnNyOPnDIMB52bXdVU4BGCXbSmkRxwmVON7CLkkDALEB8A5ps4Vufv/5/SNEk qJIuNdcKlAPZni0LqcFWUprqJYGSrqHNGQH6HZ8cqKBL5Z7kk4C/lzfGWKQAycSC2wKKeUu7JXHnC sS+dn+osUiNQTh3LD7rfyPINMxV4PpbQSk7RLjf96aFgCk1jI/rafmu/Y9z6jx1IHXarpm0rH6rbL XfWoUaKm9valM5DOz0xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXJv-00Epfy-1F; Thu, 05 Jan 2023 20:58:41 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUkr-00DQfO-4C for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:14:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=BGyNZMSELVhIYsmh8IQ0cClyJQ3/Pu1dOTSavukgh6c=; b=litQP3pFMIPihZR5G6DTQzK47r Ov0zYtl0+gnDk2NvmTPbX1DE9dIQtT4WHISLDFT+k9TcJKP8wZMv8Onfir+1cPMeYJAdQeqGgbWXF 0DnT8uiDcuwRmIYYajgpbEsTseMqgU77oN7KQWqKlgruEp/jjPiGnMPlZIEjIenCzCvdMy/ZubVPU lYDPaAN3riWbTRL0D0T+YS+mCH6iJhQgVymUOE1S3az6kcoo9S52j0rELioBgmGWT7PQ7yGtv0kfw E/u9tbT92OZh0jNjrIqU/RoTn00BulVkWiQJObrUjytQevIUJmfYvXHGoLTkXjpHuSkGwmYP3xjtD TuezSmrA==; Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTia-001Ve2-0a for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:54 +0000 Received: by mail-wr1-x436.google.com with SMTP id r2so1949122wrv.7 for ; Thu, 05 Jan 2023 09:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=BGyNZMSELVhIYsmh8IQ0cClyJQ3/Pu1dOTSavukgh6c=; b=DFV2Bk7pE1z4nPsGE5YQsNh5/MwQhELQBIwLpGoUt5Kr9gGjWSCWaFcpmx/AiWgzTM CeJmBndmStn53lw/APB9JGUuZ75hK168BLWCI/aimccr/+KgtnF2uyggiH/FpeScDRZ9 +Yl4VULKayXF9MQk0OaIC5ksglOZuaQtzTLCqmwMD/1z4GQbtzQL3k7lIkYbHCrOMtow OtLWWmEESfhoGWyamVruOyv2ut8FI+UEPxH2mD3AOfjNKwJHDRXDin5IrcMvaC0GLALj YbliiPCOSz8pGhwtNyXH32N8CUQXHE6sJcSAizkGHLBmITscU38JNk17TMPNYeNMrW1I pQ+w== 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=BGyNZMSELVhIYsmh8IQ0cClyJQ3/Pu1dOTSavukgh6c=; b=SdtJkKwnsqwRnP3dkBxeQGaWYDX3IR6iW0UbTwAvosnSZIQ0jBfPm0rKBIsOhm0hQX T0VoQVvECnKpkUilHUOFWAvrAK1eGsymXxxdPSteSCUmljsSHgfJL+1xFBpqHeLlyYQL FtG4deYK0JWMoYZu9eNxssdia371dOFkBLnamW7723wIzvLAkUai7MQxTTGyRs96ml3u GtM2QLgjs+8Y6khk0zUhGM0g7uqv9NRYGW3PCcwsXkEOfQUhsUBC3tNyvxyv8MDQ2i+x P5URO5NEIlH9cjrmdeRVkLnWcOprYT66eUapQFx1jgozUgdsua9fzOrg/UL+U2C9HPRT S4qA== X-Gm-Message-State: AFqh2komJ7hHcPJbSwPtNOySlpwQs1ylx6qtehNICbg/iEOX/krnU1iS B9PEirxGzk9gfZCHLuOTr2wlsQ== X-Google-Smtp-Source: AMrXdXuowYI8YNiqe+s1dAJFjpbJUx2V8Zot+mmm14+rnSw+zcIM7fBJvdIhDwBvmez939s1n5rILw== X-Received: by 2002:a5d:4e4c:0:b0:2b8:bcd8:1808 with SMTP id r12-20020a5d4e4c000000b002b8bcd81808mr215071wrt.44.1672938467798; Thu, 05 Jan 2023 09:07:47 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:47 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Fabien Parent , Markus Schneider-Pargmann Subject: [PATCH 1/8] dt-bindings: power: Add MT8365 power domains Date: Thu, 5 Jan 2023 18:07:28 +0100 Message-Id: <20230105170735.1637416-2-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170752_318955_BF4D1366 X-CRM114-Status: GOOD ( 14.24 ) 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 From: Fabien Parent Add power domains dt-bindings for MT8365. Signed-off-by: Fabien Parent Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Rob Herring --- Notes: Changes in v4: - Add infracfg_nao as it is used by mt8365 Changes in v3: - Renamed mt8365-power.h to mediatek,mt8365-power.h Changes in v2: - Made include/dt-bindings/power/mt8365-power.h dual-license. .../power/mediatek,power-controller.yaml | 6 ++++++ .../dt-bindings/power/mediatek,mt8365-power.h | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 include/dt-bindings/power/mediatek,mt8365-power.h diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml index 605ec7ab5f63..a496c43cfa16 100644 --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml @@ -30,6 +30,7 @@ properties: - mediatek,mt8186-power-controller - mediatek,mt8192-power-controller - mediatek,mt8195-power-controller + - mediatek,mt8365-power-controller '#power-domain-cells': const: 1 @@ -86,6 +87,7 @@ $defs: "include/dt-bindings/power/mt8183-power.h" - for MT8183 type power domain. "include/dt-bindings/power/mt8192-power.h" - for MT8192 type power domain. "include/dt-bindings/power/mt8195-power.h" - for MT8195 type power domain. + "include/dt-bindings/power/mediatek,mt8365-power.h" - for MT8365 type power domain. maxItems: 1 clocks: @@ -113,6 +115,10 @@ $defs: $ref: /schemas/types.yaml#/definitions/phandle description: phandle to the device containing the INFRACFG register range. + mediatek,infracfg-nao: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle to the device containing the INFRACFG-NAO register range. + mediatek,smi: $ref: /schemas/types.yaml#/definitions/phandle description: phandle to the device containing the SMI register range. diff --git a/include/dt-bindings/power/mediatek,mt8365-power.h b/include/dt-bindings/power/mediatek,mt8365-power.h new file mode 100644 index 000000000000..e6cfd0ec7871 --- /dev/null +++ b/include/dt-bindings/power/mediatek,mt8365-power.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* + * Copyright (c) 2022 MediaTek Inc. + */ + +#ifndef _DT_BINDINGS_POWER_MT8365_POWER_H +#define _DT_BINDINGS_POWER_MT8365_POWER_H + +#define MT8365_POWER_DOMAIN_MM 0 +#define MT8365_POWER_DOMAIN_CONN 1 +#define MT8365_POWER_DOMAIN_MFG 2 +#define MT8365_POWER_DOMAIN_AUDIO 3 +#define MT8365_POWER_DOMAIN_CAM 4 +#define MT8365_POWER_DOMAIN_DSP 5 +#define MT8365_POWER_DOMAIN_VDEC 6 +#define MT8365_POWER_DOMAIN_VENC 7 +#define MT8365_POWER_DOMAIN_APU 8 + +#endif /* _DT_BINDINGS_POWER_MT8365_POWER_H */ From patchwork Thu Jan 5 17:07:29 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: 13090476 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 ACDBDC3DA7A for ; Thu, 5 Jan 2023 20:58:34 +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=kfKxZH0uwBl+AOGJVn7YsfzGJPJzbOd0IlHWMqkwGQ8=; b=McUj5AoD5j3DHz SHWmwRVGV1GGfOBHia9Ad+RPxpMSP83rPH8XasxQoqJ3aW4WBSasV+l1YPu6UxhgeFsruCRhZmGas J2MnT6QiY5KzAMP2UZh3aCWNKKgQut24m1fgcK7Zz6/UrszaQ5vp3MY0Xd2EnGaqnyWCoEuKWueHc mp4rXZoEQ0Hp5SponJnX7lURVJqwofYxpp6tWvkewKi0GiLKDWW9BGfUnbgqQOABmWw1SRxIybcVb k7f6LLYmDWi0ng84IR8kq4YYckYJKAcCGo1rS398HG/yeKQX1/5eHdh+3IBhidPFKZ8z3JKHyyb9V auKBFbIQVTODW4zTp9AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXIo-00Ep5I-Us; Thu, 05 Jan 2023 20:57:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUkp-00DQdx-FD for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:14:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xvXKcEbwULcjNy/x9YB9utQCAcj11EGEkTp6VrX3MLc=; b=T60afaSgBBmp3ZYKe20mP1+qoa K5aC2NplXEpYUSRyrOgKBjbAml9wVu2vFzs2MrDeZEHaOScwtM4h+tv2SfuJQkdbq460ZY8Q0HfXy Vnm9PbjSjtCRXFZD0B6jaE2QkfrW7KVK02DmceAbnXuZ5ItJkTSVec2p9HEJNOXm3uRUVgxuoomtk JeG8tZMkFZb9nKlBoeqoJihWYIXHhIr+WFXPsw7aN8728GI4do5KiGzV1oOqUtZOjgWBvIeXcfhpz absU4EyW+Rih1l/LoNbKyZ3Z5a/e6PcL9FMl55ccvLWMTvr4zR42QXpzH5ro9Z9gsHywhmqjQj/rv 4wjgbDmw==; Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTia-001VeJ-0a for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:54 +0000 Received: by mail-wr1-x430.google.com with SMTP id bn26so17302325wrb.0 for ; Thu, 05 Jan 2023 09:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=xvXKcEbwULcjNy/x9YB9utQCAcj11EGEkTp6VrX3MLc=; b=TKpKVqD9gSHNYL2zofVueeqK1Tll1hALYFD6l7hkdRVGqMsPq+U+j3e7bECAudp95d /Vvj//pM0bw+/ZaKglX4L+dJVfPk5wZ4kV+D7bOKicrrpo3vWIW4MvyNAkP0kqoG5M4j lzfUwDQgIdMotwuJ0OOjnDix6sODlL90Ly3aJ1Qg5v7bYv0ReUfuPVpjrxLUYvnCNwky wMS/5dwxViCEDJrlMX7G9ZrmMeQpCIuW24+h2NYjvKrAxI7UkYvdZNxTKCCLA2tc0LhT bupHaB4Rid1gBGvXeZ92DdMdoZf0Io4RnsrpWNbsvkOzmbuxARXyWcJInyxh9x2d/sYc H8gQ== 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=xvXKcEbwULcjNy/x9YB9utQCAcj11EGEkTp6VrX3MLc=; b=jcTCAWtLDWTqHmHaEk+XoAR9/VI/p7LJVq3AxNXxuQE2/n3+eid1Te+W5MsxtdsWSZ qIwIverMsSj48kHJ7Wl3mnhEHpVjNctyw1S1syGyn3DAS6pHjj9Uq+zyFzl+QswdsAEu bD2oI35oHaYqH9H37urx04Ef/xNunL2FwHVQhghdCs/87aYfJNegDsxBJhNOkBd/2IiL /j6T6f4QgrIabIRwdFX4CXM83ouFNshfR1u8AOfWP9zxSr1cbxBCtMvRMGiAtz3ZTvqW MPb/j5BmSkLBlcveZZtuNi0on/wLY9jJ5Qw1K1llOvGFAhG4gAv6pXsJtgHvnUnMrFlY PUwA== X-Gm-Message-State: AFqh2kqaHJSNTGEXmbCwHSc8fJBtDQZ4L52G1RAa84ImmoaVsLjmO69/ kX3zPAFz32pR3M3gTKNsvLAdsQ== X-Google-Smtp-Source: AMrXdXs6DAkTMn1HVe6xKQPUdVm7ulbeOGCPzUQJnFZ7cJeSbtwnc2P0YPv4b1zCiyl/YPH8IHpLaw== X-Received: by 2002:adf:f183:0:b0:255:96ed:950b with SMTP id h3-20020adff183000000b0025596ed950bmr30788321wro.60.1672938468864; Thu, 05 Jan 2023 09:07:48 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:48 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , 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 2/8] soc: mediatek: pm-domains: Split bus_prot_mask Date: Thu, 5 Jan 2023 18:07:29 +0100 Message-Id: <20230105170735.1637416-3-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170752_320261_4D100B00 X-CRM114-Status: GOOD ( 12.85 ) 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 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 --- 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/mtk-pm-domains.c index 474b272f9b02..4333cd297405 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -122,18 +122,20 @@ static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, st int i, ret; for (i = 0; i < SPM_MAX_BUS_PROT_DATA; i++) { - u32 val, mask = bpd[i].bus_prot_mask; + u32 val; + u32 set_clr_mask = bpd[i].bus_prot_set_clr_mask; + u32 sta_mask = bpd[i].bus_prot_sta_mask; - if (!mask) + if (!set_clr_mask) break; if (bpd[i].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); ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, - val, (val & mask) == mask, + val, (val & sta_mask) == sta_mask, MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); if (ret) return ret; @@ -159,21 +161,23 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, int i, ret; for (i = SPM_MAX_BUS_PROT_DATA - 1; i >= 0; i--) { - u32 val, mask = bpd[i].bus_prot_mask; + u32 val; + u32 set_clr_mask = bpd[i].bus_prot_set_clr_mask; + u32 sta_mask = bpd[i].bus_prot_sta_mask; - if (!mask) + if (!set_clr_mask) continue; if (bpd[i].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); if (bpd[i].ignore_clr_ack) continue; ret = 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/mtk-pm-domains.h index 7d3c0c36316c..8aaed1c939d7 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -41,23 +41,24 @@ #define SPM_MAX_BUS_PROT_DATA 6 -#define _BUS_PROT(_mask, _set, _clr, _sta, _update, _ignore) { \ - .bus_prot_mask = (_mask), \ +#define _BUS_PROT(_set_clr_mask, _set, _clr, _sta_mask, _sta, _update, _ignore) { \ + .bus_prot_set_clr_mask = (_set_clr_mask), \ .bus_prot_set = _set, \ .bus_prot_clr = _clr, \ + .bus_prot_sta_mask = (_sta_mask), \ .bus_prot_sta = _sta, \ .bus_prot_reg_update = _update, \ .ignore_clr_ack = _ignore, \ } #define BUS_PROT_WR(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, false, false) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, false) #define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, false, true) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, true) #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, true, false) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, true, false) #define BUS_PROT_UPDATE_TOPAXI(_mask) \ BUS_PROT_UPDATE(_mask, \ @@ -66,9 +67,10 @@ INFRA_TOPAXI_PROTECTSTA1) 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; bool bus_prot_reg_update; bool ignore_clr_ack; From patchwork Thu Jan 5 17:07:30 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: 13090475 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 7F406C3DA7A for ; Thu, 5 Jan 2023 20:57:31 +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=YrcrPYRDsUEW6jin820qHxKnYknIfX3itRNtX7N26FI=; b=FM+TkHHh4JSKgR /2jjTJV9hc2V6rE/ofd+lxjHOkOa0uY6xaX5Jf/r8pzge118VizgLXmDdC33GsdSaMQFn4QHYUgrR Jx7BpBpEPWOcXJevq1dF8He2J6KYi2ooCNkpUH09Upao1l4CF7HPzZRM5ScDjshnrTv+g8GFM2RTC 2TeXsh0yKNQtU9IC5BujA2IgEIwEIyiYeYw21fet35OhtEa1kKHzTGGP29mR6tcdl/tEKSp0TylP+ TyX4i7rnD3CxLwQLb4Vzmu43GW99nCz+oskzF/0vwcVadA7uxNPzqrPf9mPfeJATm1W807VsywrPS /sqiydv15p02Z1+wNoOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXHm-00EoX4-Mh; Thu, 05 Jan 2023 20:56:27 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUkn-00DQbS-IC for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:14:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=qHSeF2epzfegJ6dyqinGOhs8+O9cuqph/+zCKOX0s7I=; b=jTVwWtMM5UDmgI954tJk9Lp3fJ ZGHf/zHDAystlJkRKfrBG6X+j5zyPG2QYrs2maw9OvH4CDVMG4k9SNPYIKVLdlvV9jFeGJDmKaRb+ WMLK1be6o+4tySxcb7Qg5NVAtUKGABkO1AUsA+W5luLV2DraCLlilDHHi7rHnx4qM0qREYWjUyDtB 6JZLUTlBLU3ZeTpN9N2nj+Yn/NOJXJQDI2GiERw5Lnp5yZCJ2hHJap9wR/j9keqM2dFTuRynJWTZh SlDhLeb5oV0dTFmaWLEshp6v9Jl5mhE8eUBE2rvtbUQedsD0NWnRBWuMMGFlqlLyaAlvr9G2htRdv A7Kebzrg==; Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTia-001Veb-24 for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:56 +0000 Received: by mail-wr1-x42f.google.com with SMTP id az7so12371361wrb.5 for ; Thu, 05 Jan 2023 09:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=qHSeF2epzfegJ6dyqinGOhs8+O9cuqph/+zCKOX0s7I=; b=T9j5Z6Z77lWG3Lcdp+nVPM40kdXJmbdnZ0Ac4zTt8hMNtusoqDFw62aFNPEuz55H/U WImqKxepwo6EUI0Xbkt1jCxk4Flmu6Ye1l8pG1r26F4sGNR/2N2JaGSHa3HeHNKL/TPY KEEOajm91lmqyutXBKH9DN5ZlKWWuG14PbgOwDLl19aSK3sfZze9c5z0wWUGH6Lt2q5s UIkJ4RgB+DPR6oBEk09ocHcYb0CwDcEHRSqJkKMnsx/3GyxPh3zuL0qVhkyNgJ3eGaze 1uP3WbkMTlbXAoKJme+in2vRJRwlNGLdmy9nooKLqZsJ9lNbN/Trpe4/W73uYOffX/vf 8JyQ== 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=qHSeF2epzfegJ6dyqinGOhs8+O9cuqph/+zCKOX0s7I=; b=Gn8ZKRm+ClcbWNLH2y4FLPwozPbD3Pe/G/DEqiaQAcsc0bM5BKQ9A2+IhJPngAPeuQ 3WJNPVKasNoaVj6r6DM2pAbhL3rbfIFeEhRFVOiL2rqfjDSBOTR1a7Dv3m7kbQvVtc/8 AhjJcWwwnYrIlkCYYfQb4DCDz7iLJSW5wGbLBf80vC1NMNpIqUJ2/EQwwyRwC4TW3bmX KNpkeHrsQ8Jp6xGO/DqIFrqruUEe8JAKJDVEONShBDZUJmE5Y2rAkf67ZxBliwJ7tkQL 4oOlzEa8nKvgfv8zZo7ZRDzi2QsKeC7dVWLNiSxfWh//YmPx3DxTIlaWJjQZFV3itGoM a6fA== X-Gm-Message-State: AFqh2kq6+sX3VwXeKgcuoFp+K5W/OLhnm1xuN3RIWybDmLDMes4zRdHp RrDgPhzVMnLAs4v2U0dyDMMz2g== X-Google-Smtp-Source: AMrXdXsPKg+NGFgNV4C04Y1XgAhoYS0yvh7sfB1ozmk0QG2qKNE3ZLFRHj1PCnQ4jZIVzo+0C0/PJw== X-Received: by 2002:a5d:4f05:0:b0:28c:6430:c1bc with SMTP id c5-20020a5d4f05000000b0028c6430c1bcmr15570468wru.3.1672938469840; Thu, 05 Jan 2023 09:07:49 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:49 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , 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 3/8] soc: mediatek: pm-domains: Create bus protection operation functions Date: Thu, 5 Jan 2023 18:07:30 +0100 Message-Id: <20230105170735.1637416-4-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170752_788961_4691DCA8 X-CRM114-Status: GOOD ( 14.39 ) 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 Separate the register access used for bus protection enable/disable into their own functions. These will be used later for WAY_EN bits. Signed-off-by: Markus Schneider-Pargmann --- drivers/soc/mediatek/mtk-pm-domains.c | 68 +++++++++++++++------------ 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 4333cd297405..999e1f6c86b0 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -117,26 +117,50 @@ static int scpsys_sram_disable(struct scpsys_domain *pd) MTK_POLL_TIMEOUT); } +static int scpsys_bus_protect_clear(const struct scpsys_bus_prot_data *bpd, + struct regmap *regmap) +{ + u32 val; + u32 sta_mask = bpd->bus_prot_sta_mask; + + if (bpd->bus_prot_reg_update) + regmap_clear_bits(regmap, bpd->bus_prot_clr, bpd->bus_prot_set_clr_mask); + else + regmap_write(regmap, bpd->bus_prot_clr, bpd->bus_prot_set_clr_mask); + + if (bpd->ignore_clr_ack) + return 0; + + return regmap_read_poll_timeout(regmap, bpd->bus_prot_sta, + val, !(val & sta_mask), + MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); +} + +static int scpsys_bus_protect_set(const struct scpsys_bus_prot_data *bpd, + struct regmap *regmap) +{ + u32 val; + u32 sta_mask = bpd->bus_prot_sta_mask; + + if (bpd->bus_prot_reg_update) + regmap_set_bits(regmap, bpd->bus_prot_set, bpd->bus_prot_set_clr_mask); + else + regmap_write(regmap, bpd->bus_prot_set, bpd->bus_prot_set_clr_mask); + + return regmap_read_poll_timeout(regmap, bpd->bus_prot_sta, + val, (val & sta_mask) == sta_mask, + MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); +} + static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, struct regmap *regmap) { int i, ret; for (i = 0; i < SPM_MAX_BUS_PROT_DATA; i++) { - u32 val; - u32 set_clr_mask = bpd[i].bus_prot_set_clr_mask; - u32 sta_mask = bpd[i].bus_prot_sta_mask; - - if (!set_clr_mask) + if (!bpd[i].bus_prot_set_clr_mask) break; - if (bpd[i].bus_prot_reg_update) - regmap_set_bits(regmap, bpd[i].bus_prot_set, set_clr_mask); - else - regmap_write(regmap, bpd[i].bus_prot_set, set_clr_mask); - - ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, - val, (val & sta_mask) == sta_mask, - MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); + ret = scpsys_bus_protect_set(&bpd[i], regmap); if (ret) return ret; } @@ -161,24 +185,10 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, int i, ret; for (i = SPM_MAX_BUS_PROT_DATA - 1; i >= 0; i--) { - u32 val; - u32 set_clr_mask = bpd[i].bus_prot_set_clr_mask; - u32 sta_mask = bpd[i].bus_prot_sta_mask; - - if (!set_clr_mask) - continue; - - if (bpd[i].bus_prot_reg_update) - regmap_clear_bits(regmap, bpd[i].bus_prot_clr, set_clr_mask); - else - regmap_write(regmap, bpd[i].bus_prot_clr, set_clr_mask); - - if (bpd[i].ignore_clr_ack) + if (!bpd[i].bus_prot_set_clr_mask) continue; - ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, - val, !(val & sta_mask), - MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); + ret = scpsys_bus_protect_clear(&bpd[i], regmap); if (ret) return ret; } From patchwork Thu Jan 5 17:07:31 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: 13090671 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 16F60C3DA7A for ; Thu, 5 Jan 2023 23:13:14 +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=Q1fRhmu+QeTNwRZPqk86IKRo2np8D0wFUtIDE7+uOv4=; b=DlqyoUtX5nCz+C eEi1VVrlcZ/BOT+9jw9cSJofxom3PfiLkiJ9lh2PMXYMgx1fJjEOOIcXL/gL8MowvGth8uJLKFfZA HwT0IYNwfqu8zx6NDKUhFw1Dym/kjd4SQHSiMgLIcgjILk4h2pJ5CYuctGigHXa4ybeUgFc81gjuF YIVNUMq34TgnrFJtHxwsJtP48Uq/D+CSZZsfzGeFQCafCOorUvoIKLkux1ZmbcDLdNUc+cC7YS3GY qC5ga/ImNtxPYeWpvpKAjSdP39N4dMpoZ3VhgNTh+03lT7DIGY0K21dHxWyq+o7aWBZJ087QpIloW 9fKZ37iPFSwKln6jwUyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDZOz-00Fzz1-6J; Thu, 05 Jan 2023 23:12:02 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDVUw-00Dvue-J7 for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 19:01:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=XQxJ8mog5ezSsMdjmsKqEBp6+hXiOvAg1jR6vm7PG+8=; b=aYf+eji4/s9B3cBrFkg71QiCm+ WHBXl4qO0Qlomwr8W+iFIZgI9LDJ1tGSR1LLHAfkAlBd/y0g2hnV7wKjd5i7AdbbyT4zTNtB7HciP 8e157zI/GTcnL0MzsLapZEu6nP5bZZlY63NI0aCCM5QE3SBXRUEU52OB41pbXFopC3c5x98DikcQn e7rsSzjF29Ghzh7KMzVqTPc27MUAq0GURZYBhx833oMEeS8NOu0TAUgxVqP6HiWKu+n3SjRu1etJn 1RRWGUyGaMrkSJMlqNtW2Yk70M9+lghj+CThPIW7yVnr4TTGAe3uGCcUwTZtdj1gDYSZRbjI27aMJ Kboqv8iw==; Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTiU-001Vev-0m for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:48 +0000 Received: by mail-wr1-x42e.google.com with SMTP id r2so1949304wrv.7 for ; Thu, 05 Jan 2023 09:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=XQxJ8mog5ezSsMdjmsKqEBp6+hXiOvAg1jR6vm7PG+8=; b=4kxlkctBN34tswnclEHBz3Zz73r4pUFC3OC7ddlY91cJy5vWRE78R5eHn/ugD86m3o jJh9k7A9+zB7UWJtwYiyQP5yb/m+gYZJOcY6bTC6XJsH6Y4oduXx6hjq0322pOClRJqr PZwUiUfdQRKJkQPm00aWn2qRJ3J0U+jAqOBw9IbL4/Y3kN2NmSwIVKuW2qUdXslRjIcA iVqbzc9PtKskIO1dfXDCdTKTFFk39hIB8FQ/0WIpCL+RfpI9xuRfIbpyThFlSQsrGA8i G0FnEuyS3Nxrm/0Up0tup4tht2hBMA2X68hicu/hs698GRIdbIRbXAkG5Jh+akhGAimJ tC7w== 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=XQxJ8mog5ezSsMdjmsKqEBp6+hXiOvAg1jR6vm7PG+8=; b=l5W7akxrYCCEf1dbWuQelkANsAw+wCP5Iz0vUuqHCLYLLTE9CEAaa6ppE74KYOCKY8 oOI4+YKj56jKxf7nKA1S36UbzQDNptuxU3zBt2pex4jy+BeDvB8qFvK1vZ/4w33b81hs A9RciVfU9liIKsTVFLgXTtd6FJg9ao7ahjv36jC55N1GlaexG4UE4xxvceENtMp40ygB EDpkf82qwUN5g2DjtI4SDENdPQXsbPAZuy96AEzVue0T6vCo/hZSoQtaxHgOoiW85CRo EVd1woch87qg3bYXGo0Z+M73CWA2Az9a/5ol3L64jCSNP3dTHSWq8vBr8DOSnZIAUcQk KChg== X-Gm-Message-State: AFqh2kqqSn7WmMOugma7MguwdxHm/i2zwOxqKM1rrdLuhDmURPmu69ho tjNdcgx/qXhmWrv5wv0rWxM6hQ== X-Google-Smtp-Source: AMrXdXuj6LXzblcUMFL7Ac48d0ZUS2gXbM/A1z/fodQupcf7Yy/HCR4r5KENqvOgeaf+oVvjoUeOzg== X-Received: by 2002:a05:6000:789:b0:242:43d1:6d8a with SMTP id bu9-20020a056000078900b0024243d16d8amr40267367wrb.59.1672938470765; Thu, 05 Jan 2023 09:07:50 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:50 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , 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 4/8] soc: mediatek: pm-domains: Document scpsys_bus_prot_data Date: Thu, 5 Jan 2023 18:07:31 +0100 Message-Id: <20230105170735.1637416-5-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170746_333128_AF18379E X-CRM114-Status: GOOD ( 11.42 ) 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 Add a short documentation for the fields in struct scpsys_bus_prot_data. Signed-off-by: Markus Schneider-Pargmann --- drivers/soc/mediatek/mtk-pm-domains.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 8aaed1c939d7..da827e91d462 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -66,6 +66,18 @@ INFRA_TOPAXI_PROTECTEN, \ INFRA_TOPAXI_PROTECTSTA1) +/** + * struct scpsys_bus_prot_data - Bus protection setting + * @bus_prot_set_clr_mask: Bitmask used for the set and clear registers. + * @bus_prot_set: infracfg set register. + * @bus_prot_clr: infracfg clear register. + * @bus_prot_sta_mask: Bitmask used for the status register. + * @bus_prot_sta: infracfg status register. + * @bus_prot_reg_update: Only update the register bits given in the mask, do not + * write the whole register. + * @ignore_clk_ack: Ignore the result in the status register for clear + * operations. + */ struct scpsys_bus_prot_data { u32 bus_prot_set_clr_mask; u32 bus_prot_set; From patchwork Thu Jan 5 17:07:32 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: 13090586 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 F10DFC3DA7A for ; Thu, 5 Jan 2023 22:07:41 +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=SimN06qsUWVrJ9VF2qra20iHXZsrH0bt+WXH9TNcCXg=; b=NWg9m4eqnCUcHF 1emB+20rCPVQ0aUexuPDrTthWedwATFJuL2v3KdUkxCNduN8unkKlnHsn8OX8hC0z8CmElSDnKhMB Km0z9mN8p/LiW5aMR9fbnRNf7CrVK4VVYfPfbgsEWpCeCjphriwasuEXSc3MUgGDakYCOigfEmuiV o5ypiKn7KKV1TmXy91arDUUxg9N7vIIxrBhK8lnDdkNYqpmC7PE1lYMXrbJi25myKLsszUJG/TiSc aXyCjgIEGgtVBsThUxhOAfK/HFSLmaMEHQ40uBtaTDzaVnP6wRUuANo0MB3VrICeQWzRo0rm0IizL QbHeaFucMBhAuF0avWHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDYNl-00FPzP-3M; Thu, 05 Jan 2023 22:06:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDV9d-00DjaS-Q8 for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:39:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=+AVf+pfLkaJ1Gl2NWqezqv2bXezRKHHSaj8ghEqd14w=; b=d59qFnw2cpU/BJMqKDC/gsKPAd i3dzTtwpBuAZ7afQg/gs4NFJer0VUVxlfKuDlBLdxIepIhUpMfGPnu1WMgdPy/UI0DhvkaSgpJict EnZffkHh4vNBXIsXOeH5OMWS/x0j5VW9et+wlgdGO7w6t4lWtCDm3zks8KjfC8WhHBShLDx62hUqA /p9lIafLUNcky3BFPISjQhURj4ZutXWCXSqM2kRi9Snfe0WPyGfgi9UAPTUMsBnaFfpFZOj0jEmaa SnFnqnlzzoQUCJO2ue1Hc5xsCSaMsR/gEPY5rKmns3nLWlUfhsFFvPaOPb+gsicAbF6AagjeRFzQH fg+GMhrw==; Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTiV-001VfL-17 for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:49 +0000 Received: by mail-wr1-x431.google.com with SMTP id h16so36719886wrz.12 for ; Thu, 05 Jan 2023 09:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=+AVf+pfLkaJ1Gl2NWqezqv2bXezRKHHSaj8ghEqd14w=; b=y7jLrTG7p7QjcN2Cna7QAn3CMLp/iGX9hFgyWOvIeyQoOsHM3qakRasdP5KMfs+NZ2 FPGzPh9C37o2fDUts5urh+UMB69Vw/ZtDYJo91usNWWpzFe27e91iTXgrN37D02UUx9t A9JvGt7PQ8GoRaaxdmXkthGFdlZyGOajaTqKTinkqnl+uv1XKe3UHCKFEvvr+4LtZsLL AjXOiLXb2Mb1Xe0l7+XuzUtB3Imrpgn0hRHnNjrVUHZ6R94g8p2yLgyyT+xyPCEPI3RN DYPF1DpAztnyht4GNPZeB9OWUWZVtmH+Mr01s3DiR0khgIxwjyEXhz5WtNBVPTTz3INm YZKw== 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=+AVf+pfLkaJ1Gl2NWqezqv2bXezRKHHSaj8ghEqd14w=; b=mHqD46SsUZTc5fy2RtssQ/Nw+QcXlPFKkQP0XAZ3faaXSd4tNxGg30/D0Zo74ggQCH VQtbpouKwxwXluNl/eCmikiljv1wPTCOTO/8bDeLl0R7koXzSSg0cb5aBV/zJ8zah6NR gSi8iTUSDgERUsNEEZX0pMhyQimhK/b1U8oZV8PUecnhm5ayeRlXsz5oSv7wfrUXj5iI GubLsMlksvL02jZUgmsdFRtxpW5fu+R13nMi8YQ/n3K9pq8L5KuulJfk/lV6fsb6pKBI famxUw6iFhSN90nHorxygzd5aXjd3F66i2x3DI2S00o0opQdX5QzBwiMCTgFCEtm+qGr Gq+g== X-Gm-Message-State: AFqh2kpZ0aPQS+tD4MZrNr8IUSCkZtfGsZBb/rYdY2A4j6J5fU5c8Vd3 iDE6x3NhELE5r3yimdDEV6bldA== X-Google-Smtp-Source: AMrXdXvaEZbEf1VJvkJQZUZ0wp7+NbVXpfFjW83Omw2E04q6K1OndbNKvbHNrGOYQSYHZx9OqH/3Tw== X-Received: by 2002:adf:ea4a:0:b0:27e:8d9b:bc20 with SMTP id j10-20020adfea4a000000b0027e8d9bbc20mr26665705wrn.27.1672938471790; Thu, 05 Jan 2023 09:07:51 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:51 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , 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 5/8] soc: mediatek: pm-domains: Fix caps field documentation Date: Thu, 5 Jan 2023 18:07:32 +0100 Message-Id: <20230105170735.1637416-6-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170747_474408_FF4933C4 X-CRM114-Status: GOOD ( 11.54 ) 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 This field is not for ACTIVE_WAKEUP exclusively. There are a lot of other flags defined as well. Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains") Signed-off-by: Markus Schneider-Pargmann --- drivers/soc/mediatek/mtk-pm-domains.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index da827e91d462..34642a279213 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -95,7 +95,7 @@ struct scpsys_bus_prot_data { * @ctl_offs: The offset for main power control register. * @sram_pdn_bits: The mask for sram power control bits. * @sram_pdn_ack_bits: The mask for sram power control acked bits. - * @caps: The flag for active wake-up action. + * @caps: MTK_SCPD_* capability flags. * @bp_infracfg: bus protection for infracfg subsystem * @bp_smi: bus protection for smi subsystem */ From patchwork Thu Jan 5 17:07:33 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: 13090480 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 11A48C3DA7A for ; Thu, 5 Jan 2023 21:01:35 +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=5anmxY7JNsKWqCXSt92V/NgXo054uH3VS9tqUsO4xls=; b=Rgz9zjzJBKArXx KBABK3UHl0GPHegFmpnTI+TmGAwwZvl+hVc9qR5hlBeXtJAHOYCIPN5YMnz6eq6oVgsuZmsjIGW/H 8wk+3dmDG07UcPowNMlOiaoeQzce8RNsBw+3IHZ1GvqVFJJrINNP8yGZ16WbP9U+hXs63dFWnvKOS Vju4bkQTqMYw4gbudtymnuR6NPE4cukni3Fz69VVDS3AN7R2Lmo6MNYWMD3GF7rzPLsl93C2kLoKY juDdjtjcfjCSppxsDdhwtGChVZYdvYZeEO2Ht+l3dHpTLVtbY7gtJ8ACMqp515J33248wIe6B6Ulk GZja6zdZHCCb8RQZ7mhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXLc-00EqfP-OT; Thu, 05 Jan 2023 21:00:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUla-00DRGt-J7 for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:15:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=KPJV1qfI65vcb6ofJWhCMHNO2xRqa9GjQ0e1B9CiTNQ=; b=exoi2iEJdAwGWD9x1eAcntqJpI lo3etxaMKJL7gLYrDLvb/BBv6snKdF2ZxRKKqUrstpU2X8Z011++qEjgWxMZbom+ZOpMH3130zD72 O9klEWYKRHWRXbJH+2wy0uXW9BSruMVk5ChAhqu/cpIu2hLDWIBKpVUlM9vwJWEObu2Ibs1W0/bfj H7O7Y3k6HvgR6HiQgzSAxKIHaVZc6sKBq42HgkfWe9d3FZ7fbJGcuzR910pYY5EOd7TuMYEzrC0aY Fe/5mhbRj9VUAd/PBVFy43CrZ6BINXPBQC/sfBYBr43AHj/MFNArmsG27rl72wxIjTFkugjbErXDb mSfMroNQ==; Received: from mail-wm1-f54.google.com ([209.85.128.54]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTia-001Vg1-0S for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:54 +0000 Received: by mail-wm1-f54.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso1837950wmq.1 for ; Thu, 05 Jan 2023 09:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=KPJV1qfI65vcb6ofJWhCMHNO2xRqa9GjQ0e1B9CiTNQ=; b=yNsOPbDTM0efU9dE//dgz3rHOrXf/sZWUnEGrQcLupD9McKI9FV03L2Spct4MXfF4S TU8AU8AzjfBeTcB7tDXILCKm7rE+WjqBJRRHF70S2hg6kLrq5B224CgNH004pnKtNOvh ew6qC7fSouMuSq+iVPPF3Ri49sGNgZqzNd/IOE5JOh8gV+GtaIJc5dUqr82tYrNwfI7X W7zBiIgay+TkR62pupN0EEF2sIp+F4GYUnogdRMqpgMGCCTUtyOAKDchHCrh3spQPPKY 5Zy3Mo4lrNThLPbZgiLumzbTI+GdZsyVnjzkT5v6zijPPW+7WqTu7cC8e536cUunBMZA 3bCw== 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=KPJV1qfI65vcb6ofJWhCMHNO2xRqa9GjQ0e1B9CiTNQ=; b=fwVCxL044+FNsLpBfMuuc9Q73+kycAcJJr/dIlRQAvkwyIGR5C3aAqZdrVN74nh9Ke IUGf8eGkslRYWXrJoy6kxLgbq+V+3cP19wfQainuYBSOdbAGf2zUBMLTpOR5FmVoMLWX I2WSLX71/sArhhQPDUeIJ8MI3xds0obg96TKqzjSBPZbfm12vKgqecun9Y27JjAar0sw CUz32PlnWhoLN6yoHlFImg4W6ZXCFkpwBTccR+3NJWfGxe8hTHAaIXCdTP8qkTWq1e/8 8lR6ezGpv8QG31Hb8MTwer77ULg4wqamovKDz6NczxZ2cH+PZOt+N9DR0odZBut5I/pz 770A== X-Gm-Message-State: AFqh2krfLiEhGobERxE9q0Bey2PLTjml42bYollDsKOWv49Sv8fH9j/8 oG4GGk9c5xxVn4NLoEzZreT3Lw== X-Google-Smtp-Source: AMrXdXuIXDpOZkm4ix/uQdGbtjWGymqzEfazAjrzvDtgZc3mURrErZ0nErcrf/OQqJfWoIsPn55TIw== X-Received: by 2002:a05:600c:687:b0:3cf:e7c8:494 with SMTP id a7-20020a05600c068700b003cfe7c80494mr37142812wmn.29.1672938472975; Thu, 05 Jan 2023 09:07:52 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:52 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Alexandre Bailon , Fabien Parent , Markus Schneider-Pargmann Subject: [PATCH 6/8] soc: mediatek: Add support for WAY_EN operations Date: Thu, 5 Jan 2023 18:07:33 +0100 Message-Id: <20230105170735.1637416-7-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170752_305362_442CD5FE X-CRM114-Status: GOOD ( 23.13 ) 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 From: Alexandre Bailon This updates the power domain to support WAY_EN operations. These operations enable a path between different units of the chip and are labeled as 'way_en' in the register descriptions. This operation is required by the mt8365 for the MM power domain. Signed-off-by: Alexandre Bailon Signed-off-by: Fabien Parent Signed-off-by: Markus Schneider-Pargmann --- Notes: Changes in v4: - Redesigned the patch to be better to understand and have less code duplication Changes in v3: - Separated the way_en functions for clarity - Added some checks for infracfg_nao Changes in v2: - some minor style fixes. - Renamed 'wayen' to 'way_en' to clarify the meaning - Updated commit message drivers/soc/mediatek/mtk-pm-domains.c | 57 ++++++++++++++++++++------- drivers/soc/mediatek/mtk-pm-domains.h | 16 ++++++-- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 999e1f6c86b0..d53309f050ee 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -43,6 +43,7 @@ struct scpsys_domain { struct clk_bulk_data *clks; int num_subsys_clks; struct clk_bulk_data *subsys_clks; + struct regmap *infracfg_nao; struct regmap *infracfg; struct regmap *smi; struct regulator *supply; @@ -118,10 +119,13 @@ static int scpsys_sram_disable(struct scpsys_domain *pd) } static int scpsys_bus_protect_clear(const struct scpsys_bus_prot_data *bpd, - struct regmap *regmap) + struct regmap *regmap, + struct regmap *sta_regmap) { u32 val; u32 sta_mask = bpd->bus_prot_sta_mask; + /* way_en acknowledges successful clear with the bit being set */ + u32 expected_ack = (bpd->way_en ? sta_mask : 0); if (bpd->bus_prot_reg_update) regmap_clear_bits(regmap, bpd->bus_prot_clr, bpd->bus_prot_set_clr_mask); @@ -131,13 +135,14 @@ static int scpsys_bus_protect_clear(const struct scpsys_bus_prot_data *bpd, if (bpd->ignore_clr_ack) return 0; - return regmap_read_poll_timeout(regmap, bpd->bus_prot_sta, - val, !(val & sta_mask), + return regmap_read_poll_timeout(sta_regmap, bpd->bus_prot_sta, + val, (val & sta_mask) == expected_ack, MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); } static int scpsys_bus_protect_set(const struct scpsys_bus_prot_data *bpd, - struct regmap *regmap) + struct regmap *regmap, + struct regmap *sta_regmap) { u32 val; u32 sta_mask = bpd->bus_prot_sta_mask; @@ -147,12 +152,13 @@ static int scpsys_bus_protect_set(const struct scpsys_bus_prot_data *bpd, else regmap_write(regmap, bpd->bus_prot_set, bpd->bus_prot_set_clr_mask); - return regmap_read_poll_timeout(regmap, bpd->bus_prot_sta, + return regmap_read_poll_timeout(sta_regmap, bpd->bus_prot_sta, val, (val & sta_mask) == sta_mask, MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); } -static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, struct regmap *regmap) +static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, + struct regmap *regmap, struct regmap *infracfg_nao) { int i, ret; @@ -160,9 +166,14 @@ static int _scpsys_bus_protect_enable(const struct scpsys_bus_prot_data *bpd, st if (!bpd[i].bus_prot_set_clr_mask) break; - ret = scpsys_bus_protect_set(&bpd[i], regmap); - if (ret) + if (bpd[i].way_en) + ret = scpsys_bus_protect_clear(&bpd[i], regmap, infracfg_nao); + else + ret = scpsys_bus_protect_set(&bpd[i], regmap, regmap); + if (ret) { + pr_err("%s %d %d\n", __PRETTY_FUNCTION__, __LINE__, ret); return ret; + } } return 0; @@ -172,15 +183,17 @@ static int scpsys_bus_protect_enable(struct scpsys_domain *pd) { int ret; - ret = _scpsys_bus_protect_enable(pd->data->bp_infracfg, pd->infracfg); + ret = _scpsys_bus_protect_enable(pd->data->bp_infracfg, + pd->infracfg, pd->infracfg_nao); if (ret) return ret; - return _scpsys_bus_protect_enable(pd->data->bp_smi, pd->smi); + return _scpsys_bus_protect_enable(pd->data->bp_smi, pd->smi, NULL); } static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, - struct regmap *regmap) + struct regmap *regmap, + struct regmap *infracfg_nao) { int i, ret; @@ -188,9 +201,14 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, if (!bpd[i].bus_prot_set_clr_mask) continue; - ret = scpsys_bus_protect_clear(&bpd[i], regmap); - if (ret) + if (bpd[i].way_en) + ret = scpsys_bus_protect_set(&bpd[i], regmap, infracfg_nao); + else + ret = scpsys_bus_protect_clear(&bpd[i], regmap, regmap); + if (ret) { + pr_err("%s %d %d\n", __PRETTY_FUNCTION__, __LINE__, ret); return ret; + } } return 0; @@ -200,11 +218,12 @@ static int scpsys_bus_protect_disable(struct scpsys_domain *pd) { int ret; - ret = _scpsys_bus_protect_disable(pd->data->bp_smi, pd->smi); + ret = _scpsys_bus_protect_disable(pd->data->bp_smi, pd->smi, NULL); if (ret) return ret; - return _scpsys_bus_protect_disable(pd->data->bp_infracfg, pd->infracfg); + return _scpsys_bus_protect_disable(pd->data->bp_infracfg, + pd->infracfg, pd->infracfg_nao); } static int scpsys_regulator_enable(struct regulator *supply) @@ -378,6 +397,14 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no return ERR_CAST(pd->smi); } + pd->infracfg_nao = syscon_regmap_lookup_by_phandle(node, "mediatek,infracfg-nao"); + if (IS_ERR(pd->infracfg_nao)) { + if (MTK_SCPD_CAPS(pd, MTK_SCPD_HAS_WAY_EN)) + return ERR_CAST(pd->infracfg_nao); + + pd->infracfg_nao = NULL; + } + num_clks = of_clk_get_parent_count(node); if (num_clks > 0) { /* Calculate number of subsys_clks */ diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 34642a279213..1fa634509db1 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -10,6 +10,7 @@ #define MTK_SCPD_DOMAIN_SUPPLY BIT(4) /* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */ #define MTK_SCPD_ALWAYS_ON BIT(5) +#define MTK_SCPD_HAS_WAY_EN BIT(6) #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x)) #define SPM_VDE_PWR_CON 0x0210 @@ -41,7 +42,7 @@ #define SPM_MAX_BUS_PROT_DATA 6 -#define _BUS_PROT(_set_clr_mask, _set, _clr, _sta_mask, _sta, _update, _ignore) { \ +#define _BUS_PROT(_set_clr_mask, _set, _clr, _sta_mask, _sta, _update, _ignore, _way_en) { \ .bus_prot_set_clr_mask = (_set_clr_mask), \ .bus_prot_set = _set, \ .bus_prot_clr = _clr, \ @@ -49,16 +50,20 @@ .bus_prot_sta = _sta, \ .bus_prot_reg_update = _update, \ .ignore_clr_ack = _ignore, \ + .way_en = _way_en, \ } #define BUS_PROT_WR(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, false) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, false, false) #define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, true) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, false, true, false) #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _mask, _sta, true, false) + _BUS_PROT(_mask, _set, _clr, _mask, _sta, true, false, false) + +#define BUS_PROT_WAY_EN(_set_mask, _set, _sta_mask, _sta) \ + _BUS_PROT(_set_mask, _set, _set, _sta_mask, _sta, true, false, true) #define BUS_PROT_UPDATE_TOPAXI(_mask) \ BUS_PROT_UPDATE(_mask, \ @@ -77,6 +82,8 @@ * write the whole register. * @ignore_clk_ack: Ignore the result in the status register for clear * operations. + * @way_en: Enable a way in the SoC. For this type the status bit to acknowledge + * the change is always 1 on successful change. */ struct scpsys_bus_prot_data { u32 bus_prot_set_clr_mask; @@ -86,6 +93,7 @@ struct scpsys_bus_prot_data { u32 bus_prot_sta; bool bus_prot_reg_update; bool ignore_clr_ack; + bool way_en; }; /** From patchwork Thu Jan 5 17:07:34 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: 13090448 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 D494AC3DA7A for ; Thu, 5 Jan 2023 20:45:21 +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=IZHHKvjApWv2GJDNqjAd2hV+PvzCoP2nTV4kTpnVeak=; b=Lme9IMsces3Vda TLNs0vw35tlcbjDqBm2qnxqnTqUyDRxQl3It/TBvBtVR8Cn+5N+hDD8yWB/K37Jl7JQViG9QYnmqp pC62c5EIfDEL6SXU3klr4TR9CQFxmjWa3Ie9IOTlMy8g8bPLnX7j9R0FdVg1CO8qQmZYMv1lW3Jje uv7rPht6ngfi+NyMatmHKYQkIBU5z1q4LjXiaH9J0YcHUZxsA/8kYbENbNihnUEyhR4TS6kxFgdal /ZegXMpmPdOgUE8ME549VIOfcZUdC4IB+imD6yKrdZrO2NW5VCIk9LK8R2Rd3jot9MzvicsTwwB1b xMhH8gFAn3Cr2/PXcLcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDX62-00EhbZ-P4; Thu, 05 Jan 2023 20:44:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDTz7-00CujA-Ew for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 17:24:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=sncxYiJ19EBEMYozwgCXbGEKSdQ2+11yxAIRrAVvyso=; b=UpX6fZopVz992EPPl7EpIhBzzs f8Mo58ZbUjPD/N/HZ/nOXVKYl5oAvrMRaXYjT8EHTTCzej0Q3LB2oAjvGFgw9Y/OzTHc91TCrnGJ8 HD6uhI0O/6ManonEXDaf0L3Bm9ryTK/rvBj/LkP3NeusC3y6xfa3GO8PFxCeSAAgS+gTpL3oI6mf3 p5JBs0UsDYhcxUFjO8+pCXAFzpHSz4kY3DmxpnQwiqZv2pgkcLJy6Y1D4z1bAL7mB9Iogs3KNCe4Z GiCIxSrN7jTcjhpYM75vqp57u5dL1RMUXzFMDRmnRZtxsRB9ZuZWTsOdMTtWFeYTYJbil+sNGP7tZ lxIJkI3w==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by casper.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDTir-00GKHu-2H for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:08:11 +0000 Received: by mail-wm1-x333.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso2563069wmb.1 for ; Thu, 05 Jan 2023 09:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=sncxYiJ19EBEMYozwgCXbGEKSdQ2+11yxAIRrAVvyso=; b=L8GGi7ni7dl6wFN8IW77qB70367v8PhZ3Sd7+oJtMLY5Ej9cNvDNLQSAsDm09a+xsP wK3c5FXsCw2fAI8nS6woEXI0BA5uhEXQAs1+yNidpxEMs39ztajNLQMH9bjXgBm615vp 3UTrsw/syO8Q2MNa9PtePGoMM7ezHfYurfTCo5Ds8UGYdF/+rmD+F7wd79Y8dZwU7VSn B14ErNIeK6oq02bUfQPt0ZEJNesP1wNbvDsX2THshhyp5+nW2Par/RJXvy52WSR2YMq1 ZFJUeYixlF/HoXntuGwSv4jBB+damvcCP4cq//5M4DNqUB6jD+nSsg5nryz18+5IskYw fWLw== 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=sncxYiJ19EBEMYozwgCXbGEKSdQ2+11yxAIRrAVvyso=; b=w71H7lcLykDj3yZa1cOOkQ+44bvyLqH50MrVL5eZ3Zf5uJtXwDFyiHqFOWtYmdWw2g a0eaKXLe6u9lJIx9+5b3IIE1izwhIQgn8HeyXcG/asJzXzmVvPOq2J4NQVRP0oCG0M7S tdNX24dTrhS5fvBNE8o8SVbweW5+8HRsWH+JA90MAe2xlvQDrtBwEIwvbWKGe+9Pp7/b 1FkygN8/uq3FNX766gYeo7IIdYydhMKGqaNJwxv0+sxEYymcHfU+mijmHahhgAFnm5Y7 WD1CeJ6ii8ybaLQmb+kOx7hdfdebrGx4CicHgdQeQSjIyAirdd0k2FmvqnqdpzwBtEK/ po7Q== X-Gm-Message-State: AFqh2koh39I2zFQipTKwb8dhc0MQ1MMLrKajslFroOf8BcNfSDjjgwjq sbozJn65g3nAwzCQnVLH2ozfzRxCozv/pqah X-Google-Smtp-Source: AMrXdXsa25aMnGI1cayPOWzrjuYzyQhetcgmL1o5YukwOgaRADsQ2/BrQNcacZ4JwiA8kuPZNNtW5g== X-Received: by 2002:a1c:770b:0:b0:3cf:a18d:399c with SMTP id t11-20020a1c770b000000b003cfa18d399cmr39048182wmi.1.1672938474085; Thu, 05 Jan 2023 09:07:54 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:53 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Alexandre Bailon , Fabien Parent , Markus Schneider-Pargmann Subject: [PATCH 7/8] soc: mediatek: Add support for MTK_SCPD_STRICT_BUS_PROTECTION cap Date: Thu, 5 Jan 2023 18:07:34 +0100 Message-Id: <20230105170735.1637416-8-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170809_157609_4F84B6B0 X-CRM114-Status: GOOD ( 17.14 ) 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 From: Alexandre Bailon This adds support for MTK_SCPD_STRICT_BUS_PROTECTION capability. It is a strict bus protection policy that requires the bus protection to be disabled before accessing the bus. This is required by the mt8365, for the MM power domain. Signed-off-by: Alexandre Bailon Signed-off-by: Fabien Parent Signed-off-by: Markus Schneider-Pargmann --- Notes: Changes in v4: - Change name in title and commit message Changes in v3: - Rename MTK_SCPD_STRICT_BUSP to MTK_SCPD_STRICT_BUS_PROTECTION - Remove extra bool variable reflecting the capability Changes in v2: - Fixup error handling path. drivers/soc/mediatek/mtk-pm-domains.c | 27 +++++++++++++++++++++++---- drivers/soc/mediatek/mtk-pm-domains.h | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index d53309f050ee..29a9028dd9b3 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -265,9 +265,17 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); - ret = clk_bulk_prepare_enable(pd->num_subsys_clks, pd->subsys_clks); - if (ret) - goto err_pwr_ack; + /* + * In few Mediatek platforms(e.g. MT6779), the bus protect policy is + * stricter, which leads to bus protect release must be prior to bus + * access. + */ + if (!MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUS_PROTECTION)) { + ret = clk_bulk_prepare_enable(pd->num_subsys_clks, + pd->subsys_clks); + if (ret) + goto err_pwr_ack; + } ret = scpsys_sram_enable(pd); if (ret < 0) @@ -277,12 +285,23 @@ static int scpsys_power_on(struct generic_pm_domain *genpd) if (ret < 0) goto err_disable_sram; + if (MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUS_PROTECTION)) { + ret = clk_bulk_prepare_enable(pd->num_subsys_clks, + pd->subsys_clks); + if (ret) + goto err_enable_bus_protect; + } + return 0; +err_enable_bus_protect: + scpsys_bus_protect_enable(pd); err_disable_sram: scpsys_sram_disable(pd); err_disable_subsys_clks: - clk_bulk_disable_unprepare(pd->num_subsys_clks, pd->subsys_clks); + if (!MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUS_PROTECTION)) + clk_bulk_disable_unprepare(pd->num_subsys_clks, + pd->subsys_clks); err_pwr_ack: clk_bulk_disable_unprepare(pd->num_clks, pd->clks); err_reg: diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 1fa634509db1..e5aa2348a9db 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -11,6 +11,7 @@ /* can't set MTK_SCPD_KEEP_DEFAULT_OFF at the same time */ #define MTK_SCPD_ALWAYS_ON BIT(5) #define MTK_SCPD_HAS_WAY_EN BIT(6) +#define MTK_SCPD_STRICT_BUS_PROTECTION BIT(7) #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x)) #define SPM_VDE_PWR_CON 0x0210 From patchwork Thu Jan 5 17:07:35 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: 13090500 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 0E1C4C3DA7A for ; Thu, 5 Jan 2023 21:28:21 +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=SNDQvzfnPLSAz9gMOkam0vEVtUN3Z9ti3lFuRoz+R+g=; b=NiF3mskhvr5NnJ 51cpmzHH1r6cw6qS5dXp7JYtb8Oco3Y0aLadmrE4DgcWuJT+QShEgEiimlBfEUC6sjv9zx+MxDUJ5 43mbgnOahwvuPSP6R99pwjXjHd0GH1HJC+eJLGdhIBmIJzakfpsfsbu8+ejx5U2okSGE49Pa0l1Qy gFkHdoOk5F/F1gsJt3rk/pmbp8FwXwJLPEvsqjHOug7A2cFKNZvTQTXtqbT8xuz2iOSoNwQsVPy40 U8zNJ9ot19UqGIUtMs9btopqjMeo82Uuwxm0k0twVDwAnQg0igH3cX2jzm9eHgt9TZjnJ7Ko1bKqQ e9d0tHqn+ppGV9hZW3RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDXlb-00F5iA-8Y; Thu, 05 Jan 2023 21:27:15 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDUwQ-00DZ53-HF for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 18:26:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=vP64e5b9ohPWmtQISJdT6ZMeITPgHiIqXiaeBFbmRb0=; b=EZKqbbdC+/p8QkgZ96qwRtDKJz Mf9+bZznbewBi+/c5RmYiU7kAaYx5uRWbaa0h2umk/vmHV/DsUaCO4wPJKSwhQehZBd4oAWi7i0ui KnKqa8i9IaFwMCaJbcSOsFV9G/IkyDIlu0Yja7A8PE86rXlyYhozBShNO5PnQyewO1N2gnEzI9tly wESBmux898XtGgW3Nc4SQ7llm7AtrRdBuogtjcq24KuqpkVcTRLn0bm3edPTXjjbKVrBp0c/DpFbA GrcbNGIkwPEYvRBgMXKpcD//CGn/9fNwueUJc+/U3UE2Nvpvwf/TVUlLgMN5HafeDkYdDYzQFWoEq lQonNa5A==; Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDTiY-001Vec-0b for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 17:07:52 +0000 Received: by mail-wr1-x434.google.com with SMTP id m7so2326254wrn.10 for ; Thu, 05 Jan 2023 09:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; 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=vP64e5b9ohPWmtQISJdT6ZMeITPgHiIqXiaeBFbmRb0=; b=eCNMHDOaWZVSQxYE+JmQV8tG4HWDvxojEViLcY7wJRhQzMqsxDtzFgrjlujeERKhEJ K0R+BPVOcnmZJN/RtFEVPnktuxHBcDaWQFKZjnQc9SiYGXl050ITes6RIuDXKQvovVsx cQLSaMVucd2bHrRVTvYJXc51FFdbtJjUMmUBO5enk1YjPGB41+VRZeiayZVAjQN4P7MV 4vXCOG2iTMFbLNZwUX6bethu+JxTW4TqemawA2IosX5KXyVrFxR+/KDGM5hbpwXU8iFt RUdriaIDnqvhqMXPjviX6VExdGwnWGyJKKpnrXqdALfTL8unN3/nibCPRyzkxe7qbeI1 ns7Q== 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=vP64e5b9ohPWmtQISJdT6ZMeITPgHiIqXiaeBFbmRb0=; b=WTGNLzcazYpLMp99N+Mg+kd4Ows30UCYtnVf8g6YNnEnxxsZf82GXbPUoHm3zXV7KR jgz7uhlFNRyWOWrgbkT/jOs0am4lnxoV5+Whg/FzJl44rnx7h0lA9H+k0x6eScHWViVV GmAhOrx5mlsWDfYIebE56ZI7SLMWBYcK0VHE/mEAfpIkqk07UqS2zIOIUDaZ1Y72/M8M q61VxU2kmtABl6wTNenEIO8Vtpl7uYIuZOSxzONSWBSnJUsui6VNcxHk0BmXWZFcj62V FAiIpq0A+lH1MNqT7UACAfOi4OmNcXZNsFKJTkYgMRDILlBIQeCSvsA2LIxvz/UjDBVI a2kA== X-Gm-Message-State: AFqh2kof4aEMbvTMc3pL4n73I3bjIxxvszxax1ouIL30QtmLRz/snbcg o9Bm2257RwHaDZfNWk8vob/7HQOviIg0MoQN X-Google-Smtp-Source: AMrXdXs2RKfEtCAqsPWOgrfPiuG4a6OOYOxjvHp/8Zh9GrpmHzgNu0JjO9S3KNSOrksOPYFxO2638A== X-Received: by 2002:a05:6000:242:b0:27f:aa94:a9f2 with SMTP id m2-20020a056000024200b0027faa94a9f2mr23955810wrz.68.1672938475251; Thu, 05 Jan 2023 09:07:55 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:9cf4:fdb8:bb61:5f4e]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b002365730eae8sm37164853wrm.55.2023.01.05.09.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 09:07:54 -0800 (PST) From: Markus Schneider-Pargmann To: Rob Herring , Krzysztof Kozlowski , Matthias Brugger Cc: Chun-Jie Chen , AngeloGioacchino Del Regno , Fabien Parent , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Fabien Parent , Markus Schneider-Pargmann Subject: [PATCH 8/8] soc: mediatek: pm-domains: Add support for MT8365 Date: Thu, 5 Jan 2023 18:07:35 +0100 Message-Id: <20230105170735.1637416-9-msp@baylibre.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105170735.1637416-1-msp@baylibre.com> References: <20230105170735.1637416-1-msp@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_170750_621980_B8C0DA90 X-CRM114-Status: GOOD ( 16.77 ) 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 From: Fabien Parent Add the needed board data to support MT8365 SoC. Signed-off-by: Fabien Parent Signed-off-by: Markus Schneider-Pargmann --- drivers/soc/mediatek/mt8365-pm-domains.h | 147 +++++++++++++++++++++++ drivers/soc/mediatek/mtk-pm-domains.c | 5 + 2 files changed, 152 insertions(+) create mode 100644 drivers/soc/mediatek/mt8365-pm-domains.h diff --git a/drivers/soc/mediatek/mt8365-pm-domains.h b/drivers/soc/mediatek/mt8365-pm-domains.h new file mode 100644 index 000000000000..8735e833b15b --- /dev/null +++ b/drivers/soc/mediatek/mt8365-pm-domains.h @@ -0,0 +1,147 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __SOC_MEDIATEK_MT8365_PM_DOMAINS_H +#define __SOC_MEDIATEK_MT8365_PM_DOMAINS_H + +#include "mtk-pm-domains.h" +#include + +/* + * MT8365 power domain support + */ + +static const struct scpsys_domain_data scpsys_domain_data_mt8365[] = { + [MT8365_POWER_DOMAIN_MM] = { + .name = "mm", + .sta_mask = PWR_STATUS_DISP, + .ctl_offs = 0x30c, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .caps = MTK_SCPD_STRICT_BUS_PROTECTION | MTK_SCPD_HAS_WAY_EN, + .bp_infracfg = { + BUS_PROT_WR(BIT(16) | BIT(17), 0x2a8, 0x2ac, 0x258), + BUS_PROT_WR(BIT(1) | BIT(2) | BIT(10) | BIT(11), 0x2a0, 0x2a4, 0x228), + BUS_PROT_WAY_EN(BIT(6), 0x200, BIT(24), 0x0), + BUS_PROT_WAY_EN(BIT(5), 0x234, BIT(14), 0x28), + BUS_PROT_WR(BIT(6), 0x2a0, 0x2a4, 0x228), + }, + }, + [MT8365_POWER_DOMAIN_VENC] = { + .name = "venc", + .sta_mask = PWR_STATUS_VENC, + .ctl_offs = 0x0304, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .bp_smi = { + BUS_PROT_WR(BIT(1), 0x3c4, 0x3c8, 0x3c0), + }, + }, + [MT8365_POWER_DOMAIN_AUDIO] = { + .name = "audio", + .sta_mask = PWR_STATUS_AUDIO, + .ctl_offs = 0x0314, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(12, 8), + .sram_pdn_ack_bits = GENMASK(17, 13), + .bp_infracfg = { + BUS_PROT_WR(BIT(27) | BIT(28), 0x2a8, 0x2ac, 0x258), + }, + .caps = MTK_SCPD_ACTIVE_WAKEUP, + }, + [MT8365_POWER_DOMAIN_CONN] = { + .name = "conn", + .sta_mask = PWR_STATUS_CONN, + .ctl_offs = 0x032c, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = 0, + .sram_pdn_ack_bits = 0, + .bp_infracfg = { + BUS_PROT_WR(BIT(13), 0x2a0, 0x2a4, 0x228), + BUS_PROT_WR(BIT(18), 0x2a8, 0x2ac, 0x258), + BUS_PROT_WR(BIT(14), 0x2a0, 0x2a4, 0x228), + BUS_PROT_WR(BIT(21), 0x2a8, 0x2ac, 0x258), + }, + .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_KEEP_DEFAULT_OFF, + }, + [MT8365_POWER_DOMAIN_MFG] = { + .name = "mfg", + .sta_mask = PWR_STATUS_MFG, + .ctl_offs = 0x0338, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(9, 8), + .sram_pdn_ack_bits = GENMASK(13, 12), + .bp_infracfg = { + BUS_PROT_WR(BIT(25), 0x2a0, 0x2a4, 0x228), + BUS_PROT_WR(BIT(21) | BIT(22), 0x2a0, 0x2a4, 0x228), + }, + }, + [MT8365_POWER_DOMAIN_CAM] = { + .name = "cam", + .sta_mask = BIT(25), + .ctl_offs = 0x0344, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(9, 8), + .sram_pdn_ack_bits = GENMASK(13, 12), + .bp_infracfg = { + BUS_PROT_WR(BIT(19), 0x2a8, 0x2ac, 0x258), + }, + .bp_smi = { + BUS_PROT_WR(BIT(2), 0x3c4, 0x3c8, 0x3c0), + }, + }, + [MT8365_POWER_DOMAIN_VDEC] = { + .name = "vdec", + .sta_mask = BIT(31), + .ctl_offs = 0x0370, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(8, 8), + .sram_pdn_ack_bits = GENMASK(12, 12), + .bp_smi = { + BUS_PROT_WR(BIT(3), 0x3c4, 0x3c8, 0x3c0), + }, + }, + [MT8365_POWER_DOMAIN_APU] = { + .name = "apu", + .sta_mask = BIT(16), + .ctl_offs = 0x0378, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(14, 8), + .sram_pdn_ack_bits = GENMASK(21, 15), + .bp_infracfg = { + BUS_PROT_WR(BIT(2) | BIT(20), 0x2a8, 0x2ac, 0x258), + }, + .bp_smi = { + BUS_PROT_WR(BIT(4), 0x3c4, 0x3c8, 0x3c0), + }, + }, + [MT8365_POWER_DOMAIN_DSP] = { + .name = "dsp", + .sta_mask = BIT(17), + .ctl_offs = 0x037C, + .pwr_sta_offs = 0x0180, + .pwr_sta2nd_offs = 0x0184, + .sram_pdn_bits = GENMASK(11, 8), + .sram_pdn_ack_bits = GENMASK(15, 12), + .bp_infracfg = { + BUS_PROT_WR(BIT(24) | BIT(30) | BIT(31), 0x2a8, 0x2ac, 0x258), + }, + .caps = MTK_SCPD_ACTIVE_WAKEUP, + }, +}; + +static const struct scpsys_soc_data mt8365_scpsys_data = { + .domains_data = scpsys_domain_data_mt8365, + .num_domains = ARRAY_SIZE(scpsys_domain_data_mt8365), +}; + +#endif /* __SOC_MEDIATEK_MT8365_PM_DOMAINS_H */ diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 29a9028dd9b3..adb7716df0a8 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -23,6 +23,7 @@ #include "mt8186-pm-domains.h" #include "mt8192-pm-domains.h" #include "mt8195-pm-domains.h" +#include "mt8365-pm-domains.h" #define MTK_POLL_DELAY_US 10 #define MTK_POLL_TIMEOUT USEC_PER_SEC @@ -647,6 +648,10 @@ static const struct of_device_id scpsys_of_match[] = { .compatible = "mediatek,mt8195-power-controller", .data = &mt8195_scpsys_data, }, + { + .compatible = "mediatek,mt8365-power-controller", + .data = &mt8365_scpsys_data, + }, { } };