From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D78FC63793 for ; Thu, 22 Jul 2021 06:38:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 413FA6024A for ; Thu, 22 Jul 2021 06:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231390AbhGVF6N (ORCPT ); Thu, 22 Jul 2021 01:58:13 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:58029 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229931AbhGVF6I (ORCPT ); Thu, 22 Jul 2021 01:58:08 -0400 X-UUID: 9c7c97a1869a4b10bdc9567cbf05ab5a-20210722 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=W5iu4yn7qNOz8O4L5niY76z7dUrVPoTbT38cQYHyaGE=; b=BsWI1Hd7SbxRaMAXdov9QsxTyPV6BzFs5VDH04IK0r9b4xYMEQpeb/vN2AmR5j7uxy9TYCKZ9jPCOSnt9uOhcZ98l2E/7n7c5YdAC7OU6A02CyIePAqWmBIbSwimgy3uay0fgp8cINwZA91z3s2kul1rkciS2RWIi7VYlkcitB8=; X-UUID: 9c7c97a1869a4b10bdc9567cbf05ab5a-20210722 Received: from mtkmrs31.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1951434667; Thu, 22 Jul 2021 14:38:40 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 22 Jul 2021 14:38:34 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 22 Jul 2021 14:38:33 +0800 Message-ID: <1626935913.27875.8.camel@mhfsdcap03> Subject: Re: [PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common From: Yong Wu To: Ikjoon Jang CC: Krzysztof Kozlowski , Rob Herring , Matthias Brugger , "Krzysztof Kozlowski" , Joerg Roedel , Will Deacon , Robin Murphy , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Mediatek SoC support" , , , , , , Date: Thu, 22 Jul 2021 14:38:33 +0800 In-Reply-To: References: <20210715121209.31024-1-yong.wu@mediatek.com> <20210715121209.31024-11-yong.wu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 09C7E65E6584ADFA42B61DD670F9B1049F10F210E285069CFBA433B0E7C4F5862000:8 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gV2VkLCAyMDIxLTA3LTIxIGF0IDIwOjU0ICswODAwL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YXBwbGllZCB0byBtdDgxOTUuIElmIGl0J3Mgb25seSBmb3IgbXQ4MTk1LA0KDQpUaGUgb3RoZXIg cGxhdGZvcm1zIGhhdmUgdGhlIG5lYXJseSBzYW1lIHNldHRpbmcuDQoNCj4gSSB0aGluayB0YWtp bmcgY2FsbGJhY2sgZnVuY3Rpb24gaW5zdGVhZCBvZiBtdGtfc21pX3JlZ19wYWlyW10gYXMgaW5p dCBtZW1iZXINCj4gd291bGQgYmUgYmV0dGVyOg0KPiANCj4gaWYgKGNvbW1vbi0+cGxhdC0+aW5p dCkNCj4gICAgIGNvbW1vbi0+cGxhdC0+aW5pdCguLi4pOw0KPiANCj4gPiArDQo+ID4gKyAgICAg ICB3cml0ZWwoYnVzX3NlbCwgY29tbW9uLT5iYXNlICsgU01JX0JVU19TRUwpOw0KPiA+ICAgICAg ICAgcmV0dXJuIDA7DQo+ID4gIH0NCj4gPg0KPiA+IC0tDQo+ID4gMi4xOC4wDQo+ID4gX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18NCj4gPiBMaW51eC1tZWRp YXRlayBtYWlsaW5nIGxpc3QNCj4gPiBMaW51eC1tZWRpYXRla0BsaXN0cy5pbmZyYWRlYWQub3Jn DQo+ID4gaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5mby9saW51eC1t ZWRpYXRlaw0KPiANCj4gX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX18NCj4gTGludXgtbWVkaWF0ZWsgbWFpbGluZyBsaXN0DQo+IExpbnV4LW1lZGlhdGVrQGxp c3RzLmluZnJhZGVhZC5vcmcNCj4gaHR0cDovL2xpc3RzLmluZnJhZGVhZC5vcmcvbWFpbG1hbi9s aXN0aW5mby9saW51eC1tZWRpYXRlaw0KDQo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57F9C6377D for ; Thu, 22 Jul 2021 06:38:50 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60BFF6127C for ; Thu, 22 Jul 2021 06:38:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60BFF6127C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 26CDB60633; Thu, 22 Jul 2021 06:38:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pBlANb3qx9jw; Thu, 22 Jul 2021 06:38:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 190B960AD3; Thu, 22 Jul 2021 06:38:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DE748C001A; Thu, 22 Jul 2021 06:38:48 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 62439C000E for ; Thu, 22 Jul 2021 06:38:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 522108294A for ; Thu, 22 Jul 2021 06:38:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=mediatek.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YNYDKiKJY5Yh for ; Thu, 22 Jul 2021 06:38:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mailgw01.mediatek.com (unknown [1.203.163.78]) by smtp1.osuosl.org (Postfix) with ESMTP id 0B4AA828F8 for ; Thu, 22 Jul 2021 06:38:44 +0000 (UTC) X-UUID: 9c7c97a1869a4b10bdc9567cbf05ab5a-20210722 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=W5iu4yn7qNOz8O4L5niY76z7dUrVPoTbT38cQYHyaGE=; b=BsWI1Hd7SbxRaMAXdov9QsxTyPV6BzFs5VDH04IK0r9b4xYMEQpeb/vN2AmR5j7uxy9TYCKZ9jPCOSnt9uOhcZ98l2E/7n7c5YdAC7OU6A02CyIePAqWmBIbSwimgy3uay0fgp8cINwZA91z3s2kul1rkciS2RWIi7VYlkcitB8=; X-UUID: 9c7c97a1869a4b10bdc9567cbf05ab5a-20210722 Received: from mtkmrs31.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1951434667; Thu, 22 Jul 2021 14:38:40 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 22 Jul 2021 14:38:34 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 22 Jul 2021 14:38:33 +0800 Message-ID: <1626935913.27875.8.camel@mhfsdcap03> Subject: Re: [PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common From: Yong Wu To: Ikjoon Jang Date: Thu, 22 Jul 2021 14:38:33 +0800 In-Reply-To: References: <20210715121209.31024-1-yong.wu@mediatek.com> <20210715121209.31024-11-yong.wu@mediatek.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 09C7E65E6584ADFA42B61DD670F9B1049F10F210E285069CFBA433B0E7C4F5862000:8 X-MTK: N Cc: youlin.pei@mediatek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , yi.kuo@mediatek.com, srv_heupstream , Krzysztof Kozlowski , Robin Murphy , open list , Krzysztof Kozlowski , iommu@lists.linux-foundation.org, Rob Herring , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , anthony.huang@mediatek.com, ming-fan.chen@mediatek.com, anan.sun@mediatek.com, Will Deacon , "moderated list:ARM/Mediatek SoC support" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, 2021-07-21 at 20:54 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:25 PM Yong Wu wrote: > > > > To improve the performance, add initial setting for smi-common. > > some register use some fix setting(suggested from DE). > > > > Signed-off-by: Yong Wu > > --- > > drivers/memory/mtk-smi.c | 42 ++++++++++++++++++++++++++++++++++++---- > > 1 file changed, 38 insertions(+), 4 deletions(-) [...] > > static const struct mtk_smi_common_plat mtk_smi_sub_common_mt8195 = { > > @@ -530,15 +558,21 @@ 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; > > + const struct mtk_smi_reg_pair *init = common->plat->init; > > + u32 bus_sel = common->plat->bus_sel; /* default is 0 */ > > + int ret, i; > > > > ret = clk_bulk_prepare_enable(common->clk_num, common->clks); > > if (ret) > > return ret; > > > > - if (common->plat->type == MTK_SMI_GEN2 && bus_sel) > > - writel(bus_sel, common->base + SMI_BUS_SEL); > > + if (common->plat->type != MTK_SMI_GEN2) > > + return 0; > > + > > + for (i = 0; i < SMI_COMMON_INIT_REGS_NR && init && init[i].offset; i++) > > + writel_relaxed(init[i].value, common->base + init[i].offset); > > I'm not sure this array for register settings could be applied to other > platforms in future or only applied to mt8195. If it's only for mt8195, The other platforms have the nearly same setting. > I think taking callback function instead of mtk_smi_reg_pair[] as init member > would be better: > > if (common->plat->init) > common->plat->init(...); > > > + > > + writel(bus_sel, common->base + SMI_BUS_SEL); > > return 0; > > } > > > > -- > > 2.18.0 > > _______________________________________________ > > Linux-mediatek mailing list > > Linux-mediatek@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-mediatek > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8F5FC63793 for ; Thu, 22 Jul 2021 06:39:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D45A610F7 for ; Thu, 22 Jul 2021 06:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D45A610F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oUVoWQrX7qa85pBebNJpjuQW0oQA0qfu7CX7fsa14I4=; b=jTjcRZmuKzputI n++6SbM3x+SpHyzbctmvA4qLPoz5RSjHhLiig6YFA4qik4XeO/st36ZejIOJhcEYe+FQ/dA549uRm 1H9MNMCHcKUn55EM84VhVVneH8nF3kqXH2iktTrlycFzw+nGeHt3dp4rbfJPLLm6AvkEzDwaI2buz 2ttMyfwYSkf4lvtjb4+R04CTQ8/ebEe9yHGwpvGfKh4L/Xca31G4C75jsZnuyCIW7J5ir4Flov17U faap2csbKA3B613bkrSWkfEkLNbOf9QjnRJFt6nvHH8XbWm+/xWyLOAZxGZfYmOdAlSjOwPg7HGgX Lq/BmdzhNBrodNnfAysQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6SMO-000Pvq-4j; Thu, 22 Jul 2021 06:39:08 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6SM7-000Ppd-6o; Thu, 22 Jul 2021 06:38:52 +0000 X-UUID: d4486c138ec94694b3b2710e33cda605-20210721 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=W5iu4yn7qNOz8O4L5niY76z7dUrVPoTbT38cQYHyaGE=; b=BsWI1Hd7SbxRaMAXdov9QsxTyPV6BzFs5VDH04IK0r9b4xYMEQpeb/vN2AmR5j7uxy9TYCKZ9jPCOSnt9uOhcZ98l2E/7n7c5YdAC7OU6A02CyIePAqWmBIbSwimgy3uay0fgp8cINwZA91z3s2kul1rkciS2RWIi7VYlkcitB8=; X-UUID: d4486c138ec94694b3b2710e33cda605-20210721 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 989251646; Wed, 21 Jul 2021 23:38:43 -0700 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jul 2021 23:38:41 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 22 Jul 2021 14:38:34 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 22 Jul 2021 14:38:33 +0800 Message-ID: <1626935913.27875.8.camel@mhfsdcap03> Subject: Re: [PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common From: Yong Wu To: Ikjoon Jang CC: Krzysztof Kozlowski , Rob Herring , Matthias Brugger , "Krzysztof Kozlowski" , Joerg Roedel , Will Deacon , Robin Murphy , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Mediatek SoC support" , , , , , , Date: Thu, 22 Jul 2021 14:38:33 +0800 In-Reply-To: References: <20210715121209.31024-1-yong.wu@mediatek.com> <20210715121209.31024-11-yong.wu@mediatek.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 09C7E65E6584ADFA42B61DD670F9B1049F10F210E285069CFBA433B0E7C4F5862000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210721_233851_312474_F299645F X-CRM114-Status: GOOD ( 28.23 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Wed, 2021-07-21 at 20:54 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:25 PM Yong Wu wrote: > > > > To improve the performance, add initial setting for smi-common. > > some register use some fix setting(suggested from DE). > > > > Signed-off-by: Yong Wu > > --- > > drivers/memory/mtk-smi.c | 42 ++++++++++++++++++++++++++++++++++++---- > > 1 file changed, 38 insertions(+), 4 deletions(-) [...] > > static const struct mtk_smi_common_plat mtk_smi_sub_common_mt8195 = { > > @@ -530,15 +558,21 @@ 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; > > + const struct mtk_smi_reg_pair *init = common->plat->init; > > + u32 bus_sel = common->plat->bus_sel; /* default is 0 */ > > + int ret, i; > > > > ret = clk_bulk_prepare_enable(common->clk_num, common->clks); > > if (ret) > > return ret; > > > > - if (common->plat->type == MTK_SMI_GEN2 && bus_sel) > > - writel(bus_sel, common->base + SMI_BUS_SEL); > > + if (common->plat->type != MTK_SMI_GEN2) > > + return 0; > > + > > + for (i = 0; i < SMI_COMMON_INIT_REGS_NR && init && init[i].offset; i++) > > + writel_relaxed(init[i].value, common->base + init[i].offset); > > I'm not sure this array for register settings could be applied to other > platforms in future or only applied to mt8195. If it's only for mt8195, The other platforms have the nearly same setting. > I think taking callback function instead of mtk_smi_reg_pair[] as init member > would be better: > > if (common->plat->init) > common->plat->init(...); > > > + > > + writel(bus_sel, common->base + SMI_BUS_SEL); > > return 0; > > } > > > > -- > > 2.18.0 > > _______________________________________________ > > Linux-mediatek mailing list > > Linux-mediatek@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-mediatek > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 899F4C63793 for ; Thu, 22 Jul 2021 06:40:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5103961221 for ; Thu, 22 Jul 2021 06:40:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5103961221 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l7H+iqAh5SPiKVytkzRPutoZO7I+AiK/k5AmcPirjAw=; b=qWVIEEb0wGjNPo kkzfluFWsTd68nUOqUfng6ePhJNCeqvSlhK5ggRWgyGlYpyh8nP8h0Z8w+rLUY2Cotn1xnb4WGitf YV7XbNg+zK59zKNUyPtNJaHw/eXPE9ijqO5h2CSDFaSP1KbeF5E7yCcr1s3VF6NSLLZtI1fFlwWsR IZ3zXGoWADTn7MXg2gwhQVUtUslyOIJxtPeADwkDLH6CfG7D5kpu6Hi3IomSV/66dVwlqdHaj3c4e ohY0BE+ocAmUGCqEZySGRz1htNLRGU93uWNW1ILWDKfzucO/I/cPBldSvrc9FN5sso67oIPduZp5q ngnBv6iG0nOYy54y5eeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6SMQ-000Pw8-SR; Thu, 22 Jul 2021 06:39:11 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m6SM7-000Ppd-6o; Thu, 22 Jul 2021 06:38:52 +0000 X-UUID: d4486c138ec94694b3b2710e33cda605-20210721 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=W5iu4yn7qNOz8O4L5niY76z7dUrVPoTbT38cQYHyaGE=; b=BsWI1Hd7SbxRaMAXdov9QsxTyPV6BzFs5VDH04IK0r9b4xYMEQpeb/vN2AmR5j7uxy9TYCKZ9jPCOSnt9uOhcZ98l2E/7n7c5YdAC7OU6A02CyIePAqWmBIbSwimgy3uay0fgp8cINwZA91z3s2kul1rkciS2RWIi7VYlkcitB8=; X-UUID: d4486c138ec94694b3b2710e33cda605-20210721 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 989251646; Wed, 21 Jul 2021 23:38:43 -0700 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jul 2021 23:38:41 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 22 Jul 2021 14:38:34 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 22 Jul 2021 14:38:33 +0800 Message-ID: <1626935913.27875.8.camel@mhfsdcap03> Subject: Re: [PATCH v2 10/11] memory: mtk-smi: mt8195: Add initial setting for smi-common From: Yong Wu To: Ikjoon Jang CC: Krzysztof Kozlowski , Rob Herring , Matthias Brugger , "Krzysztof Kozlowski" , Joerg Roedel , Will Deacon , Robin Murphy , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Mediatek SoC support" , , , , , , Date: Thu, 22 Jul 2021 14:38:33 +0800 In-Reply-To: References: <20210715121209.31024-1-yong.wu@mediatek.com> <20210715121209.31024-11-yong.wu@mediatek.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-TM-SNTS-SMTP: 09C7E65E6584ADFA42B61DD670F9B1049F10F210E285069CFBA433B0E7C4F5862000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210721_233851_312474_F299645F X-CRM114-Status: GOOD ( 28.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 2021-07-21 at 20:54 +0800, Ikjoon Jang wrote: > On Thu, Jul 15, 2021 at 8:25 PM Yong Wu wrote: > > > > To improve the performance, add initial setting for smi-common. > > some register use some fix setting(suggested from DE). > > > > Signed-off-by: Yong Wu > > --- > > drivers/memory/mtk-smi.c | 42 ++++++++++++++++++++++++++++++++++++---- > > 1 file changed, 38 insertions(+), 4 deletions(-) [...] > > static const struct mtk_smi_common_plat mtk_smi_sub_common_mt8195 = { > > @@ -530,15 +558,21 @@ 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; > > + const struct mtk_smi_reg_pair *init = common->plat->init; > > + u32 bus_sel = common->plat->bus_sel; /* default is 0 */ > > + int ret, i; > > > > ret = clk_bulk_prepare_enable(common->clk_num, common->clks); > > if (ret) > > return ret; > > > > - if (common->plat->type == MTK_SMI_GEN2 && bus_sel) > > - writel(bus_sel, common->base + SMI_BUS_SEL); > > + if (common->plat->type != MTK_SMI_GEN2) > > + return 0; > > + > > + for (i = 0; i < SMI_COMMON_INIT_REGS_NR && init && init[i].offset; i++) > > + writel_relaxed(init[i].value, common->base + init[i].offset); > > I'm not sure this array for register settings could be applied to other > platforms in future or only applied to mt8195. If it's only for mt8195, The other platforms have the nearly same setting. > I think taking callback function instead of mtk_smi_reg_pair[] as init member > would be better: > > if (common->plat->init) > common->plat->init(...); > > > + > > + writel(bus_sel, common->base + SMI_BUS_SEL); > > return 0; > > } > > > > -- > > 2.18.0 > > _______________________________________________ > > Linux-mediatek mailing list > > Linux-mediatek@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-mediatek > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel