From patchwork Tue Mar 22 12:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen-KH Cheng X-Patchwork-Id: 12788350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 04253C433F5 for ; Tue, 22 Mar 2022 12:34:45 +0000 (UTC) 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:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zWw96ihP0XC/mrfQwVmWH9L7y9xhkM3FHigCpwlRbco=; b=2Q/c0QXiyx+rM5 RqS6e0zX+e1dMGL0w93abL+okSjtshyb2y2rsVs6Zm8/BZqTlmO6p0e0rZHa3HriNuIVqvkbEHthy n0JnNYrEUFp5vwOJijZSnkhkT2PZ2+I+e0+x4nhKhzflXIVH4zjtBr5J1W5acr4vVXQ1AnQiYd9y+ K/6Sn93qQVSsEUCQK2bz3TBKsrWhTnE3q1+usc815HpiNZGJPTsd5gFJzjfuxI8SHcqBUJlqF2I/M TgEBLDTxij7lxhCb726IYWTenFIMHTFhR/I5uvSAwhugkbS6VoVXyu1yTM4ZhPnUm5WRiV9zh/4i6 GoqP7dFRfwcUa8VFAB+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWdhT-00AyG1-SV; Tue, 22 Mar 2022 12:33:24 +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 1nWdhM-00AyFO-Mk; Tue, 22 Mar 2022 12:33:20 +0000 X-UUID: e3f5f673c03b408ebb1abd48aa28e059-20220322 X-UUID: e3f5f673c03b408ebb1abd48aa28e059-20220322 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1923388601; Tue, 22 Mar 2022 05:33:12 -0700 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Mar 2022 05:28:48 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Mar 2022 20:28:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Mar 2022 20:28:46 +0800 From: Allen-KH Cheng To: Ohad Ben-Cohen , Bjorn Andersson , Mathieu Poirier , Rob Herring , Matthias Brugger CC: Tinghan Shen , , , , , , , Allen-KH Cheng Subject: [PATCH] remoteproc: mediatek: enable cache for mt8186 SCP Date: Tue, 22 Mar 2022 20:28:45 +0800 Message-ID: <20220322122845.4068-1-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220322_053316_753734_9E976EF8 X-CRM114-Status: GOOD ( 11.64 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 1. Set SCP cache size before loading SCP FW. (8KB+8KB) 2. Adjust ipi_buf_offset from 0x7bdb0 to 0x3BDB0 for enableing cache SCP side - IPI Buffer: 0x3BDB0 <-> 0x3C000 - Cache: 0x3C000 <-> 0x40000 Signed-off-by: Allen-KH Cheng --- drivers/remoteproc/mtk_scp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 38609153bf64..24065b6b4da8 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -401,6 +401,14 @@ static int mt8186_scp_before_load(struct mtk_scp *scp) writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_P1); writel(0x0, scp->reg_base + MT8186_SCP_L1_SRAM_PD_p2); + /* + * Set I-cache and D-cache size before loading SCP FW. + * SCP SRAM logical address may change when cache size setting differs. + */ + writel(MT8183_SCP_CACHE_CON_WAYEN | MT8183_SCP_CACHESIZE_8KB, + scp->reg_base + MT8183_SCP_CACHE_CON); + writel(MT8183_SCP_CACHESIZE_8KB, scp->reg_base + MT8183_SCP_DCACHE_CON); + return 0; } @@ -905,7 +913,7 @@ static const struct mtk_scp_of_data mt8186_of_data = { .scp_da_to_va = mt8183_scp_da_to_va, .host_to_scp_reg = MT8183_HOST_TO_SCP, .host_to_scp_int_bit = MT8183_HOST_IPC_INT_BIT, - .ipi_buf_offset = 0x7bdb0, + .ipi_buf_offset = 0x3bdb0, }; static const struct mtk_scp_of_data mt8192_of_data = {