Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1197543pxx; Fri, 30 Oct 2020 04:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzh8bSSThq5KgRudohRIqNC1Uf2yNcT/jF7+imOHKarTKDwyo37hxRvDSinx8KxmgfU1Do X-Received: by 2002:a17:907:42a1:: with SMTP id nf1mr2062612ejb.135.1604058108366; Fri, 30 Oct 2020 04:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604058108; cv=none; d=google.com; s=arc-20160816; b=y9rdAblMCWmuktU6JFhjyzNi9eKuQpjyKN81ofgPhP/TCAwwuOfOPFccaYp0E6g6xT QUtDdJoAXLTPy1liWIPGbWM1/IIz8RdCcn2YhZCiVGtEuTM/wwiTvDS8q/QB5slrCXF1 OVVeMJ6grpBAp9QdD59+Tof0ng8PpbNmxxv7oazPWR4hfixevhSWd0wEGIrNEoe8L19x ix0nMygIdOwf1TAN7+7HPSal5i5zR1zdQn/3cVgufjej/++AqASRlABBiOeuEfsKj5JM VH3Cco6XOwiGDyhIY4qK15v79nyzayUjGA1WUUeW6HH8HA7bmAPzLasH4R0eQ1DY6cPi mqVA== 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; bh=MT0x/win3Db6mxPUZZdVtn1PRw00EqPbPuSmeE6WmsI=; b=TrSo+CtmO2icxatWEoGLZTYysGdLXxHwBwa4jKyvKNufhrSKySVJxB0cJ6NToXgefk 2YVKTDKnHn4L4RulAwh/jjMMSU/c8g7Or96R3Wow2mrcgfnmFGIWmtrrt139Kj0QBrcb 4oz9HumIfEGCfFIdVZNJ9/O1zoBO0tWOSDqH2ZdzfY1BFCHgrCSogaWe9+N2MZauEfRR Hhb9Gb9xMgwbPkptjYs1lENtQYuK/Z8apCJ6IoXTLwR7vBi4eQBWxEWMCIcMVNxFRb2L Yu9ixuhHC4BgqHmN+OPyooPy4QV1Wsuir29YncwUYARROTr469JWzn1In5UoZ4qvsZWE kD0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b27si4097568ejd.487.2020.10.30.04.41.25; Fri, 30 Oct 2020 04:41:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726681AbgJ3Lh3 (ORCPT + 99 others); Fri, 30 Oct 2020 07:37:29 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59004 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgJ3Lgj (ORCPT ); Fri, 30 Oct 2020 07:36:39 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 9D19E1F45EC3 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Cc: matthias.bgg@gmail.com, drinkcat@chromium.org, hsinyi@chromium.org, Collabora Kernel ML , weiyi.lu@mediatek.com, fparent@baylibre.com, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 09/16] soc: mediatek: pm-domains: Allow bus protection to ignore clear ack Date: Fri, 30 Oct 2020 12:36:15 +0100 Message-Id: <20201030113622.201188-10-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030113622.201188-1-enric.balletbo@collabora.com> References: <20201030113622.201188-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Brugger In some cases the hardware does not create an acknowledgment of the bus protection clearing. Add a flag to the bus protection indicating that a clear event will be ignored. Signed-off-by: Matthias Brugger Signed-off-by: Enric Balletbo i Serra --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/soc/mediatek/mtk-pm-domains.c | 3 +++ drivers/soc/mediatek/mtk-pm-domains.h | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 88dec58aedd9..03279a999dfc 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -161,6 +161,9 @@ static int _scpsys_bus_protect_disable(const struct scpsys_bus_prot_data *bpd, else regmap_write(regmap, bpd[i].bus_prot_clr, mask); + if (bpd[i].ignore_clr_ack) + continue; + ret = regmap_read_poll_timeout(regmap, bpd[i].bus_prot_sta, val, !(val & mask), MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT); diff --git a/drivers/soc/mediatek/mtk-pm-domains.h b/drivers/soc/mediatek/mtk-pm-domains.h index 20df5689739b..809d2d43f01d 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.h +++ b/drivers/soc/mediatek/mtk-pm-domains.h @@ -35,19 +35,23 @@ #define SPM_MAX_BUS_PROT_DATA 5 -#define _BUS_PROT(_mask, _set, _clr, _sta, _update) { \ - .bus_prot_mask = (_mask), \ - .bus_prot_set = _set, \ - .bus_prot_clr = _clr, \ - .bus_prot_sta = _sta, \ - .bus_prot_reg_update = _update, \ +#define _BUS_PROT(_mask, _set, _clr, _sta, _update, _ignore) { \ + .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, \ } -#define BUS_PROT_WR(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, false) +#define BUS_PROT_WR(_mask, _set, _clr, _sta) \ + _BUS_PROT(_mask, _set, _clr, _sta, false, false) + +#define BUS_PROT_WR_IGN(_mask, _set, _clr, _sta) \ + _BUS_PROT(_mask, _set, _clr, _sta, false, true) #define BUS_PROT_UPDATE(_mask, _set, _clr, _sta) \ - _BUS_PROT(_mask, _set, _clr, _sta, true) + _BUS_PROT(_mask, _set, _clr, _sta, true, false) #define BUS_PROT_UPDATE_TOPAXI(_mask) \ BUS_PROT_UPDATE(_mask, \ @@ -61,6 +65,7 @@ struct scpsys_bus_prot_data { u32 bus_prot_clr; u32 bus_prot_sta; bool bus_prot_reg_update; + bool ignore_clr_ack; }; #define MAX_SUBSYS_CLKS 10 -- 2.28.0