Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp876787ybl; Wed, 21 Aug 2019 06:56:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzv8wVptMYrLdicDdWXIsGV91EMbpSBEkk2x+4f69Yaz3ZVQjLtjfhnoImb8v3pf4qpXgep X-Received: by 2002:aa7:851a:: with SMTP id v26mr35197293pfn.238.1566395775165; Wed, 21 Aug 2019 06:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566395775; cv=none; d=google.com; s=arc-20160816; b=YL5IuDANTtFlWxuPwpVqNalYJEVZJQSXqGQRC7bEhxx24tfTweWdSW8S0MdgPqRJuR 977WLywu3N3adBV+qdf6fNkwM8mitqh1iP5QYtGCyQ+Aex7u3f+W4om5IVeduad8I/XC xx7uRjQaRba0oSvmtShizH+rOtuFgbTcETfnILRqtrHGbqV3pnI+YG61BN+kVglBsvSj C62Zm9ZhckUaYP3okssBY79LPrIKa+ClLKK+wAr/y79IS/T5govfmQ49wnBazI993NyO JpWmsiKU+fekBFvMjTT1aLNiMTywFVo3DtzOVsd6KRIcKU/P6EU4fNA58M8Z4DhPlDVS EaIw== 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=T7Xw2M/8PmoO24TKaJnvq+qwnVUhHzQ0GoBMIUXyFog=; b=rAl/Gub3BAEzNaJHan5HW14X+XjlW4cvLw88gPr5KnsfyOnwu0S/rQMy5xkxlZ3D8u Tz9A1oxHWvO56RQvsSL3BDXPiKAowQxpIGQWu89n2yS+8vPwrum7kJx0DqJSpQF8/1H7 hAcotmch5YtnMZ4VSg8WFWrxfIxNTBC7UqFNRnNvGgmoA/nOm9HNqAT0pmBXlNflNg3P 8TdvzOzNxGV0mdwsUqQJig7mtCEJge2GNDPBS2Wcgeq159CYXFi2EYb/MCVQ6XPQydJB sbrKIbvKOTgqwozlezsAg9SG4zlah6ULUyoodwAu1Zlr6OVcaYbVR1TXcPs0AItCwCdo ue5g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si44616pjy.39.2019.08.21.06.55.57; Wed, 21 Aug 2019 06:56:15 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729076AbfHUNyj (ORCPT + 99 others); Wed, 21 Aug 2019 09:54:39 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:26180 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726371AbfHUNyj (ORCPT ); Wed, 21 Aug 2019 09:54:39 -0400 X-UUID: 43c7264be2194df6b0ee4f2b8823b386-20190821 X-UUID: 43c7264be2194df6b0ee4f2b8823b386-20190821 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1704539871; Wed, 21 Aug 2019 21:54:27 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 21 Aug 2019 21:54:27 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 21 Aug 2019 21:54:26 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Will Deacon CC: Rob Herring , Evan Green , Tomasz Figa , , , , , , , , , Nicolas Boichat , , Matthias Kaehlcke , , , Subject: [PATCH v10 03/23] memory: mtk-smi: Use a general config_port interface Date: Wed, 21 Aug 2019 21:53:06 +0800 Message-ID: <1566395606-7975-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> References: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain 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_direct_to_common_mask" for these larbs which connect to smi-commmon directly. This is also a preparing patch for adding mt8183 SMI support. Signed-off-by: Yong Wu Reviewed-by: Matthias Brugger Reviewed-by: Evan Green --- 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 42ab43a..14f70cf 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -45,6 +45,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_direct_to_common_mask; }; struct mtk_smi { @@ -168,17 +169,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_direct_to_common_mask) return; for_each_set_bit(i, (unsigned long *)larb->mmu, 32) { @@ -253,7 +250,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_direct_to_common_mask = BIT(8) | BIT(9), /* bdpsys */ }; static const struct of_device_id mtk_smi_larb_of_ids[] = { -- 1.9.1