Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1251593pxk; Thu, 10 Sep 2020 10:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBdPr/moIoNMUyHKsqb0BrpMgEwPJK1vE/9jx9MJZW4fjd8zmXIcjPKb0Emy7EzDdjOtA4 X-Received: by 2002:a17:906:b04a:: with SMTP id bj10mr9897686ejb.303.1599759527756; Thu, 10 Sep 2020 10:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599759527; cv=none; d=google.com; s=arc-20160816; b=VLfluEfZvNmzFWZsSNEaMVrzU3cNGG10vGIhuSB5OB3opTvdjstih3R5y02tEe1hd+ jKMSJXmBz3h+qcZcSmgeqhUiVN5Mp/Ugj8ubbKlLXu626qQ9f4t/xInjt//YGqjyjg4j ihfY6js1I/MS/MU24WWyRpjyP4JiRAYWL4sKznAE1D0ZRbkMMMfhMg4hm3wBViiQZsHx 9pWASdyhcOBByrnUGJU5Ce+EFY3y0yLLZdxkcBlbK5QZEXUTSROAw04OTZaC1srHEeZo sjM+m25T0PejKQWtGXDhnmY5bWKwbVPOoPqWS0qBHAUnBp39hvx0EG9D5Wy8M/Gnyb9u QqNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kjBvnkRpG1XpdPyM1OF4scHu1NdpsneNs1BdbWJ0Of4=; b=Qw6jFgqwZinN2MdDosZQM9niT21NkrAUay9twuCiKgvbiJSCFE5qRfhxHlctW0ZXiV TQIniuaowRd5hLfQYexhNRIbltBnJys7ZVQP2q5w9R+4pk2DyV63MLbbGM7XxaG8FeIP ynZRTHav1Of6x23Svi/xJWlpN9Z0JBtVWO9CqtFLTawKYlweRMmwteuvp/gO+GT5ygaL rEHJpzSH25GR4RAmaeJo70/hnaKSy++h2i0LBbgjBaYMg65STxdXDpHoJTcNDVf7koh+ 1UnQ1vCkUf+AGKVaALL3my3UYwi0BiwzbRQu1Ff43VPqLcWFLR+ANy+z+E0npaUoecTu 0pAg== 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 q20si3213564ejx.248.2020.09.10.10.38.23; Thu, 10 Sep 2020 10:38:47 -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 S1726967AbgIJRen (ORCPT + 99 others); Thu, 10 Sep 2020 13:34:43 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54700 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727801AbgIJR2t (ORCPT ); Thu, 10 Sep 2020 13:28:49 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id A991729BB0A From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Cc: Collabora Kernel ML , fparent@baylibre.com, matthias.bgg@gmail.com, drinkcat@chromium.org, hsinyi@chromium.org, weiyi.lu@mediatek.com, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 09/12] soc: mediatek: pm-domains: Allow bus protection to ignore clear ack Date: Thu, 10 Sep 2020 19:28:23 +0200 Message-Id: <20200910172826.3074357-10-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910172826.3074357-1-enric.balletbo@collabora.com> References: <20200910172826.3074357-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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 --- drivers/soc/mediatek/mtk-pm-domains.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c index 52a93a87e313..29e88adc8ea6 100644 --- a/drivers/soc/mediatek/mtk-pm-domains.c +++ b/drivers/soc/mediatek/mtk-pm-domains.c @@ -60,19 +60,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) struct scpsys_bus_prot_data { u32 bus_prot_mask; @@ -80,6 +84,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 @@ -257,6 +262,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); -- 2.28.0