Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp407713imu; Fri, 21 Dec 2018 00:58:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN7k9hbU59o1JD5kP4cFFnx8Lzi+6Ns0ZCNFtctbSoda6KJk1dK7rCvMiXY0fHl7lSu7clqn X-Received: by 2002:a17:902:c05:: with SMTP id 5mr1659139pls.155.1545382711051; Fri, 21 Dec 2018 00:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545382711; cv=none; d=google.com; s=arc-20160816; b=W3bw1BsJ7il2Ua5f+VqhmyplwODaSYXduKLtRpNABhKNJaKU/uvthRlkBfPYh/Q/aX u+9Po8OBCJu1Og5ZZzK5sv0yu1GJeiQA9pO8vCitRqFSYBGFadsvdcCYuRlefL7Db9Ky wKAPMYcCBwb4Pa87xu3ENUfppcL8oaUy7yztNw9tUHMD6UaLnP8oWAaaEBJhUiJv/X81 PInSivU+NpEFJS5jkfIwtrGH93De/zxng3aLrqt7UoEGPFZCvZAAhGMC846hKmASIYWa olrxa2Ni8ibToRFTuXRNL8dgcmxOFYI2EmCLQXAXK7rABYSrT0kCSXWgAjwekayEYVOi dK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9H1D9Nqf+4PUZlmYIEOQ3XEEn2RwgBMkN+9rPJV20eA=; b=nfXZdbX4NY5CTMAgfa3FxBfBLDPIFIMmLTncmBPCSh9ECC3TN22ju26rKSujAY5Avf VBYp8+rBJZqM8VjubH+zN+YOWcPMHDQGMylBpufb4tQdr0pL9Nj+Gx+KJk5D3h9lGdmK p0p0vjAknvJ6n5Ux9i1cqx172pFA6RTneCbb6O1dlu0oRqGHIOBh83I8Y8P+vkCjfb9u 0d/4Lq4imqUzW8A5H+g4yW+c+LpWm00s1I6OjE573DozZDv1hXwCq/Rk/q3dbdtWEAQ3 UMyOQaqrez1sI4NXOH0OG18iJoPtNeD6koI3Oip5R/NT4B6R7bNXkEh7tiW9pAc5wD/Z 3I9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ai0vh+Gp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si20253142pgq.553.2018.12.21.00.58.15; Fri, 21 Dec 2018 00:58:31 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ai0vh+Gp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389097AbeLUErV (ORCPT + 99 others); Thu, 20 Dec 2018 23:47:21 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:40253 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388977AbeLUErU (ORCPT ); Thu, 20 Dec 2018 23:47:20 -0500 Received: by mail-qt1-f195.google.com with SMTP id k12so4398621qtf.7 for ; Thu, 20 Dec 2018 20:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9H1D9Nqf+4PUZlmYIEOQ3XEEn2RwgBMkN+9rPJV20eA=; b=ai0vh+GpEJszFZjxgawSbcZLVoZRrKEyh4rUIXLaIf13Z+nv9EcKIYuLzY4vVpMGht AVp//wl67+V1H1FFvv+pPd0aQFxBfdZfhCBAx5Y2UAtu9H8GNfsCArtCtMxaseUg53U4 eJO0jaJh31zVFH9enp+l2BKZbWx8p8ugrahPM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9H1D9Nqf+4PUZlmYIEOQ3XEEn2RwgBMkN+9rPJV20eA=; b=uWP6lJnDctxL/YmIjn1as+veWZTliSHFgIGOiTAz9HEav2AhITnxvFFBT+0/mozQSY TAV+uavqXhsVnbrQ1nFynAn4VyuKmusQqSzg0WZ6bCgBdfG2fwcxoCU40K9WYiEifQtv qLSgwpf4Fa85Pv5L9HQA3y1FSDB48aSZ9s0MZHUv3qkZ42tPYSVLpYgaePHWZe2I5myx 9GsGrJdF5zsmp2b8jRlPyVU3H7HEZhRAHfWhwIyj7wBf6c+l129AsqlMM08X9q7l9wuQ tfBaqUAQX4kd8dB4kTXC4rLTWDjQI+iHY7OH1APy/FMAKwWclVg2okzhwzZTnhewFQ9O /Lzg== X-Gm-Message-State: AA+aEWaJdnW21cw5A4/cte88YDUzfQABdPjtVFHHJr+vR9ST+oW37fLK f9DIyYtUXurQcEqeBvpqJek2H5pe6eNe0ID+/MxTlg== X-Received: by 2002:ac8:6b18:: with SMTP id w24mr972568qts.144.1545367639289; Thu, 20 Dec 2018 20:47:19 -0800 (PST) MIME-Version: 1.0 References: <1544258371-4600-1-git-send-email-yong.wu@mediatek.com> <1544258371-4600-14-git-send-email-yong.wu@mediatek.com> In-Reply-To: <1544258371-4600-14-git-send-email-yong.wu@mediatek.com> From: Nicolas Boichat Date: Fri, 21 Dec 2018 12:47:08 +0800 Message-ID: Subject: Re: [PATCH v4 13/18] memory: mtk-smi: Add bus_sel for mt8183 To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Robin Murphy , Rob Herring , Tomasz Figa , Will Deacon , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, lkml , linux-arm Mailing List , iommu@lists.linux-foundation.org, arnd@arndb.de, yingjoe.chen@mediatek.com, youlin.pei@mediatek.com, Arvind Yadav Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 8, 2018 at 4:43 PM Yong Wu wrote: > > There are 2 mmu cells in a M4U HW. we could adjust some larbs entering > mmu0 or mmu1 to balance the bandwidth via the smi-common register > SMI_BUS_SEL(0x220)(Each larb occupy 2 bits). > > In mt8183, For better performance, we switch larb1/2/5/7 to enter > mmu1 while the others still keep enter mmu0. > > In mt8173 and mt2712, we don't get the performance issue, > Keep its default value(0x0), that means all the larbs enter mmu0. > > Signed-off-by: Yong Wu > --- > drivers/memory/mtk-smi.c | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c > index ee6165e..88eb61a 100644 > --- a/drivers/memory/mtk-smi.c > +++ b/drivers/memory/mtk-smi.c > @@ -49,6 +49,12 @@ > #define SMI_LARB_NONSEC_CON(id) (0x380 + ((id) * 4)) > #define F_MMU_EN BIT(0) > > +/* SMI COMMON */ > +#define SMI_BUS_SEL 0x220 > +#define SMI_BUS_LARB_SHIFT(larbid) ((larbid) << 1) > +/* All are MMU0 defaultly. Only specialize mmu1 here. */ > +#define F_MMU1_LARB(larbid) (0x1 << SMI_BUS_LARB_SHIFT(larbid)) > + > enum mtk_smi_gen { > MTK_SMI_GEN1, > MTK_SMI_GEN2 > @@ -57,6 +63,7 @@ enum mtk_smi_gen { > struct mtk_smi_common_plat { > enum mtk_smi_gen gen; > bool has_gals; > + u32 bus_sel; /* Balance some larbs to enter mmu0 or mmu1 */ > }; > > struct mtk_smi_larb_gen { > @@ -72,8 +79,8 @@ struct mtk_smi { > struct clk *clk_apb, *clk_smi; > struct clk *clk_gals0, *clk_gals1; > struct clk *clk_async; /*only needed by mt2701*/ > - void __iomem *smi_ao_base; > - > + void __iomem *smi_ao_base; /* only for gen1 */ > + void __iomem *base; /* only for gen2 */ > const struct mtk_smi_common_plat *plat; > }; > > @@ -409,6 +416,8 @@ static int __maybe_unused mtk_smi_larb_suspend(struct device *dev) > static const struct mtk_smi_common_plat mtk_smi_common_mt8183 = { > .gen = MTK_SMI_GEN2, > .has_gals = true, > + .bus_sel = F_MMU1_LARB(1) | F_MMU1_LARB(2) | F_MMU1_LARB(5) | > + F_MMU1_LARB(7), Maybe it's ok for now, but I wonder if this is something that should be specified in device tree? Maybe different applications will want different larb split between MMU0 and MMU1? > }; > > static const struct of_device_id mtk_smi_common_of_ids[] = { > @@ -481,6 +490,11 @@ static int mtk_smi_common_probe(struct platform_device *pdev) > ret = clk_prepare_enable(common->clk_async); > if (ret) > return ret; > + } else { > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + common->base = devm_ioremap_resource(dev, res); > + if (IS_ERR(common->base)) > + return PTR_ERR(common->base); > } > pm_runtime_enable(dev); > platform_set_drvdata(pdev, common); > @@ -496,6 +510,7 @@ static int mtk_smi_common_remove(struct platform_device *pdev) > static int __maybe_unused mtk_smi_common_resume(struct device *dev) > { > struct mtk_smi *common = dev_get_drvdata(dev); > + u32 bus_sel = common->plat->bus_sel; > int ret; > > ret = mtk_smi_clk_enable(common); > @@ -503,6 +518,9 @@ static int __maybe_unused mtk_smi_common_resume(struct device *dev) > dev_err(common->dev, "Failed to enable clock(%d).\n", ret); > return ret; > } > + > + if (common->plat->gen == MTK_SMI_GEN2 && bus_sel) > + writel(bus_sel, common->base + SMI_BUS_SEL); > return 0; > } > > -- > 1.9.1 >