From patchwork Sun Sep 6 15:19:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 11759559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A14D514F9 for ; Sun, 6 Sep 2020 15:19:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BE7F20714 for ; Sun, 6 Sep 2020 15:19:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KThxW4js"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="SX4GDYqT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BE7F20714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gj7uDtdjYhRg5uCTOHa574BNtw0UhUx6/BiC13ZB7N4=; b=KThxW4jsD38KuZAXSApUcsvXT NU92kDeQyQ5iseu5hDXSwsS5DWF66UN4opkSs/vsCNC9cEaYiw7DIKoRIgZwxgc5OMEjYe+MNwAfz xk2NBKQDymoJz7vT1uME6iHFfo/FDN4blR30RXtd1TSk9/N4c9aAc7FAIXHPlr2a5cPZ7FPYmIYBr GIhOCWs0rXom0V8kBMph8wsViFQWcjCWQVm0MzzlMBaqyjIhY5M1/9XaTjivoMpASfeASH+M3raRn Jlj3poFe8SE6Olth9kq62qCX8CIPJ/Ye55rt/DNUMaBTQ6ovZA42UEb2N3ZbH0lTtOWHcQRprqU1p 8hpYahkMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEwSG-0004Ot-Jn; Sun, 06 Sep 2020 15:19:44 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kEwS8-0004Ll-I7 for linux-arm-kernel@lists.infradead.org; Sun, 06 Sep 2020 15:19:38 +0000 Received: by mail-wm1-x344.google.com with SMTP id z9so11033879wmk.1 for ; Sun, 06 Sep 2020 08:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uHlPaejxaoEdhUtjcAkbEk5MwemH61sGbulo7nTGaVI=; b=SX4GDYqTPOGWjEBwAPJ+63c5XJ+ugOUtKfk2l97qxzdS2k0Gs3m/RL1RxgLIqb9BGI GJzExp+fn4OA+P/b5Kx45NWqujGTB+EFHnJLjWDAsCu5e9IAyZe5RTNQSeCuXK1iGUBg ViS+LLN/xduUf/moO8/9B9eaCe2k/rBPGM05InBZDCSiKeQiJJgeD5+Wd7nRJfvpJl3D rseB2sAArVCsO6cAhTtEUqykbhjl/MSC3j2sngJ0x8bc5ATvxhvVw41dNoxye+lbXAZg zDoeVjmXF3eC9s4u20sPCwq2i26V0JPWhbcBJaBEQi1yTJcqExo3/h/EsPvOUeklCzVx +XvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uHlPaejxaoEdhUtjcAkbEk5MwemH61sGbulo7nTGaVI=; b=FwaUb7Z4qyS9UjQ3o/HA9PNKPJZUpCsjNIegDN2XHBqj96nVEpwVcmYNQ/rpMx4cjl xBDx2jw8nSBHwIww4TfciIImDG6Gt0qeoisoIWwO21SHiTfelKQ0mm7GOadChFkXk6BX OUoPB/adqoWorgIZfMu64BAzP2XSpB4tnig3BrSGsCjavPLB0+iqww87FrrLE9AjnIJT grjJrtuFx8jpkqJAtRot/K3qXl668p2IQzs2Uv00C5TTE6a5IOdXItfi7hD0lYl8DY2t LPV1HLbpgXmUujOBHfdCBtoXUylAajQncKWbwYzAQgXva8sCAg3l+iPeGMtg2n5ig5Ex lhwA== X-Gm-Message-State: AOAM531v0ZfWwPStahuFkofryEJOeka95HZCF1+0AT8JYJXPpbN5+aJg 2tzMglKqDAQAGW6/bZ4XyCuQ5Q== X-Google-Smtp-Source: ABdhPJxTiP5W3hXf0jIMlYDRBifFpSbd8PfKRCSzquyfrJqE89SWeJ2IDFhFHf02RC+vrWN02y3xIw== X-Received: by 2002:a1c:c90d:: with SMTP id f13mr16979046wmb.25.1599405575412; Sun, 06 Sep 2020 08:19:35 -0700 (PDT) Received: from localhost.localdomain (208.19.23.93.rev.sfr.net. [93.23.19.208]) by smtp.gmail.com with ESMTPSA id a15sm26420646wrn.3.2020.09.06.08.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 08:19:34 -0700 (PDT) From: Fabien Parent To: iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 2/3] iommu/mediatek: add flag for legacy ivrp paddr Date: Sun, 6 Sep 2020 17:19:27 +0200 Message-Id: <20200906151928.881209-2-fparent@baylibre.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200906151928.881209-1-fparent@baylibre.com> References: <20200906151928.881209-1-fparent@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200906_111936_619553_ED2E32A8 X-CRM114-Status: GOOD ( 14.87 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:344 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matthias.bgg@gmail.com, Fabien Parent , joro@8bytes.org, robh+dt@kernel.org, yong.wu@mediatek.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add a new flag in order to select which IVRP_PADDR format is used by an SoC. Signed-off-by: Fabien Parent --- v3: set LEGACY_IVRP_PADDR as a flag instead of platform data v2: new patch --- drivers/iommu/mtk_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 785b228d39a6..b1f85a7e9346 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -116,6 +116,7 @@ #define OUT_ORDER_WR_EN BIT(4) #define HAS_SUB_COMM BIT(5) #define WR_THROT_EN BIT(6) +#define HAS_LEGACY_IVRP_PADDR BIT(7) #define MTK_IOMMU_HAS_FLAG(pdata, _x) \ ((((pdata)->flags) & (_x)) == (_x)) @@ -582,7 +583,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) F_INT_PRETETCH_TRANSATION_FIFO_FAULT; writel_relaxed(regval, data->base + REG_MMU_INT_MAIN_CONTROL); - if (data->plat_data->m4u_plat == M4U_MT8173) + if (MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_LEGACY_IVRP_PADDR)) regval = (data->protect_base >> 1) | (data->enable_4GB << 31); else regval = lower_32_bits(data->protect_base) | @@ -818,7 +819,8 @@ static const struct mtk_iommu_plat_data mt6779_data = { static const struct mtk_iommu_plat_data mt8173_data = { .m4u_plat = M4U_MT8173, - .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI, + .flags = HAS_4GB_MODE | HAS_BCLK | RESET_AXI | + HAS_LEGACY_IVRP_PADDR, .inv_sel_reg = REG_MMU_INV_SEL_GEN1, .larbid_remap = {{0}, {1}, {2}, {3}, {4}, {5}}, /* Linear mapping. */ };