Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp528842pxb; Thu, 12 Aug 2021 23:58:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGzHsvXN4OaMPd1JfdUjCetY5R8gRhOyKlqL4VdofJViblemgEJEyajmxBSt1C43M1U/y9 X-Received: by 2002:a02:8807:: with SMTP id r7mr883000jai.35.1628837901676; Thu, 12 Aug 2021 23:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628837901; cv=none; d=google.com; s=arc-20160816; b=d6LhsB7sPCu9evCz+a7D99kp3hWNW6dkQFrxHvzKWsNYIrm50Rfu/FWqgGEPOXbeZp hdEPyzg3gTtAG+HXbgvPPRX7KUE4A0CGtnengJjxakA0PRIybmDFiIJB/Qm2TOIQaKO6 kH3dLWN3rqh9E1pIMlvFSycyE4I1wYKwew7sIncU+MLjbr5F/fCOog0DbztafkyBHR+F vJj/Y0WD7HMA7bzCGco/Bf/yC1k+i6lco/aJN4UfS1Xn/yaALJX43HtiKNGSEyQUY8SG vwYVAAvPtNnRp+5oP6eozrkhtMKeWvsqsii5oKyRbUxWO/x+4fHdZeoc9ydzebDUcmrp 90eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=4S7hbqcl9LUwlGFeCOTe4jQ+f0OWIJBYm+9hsE/Pm6g=; b=CcPUF/2DlgGXoo29ziWfvkjf8BwANQ08u5SBTTTKtXnUxrV9FC1UKk1MzV3f72GjAQ R+G9e0bA8z+R3dO92HpWDJYRtOf5Pma7tyNcPqPadAZkaU7iuVp097QVuPEq6glUf2hv rF8/cW3wbSTOyFneBOP41LXmdHFm7fA7mud/TQR51hbRjHUbXBGYvtLuwftJT5Qxk191 P9IpKzrAkbY/AkPaFiWL9RCv8iuQls485y84QinOYdq3fCVtgrJfuylEifmMB8QXiNso ads5yunADJFMOPTVeJBrDmknfgdSvwNEXi9qXgkEPo0zN3b1cTCJcUB6gj+X1DE/O1U9 jGJQ== 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=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si570440jal.110.2021.08.12.23.58.11; Thu, 12 Aug 2021 23:58:21 -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=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239085AbhHMG5D (ORCPT + 99 others); Fri, 13 Aug 2021 02:57:03 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:39614 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S239180AbhHMG5C (ORCPT ); Fri, 13 Aug 2021 02:57:02 -0400 X-UUID: 67308cf21b2b44ad96611d3aa39b6319-20210813 X-UUID: 67308cf21b2b44ad96611d3aa39b6319-20210813 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 65011463; Fri, 13 Aug 2021 14:56:32 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 14:56:30 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 14:56:29 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Subject: [PATCH v2 21/29] iommu/mediatek: Just move code position in hw_init Date: Fri, 13 Aug 2021 14:53:16 +0800 Message-ID: <20210813065324.29220-22-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210813065324.29220-1-yong.wu@mediatek.com> References: <20210813065324.29220-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change too. mt8195 IOMMU support bank functions. some global control settings are in bank0. and the other banks have their bank independent setting. Here only move the global control settings and the independent registers together. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 48162e156486..26ac7c4cc3fe 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -750,30 +750,6 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) } writel_relaxed(regval, data->base + REG_MMU_CTRL_REG); - regval = F_L2_MULIT_HIT_EN | - F_TABLE_WALK_FAULT_INT_EN | - F_PREETCH_FIFO_OVERFLOW_INT_EN | - F_MISS_FIFO_OVERFLOW_INT_EN | - F_PREFETCH_FIFO_ERR_INT_EN | - F_MISS_FIFO_ERR_INT_EN; - writel_relaxed(regval, data->base + REG_MMU_INT_CONTROL0); - - regval = F_INT_TRANSLATION_FAULT | - F_INT_MAIN_MULTI_HIT_FAULT | - F_INT_INVALID_PA_FAULT | - F_INT_ENTRY_REPLACEMENT_FAULT | - F_INT_TLB_MISS_FAULT | - F_INT_MISS_TRANSACTION_FIFO_FAULT | - F_INT_PRETETCH_TRANSATION_FIFO_FAULT; - writel_relaxed(regval, data->base + REG_MMU_INT_MAIN_CONTROL); - - 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) | - upper_32_bits(data->protect_base); - writel_relaxed(regval, data->base + REG_MMU_IVRP_PADDR); - if (data->enable_4GB && MTK_IOMMU_HAS_FLAG(data->plat_data, HAS_VLD_PA_RNG)) { /* @@ -807,6 +783,30 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) } writel_relaxed(regval, data->base + REG_MMU_MISC_CTRL); + regval = F_L2_MULIT_HIT_EN | + F_TABLE_WALK_FAULT_INT_EN | + F_PREETCH_FIFO_OVERFLOW_INT_EN | + F_MISS_FIFO_OVERFLOW_INT_EN | + F_PREFETCH_FIFO_ERR_INT_EN | + F_MISS_FIFO_ERR_INT_EN; + writel_relaxed(regval, data->base + REG_MMU_INT_CONTROL0); + + regval = F_INT_TRANSLATION_FAULT | + F_INT_MAIN_MULTI_HIT_FAULT | + F_INT_INVALID_PA_FAULT | + F_INT_ENTRY_REPLACEMENT_FAULT | + F_INT_TLB_MISS_FAULT | + F_INT_MISS_TRANSACTION_FIFO_FAULT | + F_INT_PRETETCH_TRANSATION_FIFO_FAULT; + writel_relaxed(regval, data->base + REG_MMU_INT_MAIN_CONTROL); + + 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) | + upper_32_bits(data->protect_base); + writel_relaxed(regval, data->base + REG_MMU_IVRP_PADDR); + if (devm_request_irq(data->dev, data->irq, mtk_iommu_isr, 0, dev_name(data->dev), (void *)data)) { writel_relaxed(0, data->base + REG_MMU_PT_BASE_ADDR); -- 2.18.0