Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp503815pxb; Thu, 23 Sep 2021 05:05:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyguPT9maay6SGp8G4v+EvX4HuX56SfVpD2Q2dtNXQgeMPQBiRzeVfRlFZB7s4Mao7y3cFo X-Received: by 2002:a50:d8cf:: with SMTP id y15mr5065098edj.66.1632398735809; Thu, 23 Sep 2021 05:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632398735; cv=none; d=google.com; s=arc-20160816; b=s0Q4ozd6v2gwqZukkJCnCXbcDPbAZrdqrg902QvqEKS0OSipSrNT52WFdr0lD0Rq7q bQEF5ewy3Jdu8/qDQN6jOdNNAQT+5kIDallPrWcdO4Wl4PVJHHSK6e/ohZxl+ZMyJNzF U+JO3/M+ahCF4cMydEDjTL352vDpPJe5J8g8a1oaH/BUoVUzSZRbyAVEu7xXIEjVfyrn esTYRsMs6VeLfBQtVLOaVz9f869A+VXNF7YKyCAiqIxkQo47MkonrfO848Fh03YLJQSH yDbnjZWi/biWMrfS8kHYIOejwYFHugEy3oNX81A2WJ00LDTCM6+R6Z+wM8lHbf63K6w/ kUCg== 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=FAeHwGwujUEobJi+dtwq+wEv7yBNXBTBkYIrLi7qtKo=; b=dCxygHjNk6mkIUc5XXI96L8kKpLuQcOvD400zDDEW1hyBHiAkbZoffpe50x1AmTcSX Af5vxNwSsDQws5537b+JLlRjbBxUVpCtAaCeWA+Hq0T60BoRjenWwuwJ40KnsTWi8dvg +/vWyhvI7t/twRvoeDQKpiuFCtfjhHVDfWZn4dvk85ilO0IzH5kdeqHkFdkHR20R9Y7p dCLOpDzsWAyYSfpH7TEkBEYSluOEYCm2iJs1saHuFtIHsJ49OaOAXsBCNX91N8xh2Uqt QAK+oqq24eb0I/OhqaA+91GsuTo99HxEPaFrLzPwxBLZG1bqOSe1QFkTMo7SoIr9ZyrY LZpQ== 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 h5si5445478ejj.144.2021.09.23.05.05.11; Thu, 23 Sep 2021 05:05:35 -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 S240948AbhIWMEc (ORCPT + 99 others); Thu, 23 Sep 2021 08:04:32 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:54560 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S240926AbhIWMEb (ORCPT ); Thu, 23 Sep 2021 08:04:31 -0400 X-UUID: 7e00feca84e24546a5b9d0b9d5d3de25-20210923 X-UUID: 7e00feca84e24546a5b9d0b9d5d3de25-20210923 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1177473187; Thu, 23 Sep 2021 20:02:55 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Sep 2021 20:02:54 +0800 Received: from localhost.localdomain (10.17.3.154) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Sep 2021 20:02:53 +0800 From: Yong Wu To: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy CC: Krzysztof Kozlowski , Tomasz Figa , , , , , , , Hsin-Yi Wang , , , , , Subject: [PATCH v3 25/33] iommu/mediatek: Just move code position in hw_init Date: Thu, 23 Sep 2021 19:58:32 +0800 Message-ID: <20210923115840.17813-26-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210923115840.17813-1-yong.wu@mediatek.com> References: <20210923115840.17813-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 --- 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 725e000eee0f..ac31fe8b7aaf 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -731,30 +731,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)) { /* @@ -788,6 +764,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