Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4169045pxb; Tue, 25 Jan 2022 05:03:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWBOvfpFsEDUtSHIw+GAKodpKYXD03LForSokj9Ol9TT+pnm98fw5r1GJZOZL6sUDs9ytO X-Received: by 2002:a17:90a:aa95:: with SMTP id l21mr3443666pjq.207.1643115816548; Tue, 25 Jan 2022 05:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643115816; cv=none; d=google.com; s=arc-20160816; b=L0pzcl65vfuP/Oa2G+Dvb+L9Fh7zVvJ3afAOQpgB9Nh4P9zSgluP95KlhB5ZMyppqO 0kfQJAEmw3BjtQEkHqx3RHJy0ksrwpAzwBbC7od+L+VWAJf/tpUVktykd0Yyjk5tfDxC 86zSHeXEV8sV/B+PVlHDUdEkmYoyP5/dbYTMFUWZjIC8g0Op/HaOtc9S3xv2hUuc/1nJ Jf3jKVerhPHlTUs/t6qJxooyPwxYvMOwbPVcAtslWbbYY/RnwVxsU9FjjcZWNvDC2Lz3 bOJn1VbPJycF2PvOiZX9hsumbMHKedzxe4XQ88tQBzAkfZIjkCbf3qkCP/k/ycwy8Q7p MKZQ== 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=91SI7E0BwVhTiUVaul98P4gzv5lj5ybdeWcERsK3h60=; b=0OSRzZeYrCfcn7HeWyjdZ3LuU7Vne7gdUv00vDKRemG0fHNBgoAYjUGhiNaQ701Wt6 LOnrRwKkEBSbP7FiRQIRmLeAvFGCIwvHxD+Z1hevfj2WlO4TeWaiPC76VQphTPSYCglT fNnC1MpWlGn2U5yyogzLMGweNq07C2RJpqzSzHXFQlHC5NMStQeN3Fx65KcRJJ5eoi8E p4y4NzlgqPZnv7UrxU3wLXxuXMgf2WhJg4luY9pzrlxBQ6ubI6uZPX3i2gjTUjkTxEfr 99ykx7vzDxWoZ9E7ZIJV+dEMXOpJGmMqLkr+QF+c9m6pwPnLEVo6lzH2B69JyRCVceoB 2mVg== 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 u10si17829455plh.227.2022.01.25.05.03.20; Tue, 25 Jan 2022 05:03:36 -0800 (PST) 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 S1353663AbiAYJHD (ORCPT + 99 others); Tue, 25 Jan 2022 04:07:03 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:37260 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1454478AbiAYJBz (ORCPT ); Tue, 25 Jan 2022 04:01:55 -0500 X-UUID: e9c65e02bfab470aadecc96b7fcf450f-20220125 X-UUID: e9c65e02bfab470aadecc96b7fcf450f-20220125 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1436497946; Tue, 25 Jan 2022 17:00:09 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Tue, 25 Jan 2022 17:00:08 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 Jan 2022 17:00:06 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , "Matthias Brugger" , Will Deacon CC: Robin Murphy , Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , , "AngeloGioacchino Del Regno" , , , , Subject: [PATCH v4 25/35] iommu/mediatek: Just move code position in hw_init Date: Tue, 25 Jan 2022 16:56:24 +0800 Message-ID: <20220125085634.17972-26-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220125085634.17972-1-yong.wu@mediatek.com> References: <20220125085634.17972-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, prepare for mt8195 IOMMU support bank functions. Some global control settings are in bank0 while 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 Reviewed-by: AngeloGioacchino Del Regno --- 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 fdc14db5b4c0..496ed9ecd23a 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -766,30 +766,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)) { /* @@ -823,6 +799,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