Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3146619ybi; Mon, 10 Jun 2019 05:20:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5RrhgIU8RDZS+DPxoI0FgV0ZXAlN2egGW+ecIbRFp1+IH3yXRUis3Adw9gJFEMcWFgVfm X-Received: by 2002:a63:474a:: with SMTP id w10mr15048410pgk.352.1560169236839; Mon, 10 Jun 2019 05:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560169236; cv=none; d=google.com; s=arc-20160816; b=GGYqesocSortfLEPyiNTzcczUuC3P84B2Ah82SrRI5osjvb7ISppZEqN1kTJZg/AvW /qrtds7rx0565qA65VQRykadz5mnIqPbAHZ2IXoph7ZD0RUShpnTJThD6gtLlrKQwRO3 MFa4u01CkToVggHOk7rom6GeSGNx4/e9wCqlLnjledea2+4OeDVU1EtYhvEEgc8M5mfG N3Ay/qwtN9+XGlCLgUynjOA2a8oZ7IpcZhDGhHsmdOlgvngxJd36CGu+eq4pdbMP5v/2 xhEOWTkCOaj2e78/LPZwN2rLFUN9826NZo/iViHWYORnYAp3Xqp/xAhnyIG3+1ksvodl +rKQ== 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=HF/a1Djy3jE91MbVMnhGJs+7nqWJdIY8Ahxz+op0R79UrK8kKuy2F19YgcVRiVFjdo rrrV5wDnMhFHiOY1AcuHjK/ePNxQdeqdpOE9lPeZnddzHlgmAWIvzIMdX7DAk5Zm/FbD 7rUfx8zDynlsM5yFAzy/VClLleD9NZuJeisyKiKa6nhfxvSbcDjrsn/VZj0lm/QbCwCm Md6oI4pHrcN8F2lXfyHclvpKajhfJay7aSgwlBSAPXabfbvmy3maRr5jyBE2A5BCnmUr k0oCKyqNLko0sxHJMPtp3quioI1UuZFIEpEApX/jnh6+AmVTUTMbBtLrWRFM9Eq+M9GI B6Kw== 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 36si9896859pgn.174.2019.06.10.05.20.21; Mon, 10 Jun 2019 05:20:36 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389852AbfFJMTN (ORCPT + 99 others); Mon, 10 Jun 2019 08:19:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:10935 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2388952AbfFJMTN (ORCPT ); Mon, 10 Jun 2019 08:19:13 -0400 X-UUID: 1cdb9d767b004984a8f93935f8240996-20190610 X-UUID: 1cdb9d767b004984a8f93935f8240996-20190610 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 818783797; Mon, 10 Jun 2019 20:19:07 +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; Mon, 10 Jun 2019 20:19:05 +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; Mon, 10 Jun 2019 20:19:04 +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 v7 03/21] memory: mtk-smi: Use a general config_port interface Date: Mon, 10 Jun 2019 20:17:42 +0800 Message-ID: <1560169080-27134-4-git-send-email-yong.wu@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1560169080-27134-1-git-send-email-yong.wu@mediatek.com> References: <1560169080-27134-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 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