Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1426534ybl; Fri, 23 Aug 2019 20:09:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVtpHlsu21pkkLw9fBQl6N9nlwNoxM4xHtmsJ5hn+NQJo+EuG9bYRgyaqryIFpGhLSPlcM X-Received: by 2002:a17:90a:9f4b:: with SMTP id q11mr8254619pjv.105.1566616152102; Fri, 23 Aug 2019 20:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566616152; cv=none; d=google.com; s=arc-20160816; b=C9cJsvzdpbV+0cq4EH6kK8wXQyp/3juMc4YXTms92BgfuOLs6iaWqrSa7K0XkSWHbr 8Qvap3LA4Wan+6j3S0b3F8q7qlnIN/08FUsATEMdShyQwUvUuKORJTVKSnhG5QNrbAP2 si2ilA3DlGWSz66ctmEChSeZvBPXq1Dettj8gfJGuQb7zZizs2hmN2vmizT2XqYNmZ7A WnzHs4S5+YGufGbLEjl2hceqmcjt0IdjOSQURYJQhg6190cEzNiTezYGDEJuh3WQavns uYqL7suzO2kX2ngF38Z4EJZeKTSyUVRqQhhtuz59v3aTfJBUDrhm5QhtKiCH4E/GqTPV 8pWQ== 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=nEgn4LLfrLJgQpiNL6Og+pdAMOZ4zVf3mO0ug+tkGDb87VFrkJXXchBPt+XQavmdg0 T3dosWJ62EXCF+ygqc4LDKsJtxmC+NTKQbZMgXd3rSA3Sb/yCygt1Amo+xcszEsyZPem i0w4FxU7L/LOQOgOWvR2vh4eQX3tULoa6xFoQodiygoJQewKb8SeSUATkUqyUHym+8Hu wRjRBkLn+Ytiqnla6hT1BkJEchek1D0S9Yj9SdasmNolW9n0MXq0hemMLaXj9VNcqPbc ImPy2Xe5qtxhbKLzIWFIZza0YbSCP9bmdVOdoMdaB8UMebEB7SyXW4acAac1CVSLXZM+ fRjQ== 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 38si4137429pla.352.2019.08.23.20.08.57; Fri, 23 Aug 2019 20:09:12 -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 S1727034AbfHXDEO (ORCPT + 99 others); Fri, 23 Aug 2019 23:04:14 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:28019 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726974AbfHXDEO (ORCPT ); Fri, 23 Aug 2019 23:04:14 -0400 X-UUID: e239fccce8754b18b175c87665078884-20190824 X-UUID: e239fccce8754b18b175c87665078884-20190824 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1758359005; Sat, 24 Aug 2019 11:03:13 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 24 Aug 2019 11:03:06 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 24 Aug 2019 11:03:05 +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 v11 03/23] memory: mtk-smi: Use a general config_port interface Date: Sat, 24 Aug 2019 11:01:48 +0800 Message-ID: <1566615728-26388-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566615728-26388-1-git-send-email-yong.wu@mediatek.com> References: <1566615728-26388-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