Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4169608pxb; Tue, 25 Jan 2022 05:04:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKTXtT4ZPm4bYdaF/1kuqJ5TCcSe/V0zm7IAn7v69QNmv3n+b9t8xdVOz+v1tAoCtByhI7 X-Received: by 2002:a17:903:2049:b0:14b:61:b19e with SMTP id q9-20020a170903204900b0014b0061b19emr18433563pla.20.1643115853279; Tue, 25 Jan 2022 05:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643115853; cv=none; d=google.com; s=arc-20160816; b=x3lG1fvbfQHoAHl1kQCxWo5UUNNsqAO9W36Cpsaoww8p3P2UpGoSd1F675X29qwHmH pwIWuCG2L7gkH2unaMZc2qPaXa8DWYrBpTkzJIBU7LkJfhk5VWYagoqxFzQK8vc1ympl zjGVwi/AlIRQhUclA0EjI+UlV0YAjtJaZlInOnxSDDLosFj/oohZmG9Q65WodqBjZKJ+ G3myB74To7PYRg1VWNvWgrSIk/la8ClUjCPGwocZRCeuvyRvqdBYK4/RMZZpsdDcU1dM BhCTfQ96471ny6OL8+cu6wNUwV+wOSbbOQERstKryg9IDyyhQjLzfQg+79ERlSEo/8yl J8Gw== 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=jVw0m/qi8ObK2SI9xVQofeW/Iq88nCJwhtQN+MGTjyQ=; b=FnGw7f5QdSTPAA9mJOKaVRe+APjyI+QtpNiEn4FsBsEvXa9lObksY3nGHxxnzcFuVG piZ2QdQVn6UI8OG4oLjmVdP73+7+eX5ID1H3nyrmYYyMrjMKejKsWhqdB3cR77vwWV8e 7yt0z4aqVYEuViZPzE2sOOAwh/7nTqu2/3ea+Znas8j4vsFhD0qrEVbqf9dsOhd+UP60 ASANGWKR1I3bK7PVUloe12lUqwccy+jEUBI5MUVwXMDiff1VFZz48FJbU2FkSvLdRriq i4hnKmtC+n2v0z8mOPNWUTA1dlxki4x95dBMNcY8UVH4+N2pdhYtc7g3UuylSeIAVkhf TmTg== 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 v9si16981479plg.388.2022.01.25.05.03.58; Tue, 25 Jan 2022 05:04:13 -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 S1456008AbiAYJH6 (ORCPT + 99 others); Tue, 25 Jan 2022 04:07:58 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:37960 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1454602AbiAYJC0 (ORCPT ); Tue, 25 Jan 2022 04:02:26 -0500 X-UUID: 089594734954453985adea28b154e097-20220125 X-UUID: 089594734954453985adea28b154e097-20220125 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 741491565; Tue, 25 Jan 2022 17:00:27 +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:25 +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:24 +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 27/35] iommu/mediatek: Remove mtk_iommu.h Date: Tue, 25 Jan 2022 16:56:26 +0800 Message-ID: <20220125085634.17972-28-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 Currently there is only compare_of/release_of/a suspend structure in the header file. I think it is no need to keep a header file only for these. Move these into the c file and rm this header file. I think there should be a common helper for compare_of and release_of. There is many copy in drm, it should be another topic. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 25 ++++++++++++++++++++- drivers/iommu/mtk_iommu.h | 42 ------------------------------------ drivers/iommu/mtk_iommu_v1.c | 21 +++++++++++++++--- 3 files changed, 42 insertions(+), 46 deletions(-) delete mode 100644 drivers/iommu/mtk_iommu.h diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 80c1e5a75868..f88c7bb235bf 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,7 @@ #include #include -#include "mtk_iommu.h" +#include #define REG_MMU_PT_BASE_ADDR 0x000 #define MMU_PT_ADDR_MASK GENMASK(31, 7) @@ -166,6 +167,17 @@ struct mtk_iommu_iova_region { unsigned long long size; }; +struct mtk_iommu_suspend_reg { + u32 misc_ctrl; + u32 dcm_dis; + u32 ctrl_reg; + u32 int_control0; + u32 int_main_control; + u32 ivrp_paddr; + u32 vld_pa_rng; + u32 wr_len_ctrl; +}; + struct mtk_iommu_plat_data { enum mtk_iommu_plat m4u_plat; u32 flags; @@ -219,6 +231,17 @@ struct mtk_iommu_domain { struct mutex mutex; /* Protect "data" in this structure */ }; +/* TODO: A common helper is expected. */ +static inline int compare_of(struct device *dev, void *data) +{ + return dev->of_node == data; +} + +static inline void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static inline int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h deleted file mode 100644 index d332f9769f83..000000000000 --- a/drivers/iommu/mtk_iommu.h +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2015-2016 MediaTek Inc. - * Author: Honghui Zhang - */ - -#ifndef _MTK_IOMMU_H_ -#define _MTK_IOMMU_H_ - -#include -#include -#include -#include -#include -#include -#include - -struct mtk_iommu_suspend_reg { - union { - u32 standard_axi_mode;/* v1 */ - u32 misc_ctrl;/* v2 */ - }; - u32 dcm_dis; - u32 ctrl_reg; - u32 int_control0; - u32 int_main_control; - u32 ivrp_paddr; - u32 vld_pa_rng; - u32 wr_len_ctrl; -}; - -static inline int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - -static inline void release_of(struct device *dev, void *data) -{ - of_node_put(data); -} - -#endif diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index b762a05328d4..23c3bc175153 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -7,7 +7,6 @@ * * Based on driver/iommu/mtk_iommu.c */ -#include #include #include #include @@ -28,10 +27,9 @@ #include #include #include -#include +#include #include #include -#include "mtk_iommu.h" #define REG_MMU_PT_BASE_ADDR 0x000 @@ -87,6 +85,13 @@ */ #define M2701_IOMMU_PGT_SIZE SZ_4M +struct mtk_iommu_suspend_reg { + u32 standard_axi_mode; + u32 dcm_dis; + u32 ctrl_reg; + u32 int_control0; +}; + struct mtk_iommu_data { void __iomem *base; int irq; @@ -110,6 +115,16 @@ struct mtk_iommu_domain { struct mtk_iommu_data *data; }; +static inline int compare_of(struct device *dev, void *data) +{ + return dev->of_node == data; +} + +static inline void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static inline int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); -- 2.18.0