Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1489859imu; Sat, 8 Dec 2018 00:42:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/WcbvfDSgKorVpkg3N9PLMNKcA68h9m1LbPOSm6CwOZ7CBBeISwJFiKVqe/mQye0YQQ6EUL X-Received: by 2002:a17:902:503:: with SMTP id 3mr5079116plf.233.1544258527675; Sat, 08 Dec 2018 00:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544258527; cv=none; d=google.com; s=arc-20160816; b=NhjDH9DmPnG/6H2vm656kiu8ERM5fAYzkbwJGiephamqyaNg/jHt/xLOeD0y0jikDP esVSBsh6hHdT53hgGaFrNjUGLreLJL9SR6Q/EIUmA5e6I+1k8uzVClajntSM4bSqXYrx TrjbaI7MA/mGsot6+Lixepek/7QAI49vTwFkn4m8xkwvFwvQr/sXVt2bVHrXGyWjsaM7 bROjd7MyHA/sgX1aPlCO9/sE7EoiHz3APBHoH8+mQULS9g3uPpz5H6Uqyp/jvhepMVNY O7SfsSzciz4JnS4BgvJeID0xzwyfKqXsbdNoBoNd3TOBsNizvjTp4xfLNQhxWVKk/TDP 6I8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=VopGigfLiOq1vgm0zSpEKaFAOPR8az3I0ngjjDTexWM=; b=HAuowzKpzDimcatIKf4msbtrsfLOin4frNI3Lb3CTySarxZlRxZJM9amWzpj9JQGxV vkYveF/XONmP0BNX/m3INWpE9sxY2IhTJyIvI5i1Sml/6w3MCXaTClWhvNNYyr3PtZZA RZ3gME/v7+inEhxp8xY5bu2Xf+Pd6xwaZqyeptvIxiFSIyEVkXps50K80srKguIHoCWZ Ifwo7Lc9tFTBhwwL6hw1FpOOrq6YprCe++4EqfuIiBMVZIfwKBLQcowXLgJPPzBvBwam LtLdzIlHhHTHlnmtItYNwGjO/Lou+bNjsGSf2cagVVUIRvR9m/mK5NrWKEQq2HkpGtZV 2I6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si4503340pgq.270.2018.12.08.00.41.52; Sat, 08 Dec 2018 00:42:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726298AbeLHIkt (ORCPT + 99 others); Sat, 8 Dec 2018 03:40:49 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:14320 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726103AbeLHIks (ORCPT ); Sat, 8 Dec 2018 03:40:48 -0500 X-UUID: eefb5238160a4e97bbb6a86d22dac502-20181208 X-UUID: eefb5238160a4e97bbb6a86d22dac502-20181208 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 341957424; Sat, 08 Dec 2018 16:40:44 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 8 Dec 2018 16:40:42 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 8 Dec 2018 16:40:35 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring CC: Tomasz Figa , Will Deacon , , , , , , , , , , , Nicolas Boichat , Arvind Yadav Subject: [PATCH v4 03/18] memory: mtk-smi: Use a general config_port interface Date: Sat, 8 Dec 2018 16:39:16 +0800 Message-ID: <1544258371-4600-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1544258371-4600-1-git-send-email-yong.wu@mediatek.com> References: <1544258371-4600-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 019EF52D53F71633FE94E30690438C536582D15E3140EC7B4E0497439085E0CC2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The config_port of mt2712 and mt8183 are the same. Use a general config_port interface instead. In addition, in mt2712, larb8 and larb9 are the bdpsys larbs which are not the normal larb, their register space are different from the normal one. thus, we can not call the general config_port. In mt8183, IPU0/1 and CCU connect with smi-common directly, they also are not the normal larb. Hence, we add a "larb_special_mask" for these special larbs. This is also a preparing patch for adding mt8183 SMI support. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 8f2d152..3b9ad0e 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -53,6 +53,7 @@ struct mtk_smi_larb_gen { bool need_larbid; int port_in_larb[MTK_LARB_NR_MAX + 1]; void (*config_port)(struct device *); + unsigned int larb_special_mask; /* The special larbs mask. */ }; struct mtk_smi { @@ -176,17 +177,13 @@ void mtk_smi_larb_put(struct device *larbdev) return -ENODEV; } -static void mtk_smi_larb_config_port_mt2712(struct device *dev) +static void mtk_smi_larb_config_port_gen2_general(struct device *dev) { struct mtk_smi_larb *larb = dev_get_drvdata(dev); u32 reg; int i; - /* - * larb 8/9 is the bdpsys larb, the iommu_en is enabled defaultly. - * Don't need to set it again. - */ - if (larb->larbid == 8 || larb->larbid == 9) + if (BIT(larb->larbid) & larb->larb_gen->larb_special_mask) return; for_each_set_bit(i, (unsigned long *)larb->mmu, 32) { @@ -261,7 +258,8 @@ static void mtk_smi_larb_config_port_gen1(struct device *dev) static const struct mtk_smi_larb_gen mtk_smi_larb_mt2712 = { .need_larbid = true, - .config_port = mtk_smi_larb_config_port_mt2712, + .config_port = mtk_smi_larb_config_port_gen2_general, + .larb_special_mask = BIT(8) | BIT(9), /* bdpsys */ }; static const struct of_device_id mtk_smi_larb_of_ids[] = { -- 1.9.1