Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1244773imj; Sun, 17 Feb 2019 01:11:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IaHLDKiS61x2Fpcjruq1ABDSWenVAa829kG/gK4uBuh11jNVlitfmsU5Q8ttGqe3JiSv7gj X-Received: by 2002:a63:1e17:: with SMTP id e23mr13329255pge.130.1550394666501; Sun, 17 Feb 2019 01:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550394666; cv=none; d=google.com; s=arc-20160816; b=QXpZq8v17NB2EG1p2wjL8UgLEWb19uP1pUPIyZiSuGMg9DCiL5EMumYbskH4LxtOP3 OOTTCEcHlgOXoijeQ+cvXQkU5y2vlT84rOhxzG4xisFI8dPdXKDvD+/yjD7c5VaivBUP Pl0Vius1dK9DPIN50AK8jE0ZD3FCjqWbJTD1I3hudZycQz54vSzWu5+nN5/6WkAPUr7x Q0as42EvADoDmqHcSOR10ef7ra1P7ydBxRpu0Ktr+z+Ee5CJNt+ZdTN8eETL+GIJWINC cEUrH8zV8r5If2bZAvmTGmbzGanpFWa9mscnhp+EGayp6F9nEPMeV4Qo4l1WzrzhpCLb jtMQ== 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=ebqx/z2nk9ziEsJqQDIaGW6WKsJt+WMr30w4/lYLHZQ=; b=TI1vBN8bkoJP4Gv/MxMkDqdS/5PXF1M1m9WApj/0tLdVFOSz7cJ1zTHiZU17CfVIuC WnG8deJCuHcSGXJADAh4jKRLK9tTyInNoUAoPMa+CZqDDT7y5aY4esQqSQ68v9CBbaR2 Ue6Dr2f619xoBq8tyztSBAE6xm8caSTGUtsso0UJOB+0XjlTM4sL9ltszgjXFBJSvDen qumh93ojGtznHPGiZLGKbTnmbt1aDi+PvFnU24D+iylKPPHIsB5pC2HUkWG7JX11nEwQ QjbBqL+NGNhJzZGPRwh/bTH9yl/P07Q0QmJfgyJEe7v/9QSr9sWtbQDzLDGIpbhQMbrx 50eQ== 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 b2si10367030pfm.26.2019.02.17.01.10.50; Sun, 17 Feb 2019 01:11:06 -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 S1726954AbfBQJHJ (ORCPT + 99 others); Sun, 17 Feb 2019 04:07:09 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:55450 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725768AbfBQJHI (ORCPT ); Sun, 17 Feb 2019 04:07:08 -0500 X-UUID: 8e550376c8ae42c1849d5847e9d01d07-20190217 X-UUID: 8e550376c8ae42c1849d5847e9d01d07-20190217 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1591928431; Sun, 17 Feb 2019 17:07:00 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 17 Feb 2019 17:06:52 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sun, 17 Feb 2019 17:06:51 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring CC: Evan Green , Tomasz Figa , "Will Deacon" , , , , , , , , , , Nicolas Boichat , , Matthias Kaehlcke Subject: [PATCH v6 03/22] memory: mtk-smi: Use a general config_port interface Date: Sun, 17 Feb 2019 17:04:41 +0800 Message-ID: <1550394300-17420-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> References: <1550394300-17420-1-git-send-email-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: D92796D9E122B8D3BBA5A18BAAC1D8F89FB6142A4E174207C62064ADCB3797C22000: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_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 8f2d152..9fd6b3d 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_direct_to_common_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_direct_to_common_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_direct_to_common_mask = BIT(8) | BIT(9), /* bdpsys */ }; static const struct of_device_id mtk_smi_larb_of_ids[] = { -- 1.9.1