Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp668261pxx; Mon, 26 Oct 2020 18:45:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+zUBzRfPmJbpgoRcr3bH4Uref96XBj7w1SIS2TDyXnW1VKLBDZWbWuKYTQbQ1ThkPkgVZ X-Received: by 2002:a17:906:745:: with SMTP id z5mr150734ejb.76.1603763151473; Mon, 26 Oct 2020 18:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603763151; cv=none; d=google.com; s=arc-20160816; b=x+u0+j2N6wLKxEFwTq8ihxHT95iUhloRV741N8U0vQ/pOT1uIOfaGsxop7omJpdQVS X3XwXlB8ciOn1OB2jGndCnw8PMp9uvdzRq4ie3aNeaagCUbOSQPFGTMeEWZqUuoMNaDp JCcw84TGhtyr2QJic4d0df1yKP4okExHMxv+lMeKp+hoLHsIC24XHRVg91EdmGtdLyFj mda/d6KW2dCZsmyVGrK8qVQ6XE2NQBr4TcGHhGFCU1RhCPlI4Hfa5IqAtoEcwogjWEUT 8j3DBSIaApj+U1GyA6/oLl0WVQzedPin9Xl+quuPFklcDVZXHmkp1qhO6Xy3bPODZHC7 w32Q== 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=upsvRXtTv84qf+D9Axkd/NU02xENiH4RwJjkewmvOFY=; b=nBTldi5GQsv78LAf14VgP1yvD91iXSvmUdV1Gza5qGw53FLuYsgl2iUi4fxpxrbb6z 7mzfebK3S+tRQ9Onulb3n2/6GhAkYZPXhmkG9mIlZwbLpgie1L5WNCLLhuXBeKX5F8qU XVIvWyExQ+zDzTaiWbPhF75cCIY2g1TkUOTvo1O8RUZ0PzCySJNG4Q0II6Ko8NxN5bxl RUfoUG23Nnq1W5OmV53vngmcUDxtSnjN4CwYfMJeVXKrWT7uybkPNRvgBVOrxlmsv2y7 1zfvdKZkTteSViNBQOBBN/u8+dR2/SN+iXY7cB6PW5XXkKo83xQcSXocb4rNENeYpLdd Azew== 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 w10si10558614ejv.268.2020.10.26.18.45.29; Mon, 26 Oct 2020 18:45:51 -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 S1788765AbgJZRzs (ORCPT + 99 others); Mon, 26 Oct 2020 13:55:48 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33836 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1788730AbgJZRzn (ORCPT ); Mon, 26 Oct 2020 13:55:43 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 055161F44FCF 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 , fparent@baylibre.com, weiyi.lu@mediatek.com, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 09/16] soc: mediatek: pm-domains: Allow bus protection to ignore clear ack Date: Mon, 26 Oct 2020 18:55:18 +0100 Message-Id: <20201026175526.2915399-10-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201026175526.2915399-1-enric.balletbo@collabora.com> References: <20201026175526.2915399-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 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 4b610929f858..cd70c84ebbb1 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -164,6 +164,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 00af9f37c201..dda0feed03ea 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 3 -#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